packages/apps/Settings
Revision | 601f20325b08b93a42db6a1405fc4077a88d4dc8 (tree) |
---|---|
Zeit | 2021-07-06 17:17:51 |
Autor | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
Merge tag 'android-9.0.0_r61' into pie-x86
Android 9.0.0 Release 61 (6780336)
@@ -17,7 +17,7 @@ | ||
17 | 17 | <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" |
18 | 18 | xmlns:settings="http://schemas.android.com/apk/res-auto"> |
19 | 19 | |
20 | - <SwitchPreference | |
20 | + <com.android.settings.widget.FilterTouchesSwitchPreference | |
21 | 21 | android:key="app_ops_settings_switch" /> |
22 | 22 | |
23 | 23 | <Preference |
@@ -18,7 +18,7 @@ | ||
18 | 18 | android:key="change_wifi_state" |
19 | 19 | android:title="@string/change_wifi_state_title"> |
20 | 20 | |
21 | - <SwitchPreference | |
21 | + <com.android.settings.widget.FilterTouchesSwitchPreference | |
22 | 22 | android:key="app_ops_settings_switch" |
23 | 23 | android:title="@string/change_wifi_state_app_detail_switch"/> |
24 | 24 |
@@ -18,7 +18,7 @@ | ||
18 | 18 | android:key="draw_overlay_permission_detail_settings" |
19 | 19 | android:title="@string/draw_overlay"> |
20 | 20 | |
21 | - <SwitchPreference | |
21 | + <com.android.settings.widget.FilterTouchesSwitchPreference | |
22 | 22 | android:key="app_ops_settings_switch" |
23 | 23 | android:title="@string/permit_draw_overlay"/> |
24 | 24 |
@@ -17,7 +17,7 @@ | ||
17 | 17 | <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" |
18 | 18 | android:title="@string/install_other_apps"> |
19 | 19 | |
20 | - <com.android.settingslib.RestrictedSwitchPreference | |
20 | + <com.android.settings.widget.FilterTouchesRestrictedSwitchPreference | |
21 | 21 | android:key="external_sources_settings_switch" |
22 | 22 | android:title="@string/external_source_switch_title" /> |
23 | 23 |
@@ -18,7 +18,7 @@ | ||
18 | 18 | android:key="picture_in_picture_permission_detail_settings" |
19 | 19 | android:title="@string/picture_in_picture_app_detail_title"> |
20 | 20 | |
21 | - <SwitchPreference | |
21 | + <com.android.settings.widget.FilterTouchesSwitchPreference | |
22 | 22 | android:key="app_ops_settings_switch" |
23 | 23 | android:title="@string/picture_in_picture_app_detail_switch"/> |
24 | 24 |
@@ -18,7 +18,7 @@ | ||
18 | 18 | android:key="write_system_settings_permission_detail_settings" |
19 | 19 | android:title="@string/write_settings"> |
20 | 20 | |
21 | - <SwitchPreference | |
21 | + <com.android.settings.widget.FilterTouchesSwitchPreference | |
22 | 22 | android:key="app_ops_settings_switch" |
23 | 23 | android:title="@string/permit_write_settings"/> |
24 | 24 |
@@ -196,14 +196,7 @@ public class AccountTypePreferenceLoader { | ||
196 | 196 | ActivityInfo resolvedActivityInfo = resolveInfo.activityInfo; |
197 | 197 | ApplicationInfo resolvedAppInfo = resolvedActivityInfo.applicationInfo; |
198 | 198 | try { |
199 | - if (resolvedActivityInfo.exported) { | |
200 | - if (resolvedActivityInfo.permission == null) { | |
201 | - return true; // exported activity without permission. | |
202 | - } else if (pm.checkPermission(resolvedActivityInfo.permission, | |
203 | - authDesc.packageName) == PackageManager.PERMISSION_GRANTED) { | |
204 | - return true; | |
205 | - } | |
206 | - } | |
199 | + // Allows to launch only authenticator owned activities. | |
207 | 200 | ApplicationInfo authenticatorAppInf = pm.getApplicationInfo(authDesc.packageName, 0); |
208 | 201 | return resolvedAppInfo.uid == authenticatorAppInf.uid; |
209 | 202 | } catch (NameNotFoundException e) { |
@@ -26,6 +26,8 @@ import android.content.IntentFilter; | ||
26 | 26 | import android.os.Bundle; |
27 | 27 | import android.support.annotation.VisibleForTesting; |
28 | 28 | |
29 | +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; | |
30 | + | |
29 | 31 | /** |
30 | 32 | * BluetoothPairingDialog asks the user to enter a PIN / Passkey / simple confirmation |
31 | 33 | * for pairing with a remote Bluetooth device. It is an activity that appears as a dialog. |
@@ -63,6 +65,8 @@ public class BluetoothPairingDialog extends Activity { | ||
63 | 65 | @Override |
64 | 66 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
65 | 67 | super.onCreate(savedInstanceState); |
68 | + | |
69 | + getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); | |
66 | 70 | Intent intent = getIntent(); |
67 | 71 | mBluetoothPairingController = new BluetoothPairingController(intent, this); |
68 | 72 | // build the dialog fragment |
@@ -37,6 +37,8 @@ import com.android.settingslib.bluetooth.BluetoothDiscoverableTimeoutReceiver; | ||
37 | 37 | import com.android.settingslib.bluetooth.LocalBluetoothAdapter; |
38 | 38 | import com.android.settingslib.bluetooth.LocalBluetoothManager; |
39 | 39 | |
40 | +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; | |
41 | + | |
40 | 42 | /** |
41 | 43 | * RequestPermissionActivity asks the user whether to enable discovery. This is |
42 | 44 | * usually started by an application wanted to start bluetooth and or discovery |
@@ -72,6 +74,8 @@ public class RequestPermissionActivity extends Activity implements | ||
72 | 74 | protected void onCreate(Bundle savedInstanceState) { |
73 | 75 | super.onCreate(savedInstanceState); |
74 | 76 | |
77 | + getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); | |
78 | + | |
75 | 79 | setResult(Activity.RESULT_CANCELED); |
76 | 80 | |
77 | 81 | // Note: initializes mLocalAdapter and returns true on error |
@@ -37,5 +37,11 @@ public class AppSwitchPreference extends SwitchPreference { | ||
37 | 37 | |
38 | 38 | view.findViewById(R.id.summary_container) |
39 | 39 | .setVisibility(TextUtils.isEmpty(getSummary()) ? View.GONE : View.VISIBLE); |
40 | + | |
41 | + final View switchView = view.findViewById(android.R.id.switch_widget); | |
42 | + if (switchView != null) { | |
43 | + final View rootView = switchView.getRootView(); | |
44 | + rootView.setFilterTouchesWhenObscured(true); | |
45 | + } | |
40 | 46 | } |
41 | 47 | } |
@@ -0,0 +1,58 @@ | ||
1 | +/* | |
2 | + * Copyright (C) 2020 The Android Open Source Project | |
3 | + * | |
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + * you may not use this file except in compliance with the License. | |
6 | + * You may obtain a copy of the License at | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | + * Unless required by applicable law or agreed to in writing, software | |
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + * See the License for the specific language governing permissions and | |
14 | + * limitations under the License. | |
15 | + */ | |
16 | +package com.android.settings.widget; | |
17 | + | |
18 | +import android.content.Context; | |
19 | +import android.support.v7.preference.PreferenceViewHolder; | |
20 | +import android.util.AttributeSet; | |
21 | +import android.view.View; | |
22 | + | |
23 | +import com.android.settingslib.RestrictedSwitchPreference; | |
24 | + | |
25 | +/** | |
26 | + * This widget with enabled filterTouchesWhenObscured attribute use to replace | |
27 | + * the {@link RestrictedSwitchPreference} in the Special access app pages for | |
28 | + * security. | |
29 | + */ | |
30 | +public class FilterTouchesRestrictedSwitchPreference extends RestrictedSwitchPreference { | |
31 | + public FilterTouchesRestrictedSwitchPreference(Context context, AttributeSet attrs, | |
32 | + int defStyleAttr, int defStyleRes) { | |
33 | + super(context, attrs, defStyleAttr, defStyleRes); | |
34 | + } | |
35 | + | |
36 | + public FilterTouchesRestrictedSwitchPreference(Context context, AttributeSet attrs, | |
37 | + int defStyleAttr) { | |
38 | + super(context, attrs, defStyleAttr); | |
39 | + } | |
40 | + | |
41 | + public FilterTouchesRestrictedSwitchPreference(Context context, AttributeSet attrs) { | |
42 | + super(context, attrs); | |
43 | + } | |
44 | + | |
45 | + public FilterTouchesRestrictedSwitchPreference(Context context) { | |
46 | + super(context); | |
47 | + } | |
48 | + | |
49 | + @Override | |
50 | + public void onBindViewHolder(PreferenceViewHolder holder) { | |
51 | + super.onBindViewHolder(holder); | |
52 | + final View switchView = holder.findViewById(android.R.id.switch_widget); | |
53 | + if (switchView != null) { | |
54 | + final View rootView = switchView.getRootView(); | |
55 | + rootView.setFilterTouchesWhenObscured(true); | |
56 | + } | |
57 | + } | |
58 | +} |
@@ -0,0 +1,56 @@ | ||
1 | +/* | |
2 | + * Copyright (C) 2020 The Android Open Source Project | |
3 | + * | |
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + * you may not use this file except in compliance with the License. | |
6 | + * You may obtain a copy of the License at | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | + * Unless required by applicable law or agreed to in writing, software | |
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + * See the License for the specific language governing permissions and | |
14 | + * limitations under the License. | |
15 | + */ | |
16 | +package com.android.settings.widget; | |
17 | + | |
18 | +import android.content.Context; | |
19 | +import android.support.v14.preference.SwitchPreference; | |
20 | +import android.support.v7.preference.PreferenceViewHolder; | |
21 | +import android.util.AttributeSet; | |
22 | +import android.view.View; | |
23 | + | |
24 | +/** | |
25 | + * This widget with enabled filterTouchesWhenObscured attribute use to replace | |
26 | + * the {@link SwitchPreference} in the Special access app pages for security. | |
27 | + */ | |
28 | +public class FilterTouchesSwitchPreference extends SwitchPreference { | |
29 | + | |
30 | + public FilterTouchesSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, | |
31 | + int defStyleRes) { | |
32 | + super(context, attrs, defStyleAttr, defStyleRes); | |
33 | + } | |
34 | + | |
35 | + public FilterTouchesSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) { | |
36 | + super(context, attrs, defStyleAttr); | |
37 | + } | |
38 | + | |
39 | + public FilterTouchesSwitchPreference(Context context, AttributeSet attrs) { | |
40 | + super(context, attrs); | |
41 | + } | |
42 | + | |
43 | + public FilterTouchesSwitchPreference(Context context) { | |
44 | + super(context); | |
45 | + } | |
46 | + | |
47 | + @Override | |
48 | + public void onBindViewHolder(PreferenceViewHolder holder) { | |
49 | + super.onBindViewHolder(holder); | |
50 | + final View switchView = holder.findViewById(android.R.id.switch_widget); | |
51 | + if (switchView != null) { | |
52 | + final View rootView = switchView.getRootView(); | |
53 | + rootView.setFilterTouchesWhenObscured(true); | |
54 | + } | |
55 | + } | |
56 | +} |