diff --git a/README.md b/README.md index 3e4471e5..98ce9923 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/play-services-core/src/main/java/org/microg/gms/auth/AskPermissionActivity.java b/play-services-core/src/main/java/org/microg/gms/auth/AskPermissionActivity.java deleted file mode 100644 index e3317d71..00000000 --- a/play-services-core/src/main/java/org/microg/gms/auth/AskPermissionActivity.java +++ /dev/null @@ -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", "
"))); - textView.setVisibility(VISIBLE); - } else { - textView.setVisibility(GONE); - } - return view; - } - } -} diff --git a/play-services-core/src/main/java/org/microg/gms/auth/AuthManagerServiceImpl.java b/play-services-core/src/main/java/org/microg/gms/auth/AuthManagerServiceImpl.java index 33641b39..2aff2038 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/AuthManagerServiceImpl.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/AuthManagerServiceImpl.java @@ -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); diff --git a/play-services-core/src/main/java/org/microg/gms/auth/loginservice/AccountAuthenticator.java b/play-services-core/src/main/java/org/microg/gms/auth/loginservice/AccountAuthenticator.java index 069379c8..b2072a0c 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/loginservice/AccountAuthenticator.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/loginservice/AccountAuthenticator.java @@ -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 diff --git a/play-services-core/src/main/java/org/microg/gms/checkin/TriggerReceiver.java b/play-services-core/src/main/java/org/microg/gms/checkin/TriggerReceiver.java index e4fdedba..e2bcca5d 100755 --- a/play-services-core/src/main/java/org/microg/gms/checkin/TriggerReceiver.java +++ b/play-services-core/src/main/java/org/microg/gms/checkin/TriggerReceiver.java @@ -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) { diff --git a/play-services-core/src/main/java/org/microg/gms/gservices/GServicesProvider.java b/play-services-core/src/main/java/org/microg/gms/gservices/GServicesProvider.java index 36d64202..57379c87 100644 --- a/play-services-core/src/main/java/org/microg/gms/gservices/GServicesProvider.java +++ b/play-services-core/src/main/java/org/microg/gms/gservices/GServicesProvider.java @@ -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; } diff --git a/play-services-core/src/main/java/org/microg/gms/ui/AskPushPermission.java b/play-services-core/src/main/java/org/microg/gms/ui/AskPushPermission.java index 322ba315..8fdef45f 100755 --- a/play-services-core/src/main/java/org/microg/gms/ui/AskPushPermission.java +++ b/play-services-core/src/main/java/org/microg/gms/ui/AskPushPermission.java @@ -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 " + label + " 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 diff --git a/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt b/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt index 01dd1a58..69c84b30 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt @@ -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) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/phenotype/PhenotypeService.kt b/play-services-core/src/main/kotlin/org/microg/gms/phenotype/PhenotypeService.kt index 354c6833..caf317a5 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/phenotype/PhenotypeService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/phenotype/PhenotypeService.kt @@ -2,6 +2,7 @@ * SPDX-FileCopyrightText: 2020, microG Project Team * SPDX-License-Identifier: Apache-2.0 */ +@file:Suppress("DEPRECATION") package org.microg.gms.phenotype diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationPreferencesFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationPreferencesFragment.kt index 1dd406a1..9e37b9b7 100755 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationPreferencesFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/DeviceRegistrationPreferencesFragment.kt @@ -2,6 +2,7 @@ * SPDX-FileCopyrightText: 2020, microG Project Team * SPDX-License-Identifier: Apache-2.0 */ +@file:Suppress("DEPRECATION") package org.microg.gms.ui diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppPreferencesFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppPreferencesFragment.kt index dba51e9e..cae63c36 100755 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppPreferencesFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAppPreferencesFragment.kt @@ -2,6 +2,7 @@ * SPDX-FileCopyrightText: 2020, microG Project Team * SPDX-License-Identifier: Apache-2.0 */ +@file:Suppress("DEPRECATION") package org.microg.gms.ui diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationPreferencesFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationPreferencesFragment.kt index b4b80167..39093757 100755 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationPreferencesFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationPreferencesFragment.kt @@ -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() { diff --git a/play-services-core/src/main/res/drawable-hdpi/ic_generic_man.png b/play-services-core/src/main/res/drawable-hdpi/ic_generic_man.png deleted file mode 100644 index e1e34623..00000000 Binary files a/play-services-core/src/main/res/drawable-hdpi/ic_generic_man.png and /dev/null differ diff --git a/play-services-core/src/main/res/drawable-mdpi/ic_generic_man.png b/play-services-core/src/main/res/drawable-mdpi/ic_generic_man.png deleted file mode 100644 index 63c44cb9..00000000 Binary files a/play-services-core/src/main/res/drawable-mdpi/ic_generic_man.png and /dev/null differ diff --git a/play-services-core/src/main/res/drawable-xhdpi/ic_generic_man.png b/play-services-core/src/main/res/drawable-xhdpi/ic_generic_man.png deleted file mode 100644 index ddff09ee..00000000 Binary files a/play-services-core/src/main/res/drawable-xhdpi/ic_generic_man.png and /dev/null differ diff --git a/play-services-core/src/main/res/drawable-xhdpi/proprietary_auth_ic_scope_icon_default.png b/play-services-core/src/main/res/drawable-xhdpi/proprietary_auth_ic_scope_icon_default.png deleted file mode 100644 index b07b6f21..00000000 Binary files a/play-services-core/src/main/res/drawable-xhdpi/proprietary_auth_ic_scope_icon_default.png and /dev/null differ diff --git a/play-services-core/src/main/res/drawable-xxhdpi/ic_generic_man.png b/play-services-core/src/main/res/drawable-xxhdpi/ic_generic_man.png deleted file mode 100644 index fa4ffad9..00000000 Binary files a/play-services-core/src/main/res/drawable-xxhdpi/ic_generic_man.png and /dev/null differ diff --git a/play-services-core/src/main/res/layout/ask_gcm.xml b/play-services-core/src/main/res/layout/ask_gcm.xml deleted file mode 100755 index 09fea4da..00000000 --- a/play-services-core/src/main/res/layout/ask_gcm.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/play-services-core/src/main/res/layout/ask_permission.xml b/play-services-core/src/main/res/layout/ask_permission.xml deleted file mode 100755 index 9426a4a8..00000000 --- a/play-services-core/src/main/res/layout/ask_permission.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -