Merge pull request #2008 from rhari991/remove-uninstalled-apps-automatically
Remove api apps when they are uninstalled
This commit is contained in:
@@ -110,6 +110,13 @@
|
|||||||
<action android:name="org.torproject.android.intent.action.STATUS"/>
|
<action android:name="org.torproject.android.intent.action.STATUS"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
<!-- broadcast receiver for listening to package uninstalls -->
|
||||||
|
<receiver android:name=".remote.PackageUninstallReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" />
|
||||||
|
<data android:scheme="package"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
<!-- singleTop for NFC dispatch, see SecurityTokenOperationActivity -->
|
<!-- singleTop for NFC dispatch, see SecurityTokenOperationActivity -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.MainActivity"
|
android:name=".ui.MainActivity"
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package org.sufficientlysecure.keychain.remote;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
|
|
||||||
|
public class PackageUninstallReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (Intent.ACTION_PACKAGE_FULLY_REMOVED.equals(intent.getAction())) {
|
||||||
|
Uri uri = intent.getData();
|
||||||
|
if (uri == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String packageName = uri.getEncodedSchemeSpecificPart();
|
||||||
|
Uri appUri = KeychainContract.ApiApps.buildByPackageNameUri(packageName);
|
||||||
|
context.getContentResolver().delete(appUri, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user