mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-02-23 16:01:09 +01:00
Debloat + Cleanup + Readme update
This commit is contained in:
parent
513464e91f
commit
fdb3ee3b06
@ -16,13 +16,14 @@ This fork tweaks MicroG to be usable by applications that require Google authent
|
||||
- Analytics
|
||||
- Car
|
||||
- Droidguard
|
||||
- Exposure-notifications
|
||||
- Exposure-Notifications
|
||||
- Feedback
|
||||
- Firebase
|
||||
- Games
|
||||
- Location
|
||||
- Maps
|
||||
- Recovery
|
||||
- Registering app permissions
|
||||
- SafetyNet
|
||||
- Self-Check
|
||||
- Search
|
||||
|
@ -1,271 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2017 microG Project Team
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.microg.gms.auth;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountAuthenticatorActivity;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
import org.microg.gms.common.PackageUtils;
|
||||
import org.microg.gms.people.PeopleManager;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static android.accounts.AccountManager.KEY_ACCOUNT_NAME;
|
||||
import static android.accounts.AccountManager.KEY_ACCOUNT_TYPE;
|
||||
import static android.accounts.AccountManager.KEY_ANDROID_PACKAGE_NAME;
|
||||
import static android.accounts.AccountManager.KEY_AUTHTOKEN;
|
||||
import static android.accounts.AccountManager.KEY_CALLER_PID;
|
||||
import static android.accounts.AccountManager.KEY_CALLER_UID;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
||||
public static final String EXTRA_FROM_ACCOUNT_MANAGER = "from_account_manager";
|
||||
public static final String EXTRA_CONSENT_DATA = "consent_data";
|
||||
|
||||
private static final String TAG = "GmsAuthAskPermission";
|
||||
private Account account;
|
||||
private String packageName;
|
||||
private String service;
|
||||
private AuthManager authManager;
|
||||
private ConsentData consentData;
|
||||
private boolean fromAccountManager = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.ask_permission);
|
||||
|
||||
// This makes the dialog take up the full width
|
||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
|
||||
lp.copyFrom(getWindow().getAttributes());
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
getWindow().setAttributes(lp);
|
||||
|
||||
account = new Account(getIntent().getStringExtra(KEY_ACCOUNT_NAME),
|
||||
getIntent().getStringExtra(KEY_ACCOUNT_TYPE));
|
||||
packageName = getIntent().getStringExtra(KEY_ANDROID_PACKAGE_NAME);
|
||||
service = getIntent().getStringExtra(KEY_AUTHTOKEN);
|
||||
if (getIntent().hasExtra(EXTRA_CONSENT_DATA)) {
|
||||
try {
|
||||
consentData = ConsentData.ADAPTER.decode(getIntent().getByteArrayExtra(EXTRA_CONSENT_DATA));
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "No Consent details attached");
|
||||
}
|
||||
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.cancel(packageName.hashCode());
|
||||
|
||||
if (getIntent().hasExtra(EXTRA_FROM_ACCOUNT_MANAGER)) fromAccountManager = true;
|
||||
int callerUid = getIntent().getIntExtra(KEY_CALLER_UID, 0);
|
||||
packageName = PackageUtils.getAndCheckPackage(this, packageName, getIntent().getIntExtra(KEY_CALLER_UID, 0), getIntent().getIntExtra(KEY_CALLER_PID, 0));
|
||||
authManager = new AuthManager(this, account.name, packageName, service);
|
||||
|
||||
// receive package info
|
||||
PackageManager packageManager = getPackageManager();
|
||||
ApplicationInfo applicationInfo;
|
||||
try {
|
||||
applicationInfo = packageManager.getApplicationInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.w(TAG, e);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
CharSequence appLabel = packageManager.getApplicationLabel(applicationInfo);
|
||||
Drawable appIcon = packageManager.getApplicationIcon(applicationInfo);
|
||||
Bitmap profileIcon = PeopleManager.getOwnerAvatarBitmap(this, account.name, false);
|
||||
|
||||
// receive profile icon
|
||||
if (profileIcon != null) {
|
||||
((ImageView) findViewById(R.id.account_photo)).setImageBitmap(profileIcon);
|
||||
} else {
|
||||
new Thread(() -> {
|
||||
final Bitmap profileIcon1 = PeopleManager.getOwnerAvatarBitmap(AskPermissionActivity.this, account.name, true);
|
||||
runOnUiThread(() -> ((ImageView) findViewById(R.id.account_photo)).setImageBitmap(profileIcon1));
|
||||
|
||||
}).start();
|
||||
}
|
||||
|
||||
((ImageView) findViewById(R.id.app_icon)).setImageDrawable(appIcon);
|
||||
if (isOAuth()) {
|
||||
((TextView) findViewById(R.id.title)).setText(getString(R.string.ask_scope_permission_title, appLabel));
|
||||
} else {
|
||||
((TextView) findViewById(R.id.title)).setText(getString(R.string.ask_service_permission_title, appLabel));
|
||||
}
|
||||
findViewById(android.R.id.button1).setOnClickListener(v -> onAllow());
|
||||
findViewById(android.R.id.button2).setOnClickListener(v -> onDeny());
|
||||
((ListView) findViewById(R.id.permissions)).setAdapter(new PermissionAdapter());
|
||||
}
|
||||
|
||||
public void onAllow() {
|
||||
authManager.setPermitted(true);
|
||||
findViewById(android.R.id.button1).setEnabled(false);
|
||||
findViewById(android.R.id.button2).setEnabled(false);
|
||||
findViewById(R.id.progress_bar).setVisibility(VISIBLE);
|
||||
findViewById(R.id.no_progress_bar).setVisibility(GONE);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
AuthResponse response = authManager.requestAuth(fromAccountManager);
|
||||
Bundle result = new Bundle();
|
||||
result.putString(KEY_AUTHTOKEN, response.auth);
|
||||
result.putString(KEY_ACCOUNT_NAME, account.name);
|
||||
result.putString(KEY_ACCOUNT_TYPE, account.type);
|
||||
result.putString(KEY_ANDROID_PACKAGE_NAME, packageName);
|
||||
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
|
||||
setAccountAuthenticatorResult(result);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
finish();
|
||||
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void onDeny() {
|
||||
authManager.setPermitted(false);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.cancel(packageName.hashCode());
|
||||
super.finish();
|
||||
}
|
||||
|
||||
private boolean isOAuth() {
|
||||
return service.startsWith("oauth2:") || service.startsWith("oauth:");
|
||||
}
|
||||
|
||||
private String getScopeLabel(String scope) {
|
||||
if (consentData != null) {
|
||||
for (ConsentData.ScopeDetails scopeDetails : consentData.scopes) {
|
||||
if (scope.equals(scopeDetails.id)) {
|
||||
return scopeDetails.title;
|
||||
}
|
||||
}
|
||||
}
|
||||
String labelResourceId = "permission_scope_";
|
||||
String escapedScope = scope.replace("/", "_").replace("-", "_");
|
||||
if (scope.startsWith("https://")) {
|
||||
labelResourceId += escapedScope.substring(8);
|
||||
} else {
|
||||
labelResourceId += escapedScope;
|
||||
}
|
||||
int labelResource = getResources().getIdentifier(labelResourceId, "string", getPackageName());
|
||||
if (labelResource != 0) {
|
||||
return getString(labelResource);
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
private String getScopeDescription(String scope) {
|
||||
if (consentData != null) {
|
||||
for (ConsentData.ScopeDetails scopeDetails : consentData.scopes) {
|
||||
if (scope.equals(scopeDetails.id)) {
|
||||
return scopeDetails.description;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getServiceLabel(String service) {
|
||||
int labelResource = getResources().getIdentifier("permission_service_" + service + "_label", "string", getPackageName());
|
||||
if (labelResource != 0) {
|
||||
return getString(labelResource);
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
private class PermissionAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (isOAuth()) {
|
||||
return service.split(" ").length;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItem(int position) {
|
||||
if (isOAuth()) {
|
||||
String tokens = service.split(":", 2)[1];
|
||||
return tokens.split(" ")[position];
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return getItem(position).hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
String item = getItem(position);
|
||||
String label;
|
||||
String description;
|
||||
if (isOAuth()) {
|
||||
label = getScopeLabel(item);
|
||||
description = getScopeDescription(item);
|
||||
} else {
|
||||
label = getServiceLabel(item);
|
||||
description = null;
|
||||
}
|
||||
View view = convertView;
|
||||
if (view == null) {
|
||||
view = LayoutInflater.from(AskPermissionActivity.this)
|
||||
.inflate(R.layout.ask_permission_list_entry, parent, false);
|
||||
}
|
||||
((TextView) view.findViewById(android.R.id.text1)).setText(label);
|
||||
TextView textView = (TextView) view.findViewById(android.R.id.text2);
|
||||
if (description != null && !description.isEmpty()) {
|
||||
textView.setText(Html.fromHtml(description.trim().replace("\n", "<br>")));
|
||||
textView.setVisibility(VISIBLE);
|
||||
} else {
|
||||
textView.setVisibility(GONE);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
@ -49,7 +49,6 @@ import static android.accounts.AccountManager.KEY_ACCOUNT_NAME;
|
||||
import static android.accounts.AccountManager.KEY_ACCOUNT_TYPE;
|
||||
import static android.accounts.AccountManager.KEY_AUTHTOKEN;
|
||||
import static android.accounts.AccountManager.KEY_CALLER_PID;
|
||||
import static org.microg.gms.auth.AskPermissionActivity.EXTRA_CONSENT_DATA;
|
||||
|
||||
public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
|
||||
private static final String TAG = "GmsAuthManagerSvc";
|
||||
@ -103,30 +102,6 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
|
||||
details.putParcelable("TokenData", new TokenData(res.auth, res.expiry, scope.startsWith("oauth2:"), getScopes(scope)));
|
||||
result.putBundle("tokenDetails", details);
|
||||
result.putString(KEY_ERROR, "OK");
|
||||
} else {
|
||||
result.putString(KEY_ERROR, "NeedPermission");
|
||||
Intent i = new Intent(context, AskPermissionActivity.class);
|
||||
i.putExtras(extras);
|
||||
i.putExtra(KEY_ANDROID_PACKAGE_NAME, packageName);
|
||||
i.putExtra(KEY_ACCOUNT_TYPE, authManager.getAccountType());
|
||||
i.putExtra(KEY_ACCOUNT_NAME, accountName);
|
||||
i.putExtra(KEY_AUTHTOKEN, scope);
|
||||
try {
|
||||
if (res.consentDataBase64 != null)
|
||||
i.putExtra(EXTRA_CONSENT_DATA, Base64.decode(res.consentDataBase64, Base64.URL_SAFE));
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Can't decode consent data: ", e);
|
||||
}
|
||||
if (notify && NotificationManagerCompat.from(context.getApplicationContext()).areNotificationsEnabled()) {
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.notify(packageName.hashCode(), new NotificationCompat.Builder(context)
|
||||
.setContentIntent(PendingIntent.getActivity(context, 0, i, 0))
|
||||
.setContentTitle(context.getString(R.string.auth_notification_title))
|
||||
.setContentText(context.getString(R.string.auth_notification_content, getPackageLabel(packageName, context.getPackageManager())))
|
||||
.setSmallIcon(android.R.drawable.stat_notify_error)
|
||||
.build());
|
||||
}
|
||||
result.putParcelable(KEY_USER_RECOVERY_INTENT, i);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
|
@ -27,7 +27,6 @@ import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import org.microg.gms.auth.AskPermissionActivity;
|
||||
import org.microg.gms.auth.AuthConstants;
|
||||
import org.microg.gms.auth.AuthManager;
|
||||
import org.microg.gms.auth.AuthResponse;
|
||||
@ -100,28 +99,12 @@ class AccountAuthenticator extends AbstractAccountAuthenticator {
|
||||
result.putString(KEY_ACCOUNT_NAME, account.name);
|
||||
result.putString(KEY_AUTHTOKEN, res.auth);
|
||||
return result;
|
||||
} else {
|
||||
Bundle result = new Bundle();
|
||||
Intent i = new Intent(context, AskPermissionActivity.class);
|
||||
i.putExtras(options);
|
||||
i.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
|
||||
i.putExtra(KEY_ANDROID_PACKAGE_NAME, app);
|
||||
i.putExtra(KEY_ACCOUNT_TYPE, account.type);
|
||||
i.putExtra(KEY_ACCOUNT_NAME, account.name);
|
||||
i.putExtra(KEY_AUTHTOKEN, authTokenType);
|
||||
try {
|
||||
if (res.consentDataBase64 != null)
|
||||
i.putExtra(AskPermissionActivity.EXTRA_CONSENT_DATA, Base64.decode(res.consentDataBase64, Base64.URL_SAFE));
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Can't decode consent data: ", e);
|
||||
}
|
||||
result.putParcelable(KEY_INTENT, i);
|
||||
return result;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,6 @@ import static org.microg.gms.checkin.CheckinService.REGULAR_CHECKIN_INTERVAL;
|
||||
|
||||
public class TriggerReceiver extends WakefulBroadcastReceiver {
|
||||
private static final String TAG = "GmsCheckinTrigger";
|
||||
private static boolean registered = false;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
@ -56,12 +56,9 @@ public class GServicesProvider extends ContentProvider {
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
databaseHelper = new DatabaseHelper(getContext());
|
||||
if (CheckinPrefs.get(getContext()).isEnabled()) {
|
||||
getContext().sendOrderedBroadcast(new Intent(getContext(), org.microg.gms.checkin.TriggerReceiver.class), null);
|
||||
}
|
||||
if (GcmPrefs.get(getContext()).isEnabled()) {
|
||||
getContext().sendBroadcast(new Intent(org.microg.gms.gcm.TriggerReceiver.FORCE_TRY_RECONNECT, null, getContext(), org.microg.gms.gcm.TriggerReceiver.class));
|
||||
}
|
||||
|
||||
getContext().sendOrderedBroadcast(new Intent(getContext(), org.microg.gms.checkin.TriggerReceiver.class), null);
|
||||
getContext().sendBroadcast(new Intent(org.microg.gms.gcm.TriggerReceiver.FORCE_TRY_RECONNECT, null, getContext(), org.microg.gms.gcm.TriggerReceiver.class));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -51,36 +51,6 @@ public class AskPushPermission extends FragmentActivity {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.ask_gcm);
|
||||
|
||||
try {
|
||||
PackageManager pm = getPackageManager();
|
||||
final ApplicationInfo info = pm.getApplicationInfo(packageName, 0);
|
||||
CharSequence label = pm.getApplicationLabel(info);
|
||||
|
||||
((TextView) findViewById(R.id.permission_message)).setText(Html.fromHtml("Allow <b>" + label + "</b> to register for push notifications?"));
|
||||
findViewById(R.id.permission_allow_button).setOnClickListener(v -> {
|
||||
if (answered) return;
|
||||
database.noteAppKnown(packageName, true);
|
||||
answered = true;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(EXTRA_EXPLICIT, true);
|
||||
resultReceiver.send(Activity.RESULT_OK, bundle);
|
||||
finish();
|
||||
});
|
||||
findViewById(R.id.permission_deny_button).setOnClickListener(v -> {
|
||||
if (answered) return;
|
||||
database.noteAppKnown(packageName, false);
|
||||
answered = true;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(EXTRA_EXPLICIT, true);
|
||||
resultReceiver.send(Activity.RESULT_CANCELED, bundle);
|
||||
finish();
|
||||
});
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,6 +2,8 @@
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.microg.gms.gcm
|
||||
|
||||
import android.app.Activity
|
||||
@ -144,7 +146,7 @@ class PushRegisterService : LifecycleService() {
|
||||
private suspend fun register(intent: Intent) {
|
||||
val packageName = intent.appPackageName ?: throw RuntimeException("No package provided")
|
||||
ensureAppRegistrationAllowed(this, database, packageName)
|
||||
Log.d(TAG, "register[req]: " + intent.toString() + " extras=" + intent!!.extras)
|
||||
Log.d(TAG, "register[req]: " + intent.toString() + " extras=" + intent.extras)
|
||||
val bundle = completeRegisterRequest(this, database,
|
||||
RegisterRequest()
|
||||
.build(Utils.getBuild(this))
|
||||
@ -236,7 +238,7 @@ internal class PushRegisterHandler(private val context: Context, private val dat
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendReply(what: Int, id: Int, replyTo: Messenger, data: Bundle, oneWay: Boolean) {
|
||||
private fun sendReply(what: Int, id: Int, replyTo: Messenger, data: Bundle) {
|
||||
if (what == 0) {
|
||||
val outIntent = Intent(ACTION_C2DM_REGISTRATION)
|
||||
outIntent.putExtras(data)
|
||||
@ -248,51 +250,51 @@ internal class PushRegisterHandler(private val context: Context, private val dat
|
||||
sendReplyViaMessage(what, id, replyTo, messageData)
|
||||
}
|
||||
|
||||
private fun replyError(what: Int, id: Int, replyTo: Messenger, errorMessage: String, oneWay: Boolean) {
|
||||
private fun replyError(what: Int, id: Int, replyTo: Messenger, errorMessage: String) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(EXTRA_ERROR, errorMessage)
|
||||
sendReply(what, id, replyTo, bundle, oneWay)
|
||||
sendReply(what, id, replyTo, bundle)
|
||||
}
|
||||
|
||||
private fun replyNotAvailable(what: Int, id: Int, replyTo: Messenger) {
|
||||
replyError(what, id, replyTo, ERROR_SERVICE_NOT_AVAILABLE, false)
|
||||
replyError(what, id, replyTo, ERROR_SERVICE_NOT_AVAILABLE)
|
||||
}
|
||||
|
||||
private val selfAuthIntent: PendingIntent
|
||||
private get() {
|
||||
get() {
|
||||
val intent = Intent()
|
||||
intent.setPackage("com.google.example.invalidpackage")
|
||||
return PendingIntent.getBroadcast(context, 0, intent, 0)
|
||||
}
|
||||
|
||||
override fun handleMessage(msg: Message) {
|
||||
var msg = msg
|
||||
val obj = msg.obj
|
||||
if (msg.what == 0) {
|
||||
var getmsg = msg
|
||||
val obj = getmsg.obj
|
||||
if (getmsg.what == 0) {
|
||||
if (obj is Intent) {
|
||||
val nuMsg = Message.obtain()
|
||||
nuMsg.what = msg.what
|
||||
nuMsg.what = getmsg.what
|
||||
nuMsg.arg1 = 0
|
||||
nuMsg.replyTo = null
|
||||
val packageName = obj.appPackageName
|
||||
val data = Bundle()
|
||||
data.putBoolean("oneWay", false)
|
||||
data.putString("pkg", packageName)
|
||||
data.putBundle("data", msg.data)
|
||||
data.putBundle("data", getmsg.data)
|
||||
nuMsg.data = data
|
||||
msg = nuMsg
|
||||
getmsg = nuMsg
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
val what = msg.what
|
||||
val id = msg.arg1
|
||||
val replyTo = msg.replyTo
|
||||
val what = getmsg.what
|
||||
val id = getmsg.arg1
|
||||
val replyTo = getmsg.replyTo
|
||||
if (replyTo == null) {
|
||||
Log.w(TAG, "replyTo is null")
|
||||
return
|
||||
}
|
||||
val data = msg.data
|
||||
val data = getmsg.data
|
||||
val packageName = data.getString("pkg") ?: return
|
||||
val subdata = data.getBundle("data")
|
||||
try {
|
||||
@ -319,7 +321,7 @@ internal class PushRegisterHandler(private val context: Context, private val dat
|
||||
.app(packageName)
|
||||
.delete(delete)
|
||||
.extraParams(subdata))
|
||||
sendReply(what, id, replyTo, bundle, oneWay)
|
||||
sendReply(what, id, replyTo, bundle)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, e)
|
||||
replyNotAvailable(what, id, replyTo)
|
||||
|
@ -2,6 +2,7 @@
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.microg.gms.phenotype
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.microg.gms.ui
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.microg.gms.ui
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.microg.gms.ui
|
||||
|
||||
@ -64,16 +65,18 @@ class PushNotificationPreferencesFragment : PreferenceFragmentCompat() {
|
||||
}
|
||||
|
||||
private fun updateStatus() {
|
||||
handler.postDelayed(updateRunnable, UPDATE_INTERVAL)
|
||||
lifecycleScope.launchWhenStarted {
|
||||
val statusInfo = getGcmServiceInfo(requireContext())
|
||||
pushStatusCategory.isVisible = statusInfo.configuration.enabled
|
||||
pushStatus.summary = if (statusInfo != null && statusInfo.connected) {
|
||||
getString(R.string.gcm_network_state_connected, DateUtils.getRelativeTimeSpanString(statusInfo.startTimestamp, System.currentTimeMillis(), 0))
|
||||
} else {
|
||||
getString(R.string.gcm_network_state_disconnected)
|
||||
try {
|
||||
handler.postDelayed(updateRunnable, UPDATE_INTERVAL)
|
||||
lifecycleScope.launchWhenStarted {
|
||||
val statusInfo = getGcmServiceInfo(requireContext())
|
||||
pushStatusCategory.isVisible = statusInfo.configuration.enabled
|
||||
pushStatus.summary = if (statusInfo.connected) {
|
||||
getString(R.string.gcm_network_state_connected, DateUtils.getRelativeTimeSpanString(statusInfo.startTimestamp, System.currentTimeMillis(), 0))
|
||||
} else {
|
||||
getString(R.string.gcm_network_state_disconnected)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {}
|
||||
}
|
||||
|
||||
private fun updateContent() {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 The Android Open Source Project
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/desc_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dip"
|
||||
android:paddingLeft="20dip"
|
||||
android:paddingTop="18dip"
|
||||
android:paddingEnd="16dip"
|
||||
android:paddingRight="16dip">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/perm_desc_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/permission_icon"
|
||||
android:layout_width="36dip"
|
||||
android:layout_height="36dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_cloud_bell"
|
||||
app:tint="?attr/colorAccent">
|
||||
</ImageView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/permission_message"
|
||||
style="@style/TextAppearance.AppCompat.Subhead"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dip"
|
||||
android:paddingLeft="16dip"
|
||||
android:text="@string/pref_push_app_allow_register_ask"
|
||||
android:textSize="20sp">
|
||||
</TextView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dip"
|
||||
android:paddingLeft="20dip"
|
||||
android:paddingEnd="16dip"
|
||||
android:paddingRight="16dip">
|
||||
|
||||
<Button
|
||||
android:id="@+id/permission_deny_button"
|
||||
style="?attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/deny">
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
android:id="@+id/permission_allow_button"
|
||||
style="?attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/allow">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
@ -1,132 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2013-2017 microG Project Team
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingTop="10dp"
|
||||
android:text="@string/account_manager_title"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:id="@+id/no_progress_bar"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@color/dialog_border_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:visibility="gone"
|
||||
style="?android:attr/progressBarStyleHorizontal" />
|
||||
|
||||
<LinearLayout
|
||||
android:paddingTop="15dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<FrameLayout
|
||||
android:background="@drawable/circle_shape_background"
|
||||
android:layout_marginEnd="-3dp"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:padding="10dp">
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:src="@drawable/ic_generic_man"
|
||||
android:id="@+id/account_photo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:background="@drawable/circle_shape_background"
|
||||
android:layout_marginStart="-3dp"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:id="@+id/app_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:padding="15dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="18sp"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/ask_scope_permission_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ListView
|
||||
android:padding="5dp"
|
||||
android:id="@+id/permissions"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip" />
|
||||
|
||||
<TextView
|
||||
android:padding="10dp"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/ask_permission_tos"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_gravity="end"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@android:id/button2"
|
||||
style="?attr/buttonBarButtonStyle"
|
||||
android:text="@string/deny"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@android:id/button1"
|
||||
style="?attr/buttonBarButtonStyle"
|
||||
android:text="@string/allow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2013-2017 microG Project Team
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/proprietary_auth_ic_scope_icon_default"
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:padding="6dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:textSize="16sp"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
android:id="@android:id/text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -5,8 +5,7 @@
|
||||
-->
|
||||
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
|
||||
|
@ -85,8 +85,6 @@ Esto puede tardar unos minutos."</string>
|
||||
<string name="pref_add_account_summary">Añadir cuenta de Google</string>
|
||||
<string name="pref_gcm_switcher_title">Recibir notificaciones push</string>
|
||||
<string name="pref_gcm_enable_mcs_summary">Google Cloud Messaging es un proveedor de notificaciónes push usado por muchas aplicaciones de terceros. Pará usarlo tienes que activar registro de dispositivos.</string>
|
||||
<string name="pref_gcm_confirm_new_apps_title">Confirmar apps nuevas</string>
|
||||
<string name="pref_gcm_confirm_new_apps_summary">Preguntar antes de registrar una nueva App para recibir notificaciones push</string>
|
||||
|
||||
<string name="pref_about_title">Acerca de Vanced microG</string>
|
||||
<string name="pref_cast_double_fix">Solucion para Cast duplicado</string>
|
||||
|
@ -85,8 +85,6 @@ Ini bisa berlangsung beberapa menit."</string>
|
||||
<string name="pref_add_account_summary">Tambahkan akun Google</string>
|
||||
<string name="pref_gcm_switcher_title">Terima notifikasi push</string>
|
||||
<string name="pref_gcm_enable_mcs_summary">Google Cloud Messaging adalah penyedia notifikasi push yang digunakan pada banyak aplikasi pihak ketiga. Untuk menggunakannya anda harus mengaktifkan device registration.</string>
|
||||
<string name="pref_gcm_confirm_new_apps_title">Konfirmasi aplikasi baru</string>
|
||||
<string name="pref_gcm_confirm_new_apps_summary">Tanya sebelum meregistrasi aplikasi baru untuk menerima notifikasi push</string>
|
||||
|
||||
<string name="pref_about_title">Tentang Vanced microG</string>
|
||||
<string name="pref_cast_double_fix">Perbaikan Cast terduplikasi</string>
|
||||
|
@ -85,8 +85,6 @@ Questo potrà richiedere un paio di minuti"</string>
|
||||
<string name="pref_add_account_summary">Aggiungi account Google</string>
|
||||
<string name="pref_gcm_switcher_title">Ricevi notifiche push</string>
|
||||
<string name="pref_gcm_enable_mcs_summary">Messaggistica Cloud Google è un fornitore di notifiche push presente in molte applicazioni di terze parti. Per utilizzarlo è necessario attivare la registrazione del dispositivo.</string>
|
||||
<string name="pref_gcm_confirm_new_apps_title">Conferma nuove app</string>
|
||||
<string name="pref_gcm_confirm_new_apps_summary">Chiedi prima di registrare una nuova app per la ricezione di notifiche push</string>
|
||||
|
||||
<string name="pref_about_title">Informazioni su Vanced microG</string>
|
||||
<string name="pref_cast_double_fix">Correzione cast duplicato</string>
|
||||
|
@ -85,8 +85,6 @@ This can take a couple of minutes."</string>
|
||||
<string name="pref_add_account_summary">Add Google account</string>
|
||||
<string name="pref_gcm_switcher_title">Receive push notifications</string>
|
||||
<string name="pref_gcm_enable_mcs_summary">Google Cloud Messaging is a push notification provider used by many third-party applications. To use it you must enable device registration.</string>
|
||||
<string name="pref_gcm_confirm_new_apps_title">Confirm new apps</string>
|
||||
<string name="pref_gcm_confirm_new_apps_summary">Ask before registering a new app to receive push notifications</string>
|
||||
|
||||
<string name="pref_about_title">About Vanced microG</string>
|
||||
<string name="pref_cast_double_fix">Cast duplication fix</string>
|
||||
|
@ -17,12 +17,6 @@
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="gcm_confirm_new_apps"
|
||||
android:summary="@string/pref_gcm_confirm_new_apps_summary"
|
||||
android:title="@string/pref_gcm_confirm_new_apps_title"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="prefcat_networks"
|
||||
android:title="@string/prefcat_push_networks_title">
|
||||
|
Loading…
x
Reference in New Issue
Block a user