forked from Grouper-AOSP/platform_manifest
-
Notifications
You must be signed in to change notification settings - Fork 13
/
packages_apps_settings.patch
288 lines (259 loc) · 13.8 KB
/
packages_apps_settings.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2ec976dd35..c155cf79c3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -86,6 +86,7 @@
<uses-permission android:name="android.permission.PEERS_MAC_ADDRESS"/>
<uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.DELETE_PACKAGES"/>
+ <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
<application android:label="@string/settings_label"
android:icon="@mipmap/ic_launcher_settings"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c731267b94..9ec0584795 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1348,7 +1348,7 @@
<string name="bluetooth_display_passkey_pin_msg">To pair with:<xliff:g id="bold1"><br><b></xliff:g><xliff:g id="device_name">%1$s</xliff:g><xliff:g id="end_bold1"></b><br><br></xliff:g>Type on it:<xliff:g id="bold2"><br><b></xliff:g><xliff:g id="passkey">%2$s</xliff:g><xliff:g id="end_bold2"></b></xliff:g>, then press Return or Enter.</string>
<!-- Checkbox message in pairing dialogs. [CHAR LIMIT=NONE] -->
- <string name="bluetooth_pairing_shares_phonebook">Allow <xliff:g id="device_name">%1$s</xliff:g> to access your contacts and call history</string>
+ <string name="bluetooth_pairing_shares_phonebook">Allow access to your contacts and call history</string>
<!-- Title for BT error dialogs. -->
<string name="bluetooth_error_title"></string>
diff --git a/src/com/android/settings/ActivityPicker.java b/src/com/android/settings/ActivityPicker.java
index 2c3436fc70..ae61944cbe 100644
--- a/src/com/android/settings/ActivityPicker.java
+++ b/src/com/android/settings/ActivityPicker.java
@@ -78,6 +78,10 @@ public class ActivityPicker extends AlertActivity implements
Parcelable parcel = intent.getParcelableExtra(Intent.EXTRA_INTENT);
if (parcel instanceof Intent) {
mBaseIntent = (Intent) parcel;
+ mBaseIntent.setFlags(mBaseIntent.getFlags() & ~(Intent.FLAG_GRANT_READ_URI_PERMISSION
+ | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
+ | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
+ | Intent.FLAG_GRANT_PREFIX_URI_PERMISSION));
} else {
mBaseIntent = new Intent(Intent.ACTION_MAIN, null);
mBaseIntent.addCategory(Intent.CATEGORY_DEFAULT);
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 1a70f541b4..88c65d7f97 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -140,6 +140,11 @@ public class ChooseLockGeneric extends SettingsActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ final Activity activity = getActivity();
+ if (!Utils.isDeviceProvisioned(activity) && !canRunBeforeDeviceProvisioned()) {
+ activity.finish();
+ return;
+ }
String chooseLockAction = getActivity().getIntent().getAction();
mFingerprintManager =
@@ -217,6 +222,10 @@ public class ChooseLockGeneric extends SettingsActivity {
addHeaderView();
}
+ protected boolean canRunBeforeDeviceProvisioned() {
+ return false;
+ }
+
protected void addHeaderView() {
if (mForFingerprint) {
setHeaderView(R.layout.choose_lock_generic_fingerprint_header);
diff --git a/src/com/android/settings/DeviceAdminAdd.java b/src/com/android/settings/DeviceAdminAdd.java
index 9d4d895330..2f6afd790f 100644
--- a/src/com/android/settings/DeviceAdminAdd.java
+++ b/src/com/android/settings/DeviceAdminAdd.java
@@ -16,6 +16,8 @@
package com.android.settings;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
import android.app.Activity;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
@@ -88,7 +90,6 @@ public class DeviceAdminAdd extends Activity {
Handler mHandler;
DevicePolicyManager mDPM;
- AppOpsManager mAppOps;
DeviceAdminInfo mDeviceAdmin;
CharSequence mAddMsgText;
String mProfileOwnerName;
@@ -113,19 +114,17 @@ public class DeviceAdminAdd extends Activity {
boolean mWaitingForRemoveMsg;
boolean mAddingProfileOwner;
boolean mAdminPoliciesInitialized;
- int mCurSysAppOpMode;
- int mCurToastAppOpMode;
boolean mIsCalledFromSupportDialog = false;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
+ getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
mHandler = new Handler(getMainLooper());
mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
- mAppOps = (AppOpsManager)getSystemService(Context.APP_OPS_SERVICE);
PackageManager packageManager = getPackageManager();
if ((getIntent().getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
@@ -447,24 +446,14 @@ public class DeviceAdminAdd extends Activity {
@Override
protected void onResume() {
super.onResume();
+ mActionButton.setEnabled(true);
updateInterface();
- // As long as we are running, don't let this admin overlay stuff on top of the screen.
- final int uid = mDeviceAdmin.getActivityInfo().applicationInfo.uid;
- final String pkg = mDeviceAdmin.getActivityInfo().applicationInfo.packageName;
- mCurSysAppOpMode = mAppOps.checkOp(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, uid, pkg);
- mCurToastAppOpMode = mAppOps.checkOp(AppOpsManager.OP_TOAST_WINDOW, uid, pkg);
- mAppOps.setMode(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, uid, pkg, AppOpsManager.MODE_IGNORED);
- mAppOps.setMode(AppOpsManager.OP_TOAST_WINDOW, uid, pkg, AppOpsManager.MODE_IGNORED);
}
@Override
protected void onPause() {
super.onPause();
- // As long as we are running, don't let this admin overlay stuff on top of the screen.
- final int uid = mDeviceAdmin.getActivityInfo().applicationInfo.uid;
- final String pkg = mDeviceAdmin.getActivityInfo().applicationInfo.packageName;
- mAppOps.setMode(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, uid, pkg, mCurSysAppOpMode);
- mAppOps.setMode(AppOpsManager.OP_TOAST_WINDOW, uid, pkg, mCurToastAppOpMode);
+ mActionButton.setEnabled(false);
try {
ActivityManagerNative.getDefault().resumeAppSwitches();
} catch (RemoteException e) {
diff --git a/src/com/android/settings/ScreenPinningSettings.java b/src/com/android/settings/ScreenPinningSettings.java
index fb28dfbfc1..9ff4893303 100644
--- a/src/com/android/settings/ScreenPinningSettings.java
+++ b/src/com/android/settings/ScreenPinningSettings.java
@@ -106,9 +106,11 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
}
private boolean isScreenLockUsed() {
- int def = getCurrentSecurityTitle() != R.string.screen_pinning_unlock_none ? 1 : 0;
+ // This functionality should be kept consistent with
+ // com.android.server.am.ActivityStackSupervisor (see b/127605586)
+ int defaultValueIfSettingNull = mLockPatternUtils.isSecure(UserHandle.myUserId()) ? 1 : 0;
return Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.LOCK_TO_APP_EXIT_LOCKED, def) != 0;
+ Settings.Secure.LOCK_TO_APP_EXIT_LOCKED, defaultValueIfSettingNull) != 0;
}
private boolean setScreenLockUsed(boolean isEnabled) {
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index db9c0906ef..76041f2d1b 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -625,8 +625,8 @@ public class SettingsActivity extends SettingsDrawerActivity
} else {
// No UP affordance if we are displaying the main Dashboard
mDisplayHomeAsUpEnabled = false;
- // Show Search affordance
- mDisplaySearch = true;
+ // Show Search affordance (if device is provisioned)
+ mDisplaySearch = Utils.isDeviceProvisioned(this);
mInitialTitleResId = R.string.dashboard_title;
// add argument to indicate which settings tab should be initially selected
diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java
index 71679f30a8..21fad53b8f 100644
--- a/src/com/android/settings/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/SetupChooseLockGeneric.java
@@ -138,6 +138,11 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
}
+ @Override
+ protected boolean canRunBeforeDeviceProvisioned() {
+ return true;
+ }
+
/***
* Disables preferences that are less secure than required quality and shows only secure
* screen lock options here.
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index 196a4ab372..1f69768c0d 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -39,6 +39,8 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -55,6 +57,8 @@ import com.android.settingslib.accessibility.AccessibilityUtils;
import java.util.List;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
public class ToggleAccessibilityServicePreferenceFragment
extends ToggleFeaturePreferenceFragment implements DialogInterface.OnClickListener {
@@ -178,6 +182,10 @@ public class ToggleAccessibilityServicePreferenceFragment
ad.create();
ad.getButton(AlertDialog.BUTTON_POSITIVE).setOnTouchListener(filterTouchListener);
+ Window window = ad.getWindow();
+ WindowManager.LayoutParams params = window.getAttributes();
+ params.privateFlags |= PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+ window.setAttributes(params);
return ad;
}
case DIALOG_ID_DISABLE_WARNING: {
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index fd7a750111..6d5ae0d049 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -16,6 +16,8 @@
package com.android.settings.notification;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Intent;
@@ -28,15 +30,14 @@ import android.os.UserHandle;
import android.service.notification.NotificationListenerService.Ranking;
import android.util.ArrayMap;
import android.util.Log;
-
+import android.view.Window;
+import android.view.WindowManager;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.AppHeader;
import com.android.settings.R;
import com.android.settings.notification.NotificationBackend.AppRow;
import com.android.settingslib.RestrictedSwitchPreference;
-
-
import java.util.List;
/** These settings are per app, so should not be returned in global search results. */
@@ -83,7 +84,8 @@ public class AppNotificationSettings extends NotificationSettingsBase {
NotificationManager.Policy policy =
NotificationManager.from(mContext).getNotificationPolicy();
- mDndVisualEffectsSuppressed = policy == null ? false : policy.suppressedVisualEffects != 0;
+ mDndVisualEffectsSuppressed =
+ policy == null ? false : policy.suppressedVisualEffects != 0;
// load settings intent
ArrayMap<String, AppRow> rows = new ArrayMap<String, AppRow>();
@@ -98,12 +100,27 @@ public class AppNotificationSettings extends NotificationSettingsBase {
}
}
+ @Override
+ public void onResume() {
+ super.onResume();
+ getActivity().getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+ android.util.EventLog.writeEvent(0x534e4554, "119115683", -1, "");
+ }
+
+ public void onPause() {
+ super.onPause();
+ final Window window = getActivity().getWindow();
+ final WindowManager.LayoutParams attrs = window.getAttributes();
+ attrs.privateFlags &= ~PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+ window.setAttributes(attrs);
+ }
+
@Override
protected void updateDependents(int importance) {
LockPatternUtils utils = new LockPatternUtils(getActivity());
boolean lockscreenSecure = utils.isSecure(UserHandle.myUserId());
UserInfo parentUser = mUm.getProfileParent(UserHandle.myUserId());
- if (parentUser != null){
+ if (parentUser != null) {
lockscreenSecure |= utils.isSecure(parentUser.id);
}