Added a receiver to listen to app uninstalls

This commit is contained in:
Hari
2017-01-21 15:28:36 +05:30
parent 2c7d8761a6
commit 7ab9cee0de
2 changed files with 25 additions and 0 deletions

View File

@@ -110,6 +110,13 @@
<action android:name="org.torproject.android.intent.action.STATUS"/>
</intent-filter>
</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 -->
<activity
android:name=".ui.MainActivity"

View File

@@ -0,0 +1,18 @@
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) {
String packageName = intent.getData().getEncodedSchemeSpecificPart();
Uri appUri = KeychainContract.ApiApps.buildByPackageNameUri(packageName);
context.getContentResolver().delete(appUri, null, null);
}
}