Merge \"Enable the demo launcher package as well.\" into nyc-mr1-dev

am: b5b2c196a8

Change-Id: Ie5c2c249a046edbd9c6f2347056f121b96b12284
This commit is contained in:
Sudheer Shanka
2016-07-07 03:27:30 +00:00
committed by android-build-merger

View File

@@ -38,6 +38,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.IntentSender; import android.content.IntentSender;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo; import android.content.pm.UserInfo;
@@ -2919,10 +2920,15 @@ public class UserManagerService extends IUserManager.Stub {
com.android.internal.R.string.config_demoModeLauncherComponent); com.android.internal.R.string.config_demoModeLauncherComponent);
if (!TextUtils.isEmpty(demoLauncher)) { if (!TextUtils.isEmpty(demoLauncher)) {
ComponentName componentToEnable = ComponentName.unflattenFromString(demoLauncher); ComponentName componentToEnable = ComponentName.unflattenFromString(demoLauncher);
String demoLauncherPkg = componentToEnable.getPackageName();
try { try {
AppGlobals.getPackageManager().setComponentEnabledSetting(componentToEnable, final IPackageManager iPm = AppGlobals.getPackageManager();
iPm.setComponentEnabledSetting(componentToEnable,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, /* flags= */ 0, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, /* flags= */ 0,
/* userId= */ userId); /* userId= */ userId);
iPm.setApplicationEnabledSetting(demoLauncherPkg,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, /* flags= */ 0,
/* userId= */ userId, null);
} catch (RemoteException re) { } catch (RemoteException re) {
// Internal, shouldn't happen // Internal, shouldn't happen
} }