summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2013-06-10 13:43:10 -0700
committerAmith Yamasani <yamasani@google.com>2013-06-10 13:45:10 -0700
commit3df2172215e2e0c5cd0c01eeb0d57191623b460e (patch)
tree5c49a839502db42873de8af1f092cf215d6114fd /policy
parentf24e16aaf9963436413119c7363bdb9e50c8ba19 (diff)
downloadframeworks_base-3df2172215e2e0c5cd0c01eeb0d57191623b460e.zip
frameworks_base-3df2172215e2e0c5cd0c01eeb0d57191623b460e.tar.gz
frameworks_base-3df2172215e2e0c5cd0c01eeb0d57191623b460e.tar.bz2
Hide "Take bugreport" for secondary users
In QuickSettings and GlobalActions. Bug: 9304471 Change-Id: Ia3118b3258b1f6983c47e96168b7b875b6fc798b
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/GlobalActions.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java
index a2ac8fe..884f57e 100644
--- a/policy/src/com/android/internal/policy/impl/GlobalActions.java
+++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java
@@ -265,7 +265,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
// next: bug report, if enabled
if (Settings.Global.getInt(mContext.getContentResolver(),
- Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0) {
+ Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0 && isCurrentUserOwner()) {
mItems.add(
new SinglePressAction(com.android.internal.R.drawable.stat_sys_adb,
R.string.global_action_bug_report) {
@@ -349,16 +349,24 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
return dialog;
}
+ private UserInfo getCurrentUser() {
+ try {
+ return ActivityManagerNative.getDefault().getCurrentUser();
+ } catch (RemoteException re) {
+ return null;
+ }
+ }
+
+ private boolean isCurrentUserOwner() {
+ UserInfo currentUser = getCurrentUser();
+ return currentUser == null || currentUser.isPrimary();
+ }
+
private void addUsersToMenu(ArrayList<Action> items) {
List<UserInfo> users = ((UserManager) mContext.getSystemService(Context.USER_SERVICE))
.getUsers();
if (users.size() > 1) {
- UserInfo currentUser;
- try {
- currentUser = ActivityManagerNative.getDefault().getCurrentUser();
- } catch (RemoteException re) {
- currentUser = null;
- }
+ UserInfo currentUser = getCurrentUser();
for (final UserInfo user : users) {
boolean isCurrentUser = currentUser == null
? user.id == 0 : (currentUser.id == user.id);