summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-08-12 17:59:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-08-12 17:59:22 +0000
commit0c7629579184f85d36a4854e7c6f5b81f5b7299e (patch)
tree998953eef8577834c88347e31c58d0823df42cb7 /packages/SystemUI
parent7f2f96cce3f1663e3c1dccdde2c0f196b2b16e72 (diff)
parent540542b4173d7ce99addfb910d9e73b028ea0f5e (diff)
downloadframeworks_base-0c7629579184f85d36a4854e7c6f5b81f5b7299e.zip
frameworks_base-0c7629579184f85d36a4854e7c6f5b81f5b7299e.tar.gz
frameworks_base-0c7629579184f85d36a4854e7c6f5b81f5b7299e.tar.bz2
Merge "Fix tuner for secondary users" into mnc-dev
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/TunerService.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerService.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerService.java
index d3f33ab..50234b2 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/TunerService.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerService.java
@@ -16,7 +16,6 @@
package com.android.systemui.tuner;
import android.app.ActivityManager;
-import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -25,10 +24,12 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.ArrayMap;
@@ -169,6 +170,7 @@ public class TunerService extends SystemUI {
public static final void showResetRequest(final Context context, final Runnable onDisabled) {
SystemUIDialog dialog = new SystemUIDialog(context);
+ dialog.setShowForAllUsers(true);
dialog.setMessage(R.string.remove_from_settings_prompt);
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.cancel),
(OnClickListener) null);
@@ -192,7 +194,7 @@ public class TunerService extends SystemUI {
}
public static final void setTunerEnabled(Context context, boolean enabled) {
- context.getPackageManager().setComponentEnabledSetting(
+ userContext(context).getPackageManager().setComponentEnabledSetting(
new ComponentName(context, TunerActivity.class),
enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
@@ -200,11 +202,20 @@ public class TunerService extends SystemUI {
}
public static final boolean isTunerEnabled(Context context) {
- return context.getPackageManager().getComponentEnabledSetting(
+ return userContext(context).getPackageManager().getComponentEnabledSetting(
new ComponentName(context, TunerActivity.class))
== PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
}
+ private static Context userContext(Context context) {
+ try {
+ return context.createPackageContextAsUser(context.getPackageName(), 0,
+ new UserHandle(ActivityManager.getCurrentUser()));
+ } catch (NameNotFoundException e) {
+ return context;
+ }
+ }
+
private class Observer extends ContentObserver {
public Observer() {
super(new Handler(Looper.getMainLooper()));