FileDocCategorySizeDatePackage
PackageReceiver.javaAPI DocAndroid 5.1 API1715Thu Mar 12 22:22:40 GMT 2015com.android.documentsui

PackageReceiver

public class PackageReceiver extends android.content.BroadcastReceiver
Clean up {@link RecentsProvider} when packages are removed.

Fields Summary
Constructors Summary
Methods Summary
public voidonReceive(android.content.Context context, android.content.Intent intent)

        final ContentResolver resolver = context.getContentResolver();

        final String action = intent.getAction();
        if (Intent.ACTION_PACKAGE_FULLY_REMOVED.equals(action)) {
            resolver.call(RecentsProvider.buildRecent(), RecentsProvider.METHOD_PURGE, null, null);

        } else if (Intent.ACTION_PACKAGE_DATA_CLEARED.equals(action)) {
            final Uri data = intent.getData();
            if (data != null) {
                final String packageName = data.getSchemeSpecificPart();
                resolver.call(RecentsProvider.buildRecent(), RecentsProvider.METHOD_PURGE_PACKAGE,
                        packageName, null);
            }
        }