Java Code Examples for android.content.Intent#ACTION_PACKAGE_DATA_CLEARED
The following examples show how to use
android.content.Intent#ACTION_PACKAGE_DATA_CLEARED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SliceManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override public void onReceive(Context context, Intent intent) { final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL); if (userId == UserHandle.USER_NULL) { Slog.w(TAG, "Intent broadcast does not contain user handle: " + intent); return; } Uri data = intent.getData(); String pkg = data != null ? data.getSchemeSpecificPart() : null; if (pkg == null) { Slog.w(TAG, "Intent broadcast does not contain package name: " + intent); return; } switch (intent.getAction()) { case Intent.ACTION_PACKAGE_REMOVED: final boolean replacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false); if (!replacing) { mPermissions.removePkg(pkg, userId); } break; case Intent.ACTION_PACKAGE_DATA_CLEARED: mPermissions.removePkg(pkg, userId); break; } }
Example 2
Source File: GeofencingConsistencyReceiver.java From mobile-messaging-sdk-android with Apache License 2.0 | 6 votes |
@Override public void onReceive(final Context context, final Intent intent) { if (!GeofencingHelper.isGeoActivated(context)) { return; } final String action = intent.getAction(); if (StringUtils.isBlank(action)) { return; } switch (action) { case NETWORK_PROVIDER_ENABLED_ACTION: case SCHEDULED_GEO_REFRESH_ACTION: case Intent.ACTION_TIME_CHANGED: case Intent.ACTION_PACKAGE_DATA_CLEARED: case SCHEDULED_GEO_EXPIRE_ACTION: GeofencingConsistencyIntentService.enqueueWork(context, intent); break; } }
Example 3
Source File: GeofencingConsistencyIntentService.java From mobile-messaging-sdk-android with Apache License 2.0 | 5 votes |
private void handleGeoConsistencyAction(Context context, Intent intent, String action) { switch (action) { /* * NETWORK_PROVIDER_ENABLED_ACTION - scheduled 15 seconds after NETWORK_PROVIDER is enabled. Starts monitoring geofences from storage if geo is enabled. * SCHEDULED_GEO_REFRESH_ACTION - scheduled to start when campaign needs to be started and area monitored * Intent.ACTION_TIME_CHANGED - triggered when system date/time is changed manually (set by user in settings), need to go over all campaigns in this case. */ case NETWORK_PROVIDER_ENABLED_ACTION: case SCHEDULED_GEO_REFRESH_ACTION: case Intent.ACTION_TIME_CHANGED: startGeoMonitoringFromScratch(context); break; /* * This action gets called whenever user deletes data from some app, and we're interested in clear Play Services cleared event * because all registered geofences stop being monitored by GPS in that case. */ case Intent.ACTION_PACKAGE_DATA_CLEARED: final Uri data = intent.getData(); if (data != null && GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE.equals(data.getSchemeSpecificPart())) { startGeoMonitoringFromScratch(context); } break; /* * Scheduled to be invoked when first area from geo storage needs to expire. In that case GPS stop monitoring areas, but we * also need to be aware of this event. */ case SCHEDULED_GEO_EXPIRE_ACTION: geofencingHelper(context).removeExpiredAreas(); break; } }
Example 4
Source File: ApplicationStateListener.java From product-emm with Apache License 2.0 | 5 votes |
@Override public void onReceive(Context context, final Intent intent) { String status = null; ApplicationStatus applicationState; switch (intent.getAction()) { case Intent.ACTION_PACKAGE_ADDED: status = "added"; break; case Intent.ACTION_PACKAGE_REMOVED: status = "removed"; break; case Intent.ACTION_PACKAGE_REPLACED: status = "upgraded"; break; case Intent.ACTION_PACKAGE_DATA_CLEARED: status = "dataCleared"; break; default: Log.i(TAG, "Invalid intent received"); } if (status != null) { String packageName = intent.getData().getEncodedSchemeSpecificPart(); applicationState = new ApplicationStatus(); applicationState.setState(status); applicationState.setPackageName(packageName); try { String appState = CommonUtils.toJSON(applicationState); publishEvent(appState, Constants.EventListeners.APPLICATION_STATE); if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, appState); } } catch (AndroidAgentException e) { Log.e(TAG, "Could not convert to JSON"); } } }
Example 5
Source File: ShortcutService.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@Override public void onReceive(Context context, Intent intent) { final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL); if (userId == UserHandle.USER_NULL) { Slog.w(TAG, "Intent broadcast does not contain user handle: " + intent); return; } final String action = intent.getAction(); // This is normally called on Handler, so clearCallingIdentity() isn't needed, // but we still check it in unit tests. final long token = injectClearCallingIdentity(); try { synchronized (mLock) { if (!isUserUnlockedL(userId)) { if (DEBUG) { Slog.d(TAG, "Ignoring package broadcast " + action + " for locked/stopped user " + userId); } return; } // Whenever we get one of those package broadcasts, or get // ACTION_PREFERRED_ACTIVITY_CHANGED, we purge the default launcher cache. final ShortcutUser user = getUserShortcutsLocked(userId); user.clearLauncher(); } if (Intent.ACTION_PREFERRED_ACTIVITY_CHANGED.equals(action)) { // Nothing farther to do. return; } final Uri intentUri = intent.getData(); final String packageName = (intentUri != null) ? intentUri.getSchemeSpecificPart() : null; if (packageName == null) { Slog.w(TAG, "Intent broadcast does not contain package name: " + intent); return; } final boolean replacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false); switch (action) { case Intent.ACTION_PACKAGE_ADDED: if (replacing) { handlePackageUpdateFinished(packageName, userId); } else { handlePackageAdded(packageName, userId); } break; case Intent.ACTION_PACKAGE_REMOVED: if (!replacing) { handlePackageRemoved(packageName, userId); } break; case Intent.ACTION_PACKAGE_CHANGED: handlePackageChanged(packageName, userId); break; case Intent.ACTION_PACKAGE_DATA_CLEARED: handlePackageDataCleared(packageName, userId); break; } } catch (Exception e) { wtf("Exception in mPackageMonitor.onReceive", e); } finally { injectRestoreCallingIdentity(token); } }