mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-02-02 14:07:32 +01:00
Unregister app if fully removed or data is cleared
This fixes a bug where apps were not properly unregistered on Android 8.0+ systems. Also update the log message.
This commit is contained in:
parent
2a21b8ad11
commit
7b651aaaad
@ -250,7 +250,8 @@
|
||||
|
||||
<receiver android:name="org.microg.gms.gcm.UnregisterReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED"/>
|
||||
<action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/>
|
||||
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED"/>
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
|
||||
|
||||
<data android:scheme="package"/>
|
||||
|
@ -8,7 +8,10 @@ import android.util.Log;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Intent.ACTION_PACKAGE_REMOVED;
|
||||
import static android.content.Intent.ACTION_PACKAGE_DATA_CLEARED;
|
||||
import static android.content.Intent.ACTION_PACKAGE_FULLY_REMOVED;
|
||||
import static android.content.Intent.EXTRA_DATA_REMOVED;
|
||||
import static android.content.Intent.EXTRA_REPLACING;
|
||||
|
||||
public class UnregisterReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "GmsGcmUnregisterRcvr";
|
||||
@ -16,10 +19,13 @@ public class UnregisterReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
Log.d(TAG, "Package changed: " + intent);
|
||||
if (ACTION_PACKAGE_REMOVED.contains(intent.getAction()) && intent.getBooleanExtra(EXTRA_DATA_REMOVED, false)) {
|
||||
if ((ACTION_PACKAGE_REMOVED.contains(intent.getAction()) && intent.getBooleanExtra(EXTRA_DATA_REMOVED, false) &&
|
||||
!intent.getBooleanExtra(EXTRA_REPLACING, false)) ||
|
||||
ACTION_PACKAGE_FULLY_REMOVED.contains(intent.getAction()) ||
|
||||
ACTION_PACKAGE_DATA_CLEARED.contains(intent.getAction())) {
|
||||
final GcmDatabase database = new GcmDatabase(context);
|
||||
final String packageName = intent.getData().getSchemeSpecificPart();
|
||||
Log.d(TAG, "Package removed: " + packageName);
|
||||
Log.d(TAG, "Package removed or data cleared: " + packageName);
|
||||
final GcmDatabase.App app = database.getApp(packageName);
|
||||
if (app != null) {
|
||||
new Thread(new Runnable() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user