packages/apps/Settings
Revision | 9c1e38d8ab09054d8fc166d0bdeb1dd95418ce05 (tree) |
---|---|
Zeit | 2018-01-04 17:40:20 |
Autor | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
Merge tag 'android-7.1.2_r36' into nougat-x86
Android 7.1.2 Release 36 (N2G48H)
@@ -86,6 +86,7 @@ | ||
86 | 86 | <uses-permission android:name="android.permission.PEERS_MAC_ADDRESS"/> |
87 | 87 | <uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS"/> |
88 | 88 | <uses-permission android:name="android.permission.DELETE_PACKAGES"/> |
89 | + <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" /> | |
89 | 90 | |
90 | 91 | <permission |
91 | 92 | android:name="android.permission.REQUEST_SUPERUSER" |
@@ -78,6 +78,10 @@ public class ActivityPicker extends AlertActivity implements | ||
78 | 78 | Parcelable parcel = intent.getParcelableExtra(Intent.EXTRA_INTENT); |
79 | 79 | if (parcel instanceof Intent) { |
80 | 80 | mBaseIntent = (Intent) parcel; |
81 | + mBaseIntent.setFlags(mBaseIntent.getFlags() & ~(Intent.FLAG_GRANT_READ_URI_PERMISSION | |
82 | + | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | |
83 | + | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | |
84 | + | Intent.FLAG_GRANT_PREFIX_URI_PERMISSION)); | |
81 | 85 | } else { |
82 | 86 | mBaseIntent = new Intent(Intent.ACTION_MAIN, null); |
83 | 87 | mBaseIntent.addCategory(Intent.CATEGORY_DEFAULT); |
@@ -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) { |
@@ -39,6 +39,8 @@ import android.view.MenuInflater; | ||
39 | 39 | import android.view.MenuItem; |
40 | 40 | import android.view.MotionEvent; |
41 | 41 | import android.view.View; |
42 | +import android.view.Window; | |
43 | +import android.view.WindowManager; | |
42 | 44 | import android.view.accessibility.AccessibilityManager; |
43 | 45 | import android.widget.ImageView; |
44 | 46 | import android.widget.LinearLayout; |
@@ -55,6 +57,8 @@ import com.android.settingslib.accessibility.AccessibilityUtils; | ||
55 | 57 | |
56 | 58 | import java.util.List; |
57 | 59 | |
60 | +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; | |
61 | + | |
58 | 62 | public class ToggleAccessibilityServicePreferenceFragment |
59 | 63 | extends ToggleFeaturePreferenceFragment implements DialogInterface.OnClickListener { |
60 | 64 |
@@ -178,6 +182,10 @@ public class ToggleAccessibilityServicePreferenceFragment | ||
178 | 182 | |
179 | 183 | ad.create(); |
180 | 184 | ad.getButton(AlertDialog.BUTTON_POSITIVE).setOnTouchListener(filterTouchListener); |
185 | + Window window = ad.getWindow(); | |
186 | + WindowManager.LayoutParams params = window.getAttributes(); | |
187 | + params.privateFlags |= PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; | |
188 | + window.setAttributes(params); | |
181 | 189 | return ad; |
182 | 190 | } |
183 | 191 | case DIALOG_ID_DISABLE_WARNING: { |