Sync installed app database with package manager on PACKAGE_CHANGED for shared libraries
This commit is contained in:
parent
471d2b86c7
commit
e677d815d4
@ -3,10 +3,12 @@ package org.fdroid.fdroid.receiver;
|
|||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.data.InstalledAppProviderService;
|
import org.fdroid.fdroid.data.InstalledAppProviderService;
|
||||||
|
import org.fdroid.fdroid.installer.PrivilegedInstaller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive {@link Intent#ACTION_PACKAGE_ADDED} and {@link Intent#ACTION_PACKAGE_REMOVED}
|
* Receive {@link Intent#ACTION_PACKAGE_ADDED} and {@link Intent#ACTION_PACKAGE_REMOVED}
|
||||||
@ -32,6 +34,15 @@ public class PackageManagerReceiver extends BroadcastReceiver {
|
|||||||
} else {
|
} else {
|
||||||
InstalledAppProviderService.delete(context, intent.getData());
|
InstalledAppProviderService.delete(context, intent.getData());
|
||||||
}
|
}
|
||||||
|
} else if (Intent.ACTION_PACKAGE_CHANGED.equals(action) && Build.VERSION.SDK_INT >= 29 &&
|
||||||
|
PrivilegedInstaller.isExtensionInstalledCorrectly(context) ==
|
||||||
|
PrivilegedInstaller.IS_EXTENSION_INSTALLED_YES) {
|
||||||
|
String[] allowList = new String[]{"org.chromium.chrome"};
|
||||||
|
for (String allowed : allowList) {
|
||||||
|
if (allowed.equals(intent.getData().getSchemeSpecificPart())) {
|
||||||
|
InstalledAppProviderService.compareToPackageManager(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "unsupported action: " + action + " " + intent);
|
Log.i(TAG, "unsupported action: " + action + " " + intent);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user