List of usage examples for android.content.pm PackageManager DONT_KILL_APP
int DONT_KILL_APP
To view the source code for android.content.pm PackageManager DONT_KILL_APP.
Click Source Link
From source file:com.grazerss.EntryManager.java
public void maintainBootReceiverStateAndScheduler() { final ComponentName cName = new ComponentName(ctx, BootReceiver.class); final PackageManager pm = ctx.getPackageManager(); final int newComponentState = isAutoSyncEnabled() ? PackageManager.COMPONENT_ENABLED_STATE_DEFAULT : PackageManager.COMPONENT_ENABLED_STATE_DISABLED; if (pm.getComponentEnabledSetting(cName) != newComponentState) { Log.d(TAG, "Setting new component enabled state on BootReceiver: " + isAutoSyncEnabled()); pm.setComponentEnabledSetting(cName, newComponentState, PackageManager.DONT_KILL_APP); }//from ww w .ja v a2 s . c o m PL.log("EntryManager.maintainBootReceiverState(): Component enabled=" + pm.getComponentEnabledSetting(cName), ctx); if (isAutoSyncEnabled()) { scheduler.ensureSchedulingIsEnabled(); } }
From source file:com.android.launcher3.Utilities.java
private static void changeDefaultLauncher(Context context) { PackageManager packageManager = context.getPackageManager(); ComponentName componentName = new ComponentName(context, FakeActivity.class); packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); Intent selector = new Intent(Intent.ACTION_MAIN); selector.addCategory(Intent.CATEGORY_HOME); selector.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(selector);// w w w . j a v a2s. c om packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP); }
From source file:com.grazerss.EntryManager.java
@SuppressWarnings("unchecked") public void maintainPremiumDependencies() { this.proVersion = null; if (false) {/* w ww. ja va 2 s . com*/ final int desiredComponentState = isProVersion() ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED; final Class[] componentsToDeactivate = { FireReceiver.class, MockEditSettingsActivity.class }; final PackageManager pm = ctx.getPackageManager(); for (final Class cls : componentsToDeactivate) { final ComponentName cName = new ComponentName(ctx, cls); pm.setComponentEnabledSetting(cName, desiredComponentState, PackageManager.DONT_KILL_APP); } } }
From source file:com.newsrob.EntryManager.java
public void maintainBootReceiverState() { final ComponentName cName = new ComponentName(ctx, BootReceiver.class); final PackageManager pm = ctx.getPackageManager(); final int newComponentState = isAutoSyncEnabled() ? PackageManager.COMPONENT_ENABLED_STATE_DEFAULT : PackageManager.COMPONENT_ENABLED_STATE_DISABLED; if (pm.getComponentEnabledSetting(cName) != newComponentState) { Log.d(TAG, "Setting new component enabled state on BootReceiver: " + isAutoSyncEnabled()); pm.setComponentEnabledSetting(cName, newComponentState, PackageManager.DONT_KILL_APP); }/*from w w w . j a v a2 s.com*/ PL.log("EntryManager.maintainBootReceiverState(): Component enabled=" + pm.getComponentEnabledSetting(cName), ctx); }
From source file:com.juick.android.MainActivity.java
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) { if (s == null) return;/* w w w . j a v a 2 s . c o m*/ if (s.equals("useHttpsForJuickHttpAPI")) { JuickHttpAPI.setHttpsEnabled(sp.getBoolean("useHttpsForJuickHttpAPI", false)); } if (s.equals("useXMPP")) { toggleXMPP(this); } if (s.equals("juick_gcm")) { toggleJuickGCM(this); } if (s.equals("enableJAMessaging")) { toggleJAMessaging(); } if (s.equals("googlePlusNavigation")) { updateActionBarMode(); } if (s.equals("enableBrowserComponent")) { ComponentName cn = new ComponentName("com.juickadvanced", "com.juick.android.SimpleBrowser"); boolean skipDontKillApp = sp.getBoolean("skip_dont_kill_app", false); getPackageManager().setComponentEnabledSetting(cn, sp.getBoolean(s, false) ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, skipDontKillApp ? 0 : PackageManager.DONT_KILL_APP); } boolean censorLevelChanged = false; if (s.equals("censor")) { censorLevelChanged = true; Censor.setCensorshipLevel(Integer.parseInt(sp.getString("censor", "0"))); } boolean dontWatchPreferences = sp.getBoolean("dontWatchPreferences", false); if (dontWatchPreferences) return; if (s.startsWith("msrc")) { final DragSortListView navigationList = (DragSortListView) findViewById(R.id.navigation_list); if (navigationList.isDragEnabled()) return; // editing is being done final int REFRESHNAV = 0xFE0D; if (!handler.hasMessages(REFRESHNAV)) { Message msg = Message.obtain(handler, new Runnable() { @Override public void run() { updateNavigation(); } }); msg.what = REFRESHNAV; handler.sendMessageDelayed(msg, 100); } } boolean invalidateRendering = false; if (censorLevelChanged) { invalidateRendering = true; } if (s.startsWith("Colors.")) { invalidateRendering = true; } String[] refreshCauses = new String[] { "messagesFontScale", "showNumbers", "wrapUserpics", "showUserpics", }; for (String refreshCause : refreshCauses) { if (refreshCause.equals(s)) { if (s.equals("messagesFontScale") && sp.getBoolean("enableScaleByGesture", true)) continue; // should have been pinch zoom invalidateRendering = true; break; } } if (invalidateRendering) { if (mf != null && mf.listAdapter != null) mf.listAdapter.notifyDataSetInvalidated(); } if (s.equals("enableLoginNameWithCrashReport")) { if (sp.getBoolean("enableLoginNameWithCrashReport", false)) { String juickAccountName = JuickAPIAuthorizer.getJuickAccountName(this); if (juickAccountName != null) Crashlytics.setString("juick_user", juickAccountName); } else { Crashlytics.setString("juick_user", ""); } } }
From source file:com.afwsamples.testdpc.policy.PolicyManagementFragment.java
private void startKioskMode(String[] lockTaskArray) { // start locked activity Intent launchIntent = new Intent(getActivity(), KioskModeActivity.class); launchIntent.putExtra(KioskModeActivity.LOCKED_APP_PACKAGE_LIST, lockTaskArray); launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mPackageManager.setComponentEnabledSetting( new ComponentName(mPackageName, KioskModeActivity.class.getName()), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); startActivity(launchIntent);/*from ww w. j a va2 s.c o m*/ getActivity().finish(); }