packages/apps/Settings
修訂 | a20b507e7239531768524f9fb9506650d1d3ff30 (tree) |
---|---|
時間 | 2017-09-29 02:16:57 |
作者 | android-build-team Robot <android-build-team-robot@goog...> |
Commiter | android-build-team Robot |
Merge cherrypicks of [2973982, 2974657, 2974658, 2973983, 2973984, 2974689, 2974690, 2974691, 2974692, 2974710, 2974711, 2974713, 2974714, 2974215, 2974216, 2974217, 2974218, 2974219, 2974220, 2974729, 2974730, 2974731, 2974732, 2974733, 2974734, 2974735, 2974736, 2974737, 2974738, 2974739, 2974740, 2974741, 2974742, 2974749, 2974750, 2974751, 2974752, 2974753, 2974647, 2974744, 2974693, 2974694, 2974648, 2974513, 2974665, 2974746] into nyc-mr2-release
Change-Id: I0d33346d338c50065825f52a47a1c09c4a27a4c6
@@ -16,6 +16,8 @@ | ||
16 | 16 | |
17 | 17 | package com.android.settings; |
18 | 18 | |
19 | +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; | |
20 | + | |
19 | 21 | import android.app.Activity; |
20 | 22 | import android.app.ActivityManagerNative; |
21 | 23 | import android.app.AlertDialog; |
@@ -88,7 +90,6 @@ public class DeviceAdminAdd extends Activity { | ||
88 | 90 | Handler mHandler; |
89 | 91 | |
90 | 92 | DevicePolicyManager mDPM; |
91 | - AppOpsManager mAppOps; | |
92 | 93 | DeviceAdminInfo mDeviceAdmin; |
93 | 94 | CharSequence mAddMsgText; |
94 | 95 | String mProfileOwnerName; |
@@ -113,19 +114,17 @@ public class DeviceAdminAdd extends Activity { | ||
113 | 114 | boolean mWaitingForRemoveMsg; |
114 | 115 | boolean mAddingProfileOwner; |
115 | 116 | boolean mAdminPoliciesInitialized; |
116 | - int mCurSysAppOpMode; | |
117 | - int mCurToastAppOpMode; | |
118 | 117 | |
119 | 118 | boolean mIsCalledFromSupportDialog = false; |
120 | 119 | |
121 | 120 | @Override |
122 | 121 | protected void onCreate(Bundle icicle) { |
123 | 122 | super.onCreate(icicle); |
123 | + getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); | |
124 | 124 | |
125 | 125 | mHandler = new Handler(getMainLooper()); |
126 | 126 | |
127 | 127 | mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE); |
128 | - mAppOps = (AppOpsManager)getSystemService(Context.APP_OPS_SERVICE); | |
129 | 128 | PackageManager packageManager = getPackageManager(); |
130 | 129 | |
131 | 130 | if ((getIntent().getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) { |
@@ -447,24 +446,14 @@ public class DeviceAdminAdd extends Activity { | ||
447 | 446 | @Override |
448 | 447 | protected void onResume() { |
449 | 448 | super.onResume(); |
449 | + mActionButton.setEnabled(true); | |
450 | 450 | updateInterface(); |
451 | - // As long as we are running, don't let this admin overlay stuff on top of the screen. | |
452 | - final int uid = mDeviceAdmin.getActivityInfo().applicationInfo.uid; | |
453 | - final String pkg = mDeviceAdmin.getActivityInfo().applicationInfo.packageName; | |
454 | - mCurSysAppOpMode = mAppOps.checkOp(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, uid, pkg); | |
455 | - mCurToastAppOpMode = mAppOps.checkOp(AppOpsManager.OP_TOAST_WINDOW, uid, pkg); | |
456 | - mAppOps.setMode(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, uid, pkg, AppOpsManager.MODE_IGNORED); | |
457 | - mAppOps.setMode(AppOpsManager.OP_TOAST_WINDOW, uid, pkg, AppOpsManager.MODE_IGNORED); | |
458 | 451 | } |
459 | 452 | |
460 | 453 | @Override |
461 | 454 | protected void onPause() { |
462 | 455 | super.onPause(); |
463 | - // As long as we are running, don't let this admin overlay stuff on top of the screen. | |
464 | - final int uid = mDeviceAdmin.getActivityInfo().applicationInfo.uid; | |
465 | - final String pkg = mDeviceAdmin.getActivityInfo().applicationInfo.packageName; | |
466 | - mAppOps.setMode(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, uid, pkg, mCurSysAppOpMode); | |
467 | - mAppOps.setMode(AppOpsManager.OP_TOAST_WINDOW, uid, pkg, mCurToastAppOpMode); | |
456 | + mActionButton.setEnabled(false); | |
468 | 457 | try { |
469 | 458 | ActivityManagerNative.getDefault().resumeAppSwitches(); |
470 | 459 | } catch (RemoteException e) { |