Enable the filterTouchesWhenObscured in Special app access
- Enable the filterTouchesWhenObscured attribute on all toggle switches in all pages of the special app access Bug: 155288585 Test: make RunSettingsRoboTests Merged-In: I011cfe4b7e4e624a8338332ac47a353f7f3ab661 Merged-In: I85842db3faa558ea61bc878ca76ff6d8ce1a4b03 Change-Id: Id873bab7312226a9ea642a6241249c6754059a0b
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
||||
|
||||
<SwitchPreference
|
||||
<com.android.settings.widget.FilterTouchesSwitchPreference
|
||||
android:key="app_ops_settings_switch" />
|
||||
|
||||
<Preference
|
||||
|
@@ -18,7 +18,7 @@
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||
android:title="@string/install_other_apps">
|
||||
|
||||
<com.android.settingslib.RestrictedSwitchPreference
|
||||
<com.android.settings.widget.FilterTouchesRestrictedSwitchPreference
|
||||
android:key="external_sources_settings_switch"
|
||||
android:title="@string/external_source_switch_title" />
|
||||
|
||||
|
@@ -18,7 +18,6 @@ import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.view.Menu;
|
||||
@@ -34,6 +33,7 @@ import com.android.settings.applications.AppStateBaseBridge;
|
||||
import com.android.settings.applications.InstalledAppDetails;
|
||||
import com.android.settings.datausage.AppStateDataUsageBridge.DataUsageState;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.widget.FilterTouchesSwitchPreference;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
import com.android.settingslib.applications.ApplicationsState.AppEntry;
|
||||
import com.android.settingslib.applications.ApplicationsState.AppFilter;
|
||||
@@ -238,7 +238,8 @@ public class UnrestrictedDataAccess extends SettingsPreferenceFragment
|
||||
return app != null && UserHandle.isApp(app.info.uid);
|
||||
}
|
||||
|
||||
private class AccessPreference extends SwitchPreference implements DataSaverBackend.Listener {
|
||||
private class AccessPreference extends FilterTouchesSwitchPreference implements
|
||||
DataSaverBackend.Listener {
|
||||
private final AppEntry mEntry;
|
||||
private final DataUsageState mState;
|
||||
|
||||
|
@@ -35,7 +35,6 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
@@ -49,6 +48,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.widget.FilterTouchesSwitchPreference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -123,7 +123,8 @@ public class ZenAccessSettings extends EmptyTextSettings {
|
||||
for (ApplicationInfo app : apps) {
|
||||
final String pkg = app.packageName;
|
||||
final CharSequence label = app.loadLabel(mPkgMan);
|
||||
final SwitchPreference pref = new SwitchPreference(getPrefContext());
|
||||
final FilterTouchesSwitchPreference pref = new FilterTouchesSwitchPreference(
|
||||
getPrefContext());
|
||||
pref.setPersistent(false);
|
||||
pref.setIcon(app.loadIcon(mPkgMan));
|
||||
pref.setTitle(label);
|
||||
|
@@ -30,7 +30,6 @@ import android.content.pm.ServiceInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
@@ -41,6 +40,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settings.notification.EmptyTextSettings;
|
||||
import com.android.settings.widget.FilterTouchesSwitchPreference;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -105,14 +105,15 @@ public abstract class ManagedServiceSettings extends EmptyTextSettings {
|
||||
for (ServiceInfo service : services) {
|
||||
final ComponentName cn = new ComponentName(service.packageName, service.name);
|
||||
final String title = service.loadLabel(mPM).toString();
|
||||
final SwitchPreference pref = new SwitchPreference(getPrefContext());
|
||||
final FilterTouchesSwitchPreference pref = new FilterTouchesSwitchPreference(
|
||||
getPrefContext());
|
||||
pref.setPersistent(false);
|
||||
pref.setIcon(service.loadIcon(mPM));
|
||||
pref.setTitle(title);
|
||||
pref.setChecked(mServiceListing.isEnabled(cn));
|
||||
if (managedProfileId != UserHandle.USER_NULL
|
||||
&& !mDpm.isNotificationListenerServicePermitted(
|
||||
service.packageName, managedProfileId)) {
|
||||
service.packageName, managedProfileId)) {
|
||||
pref.setSummary(R.string.work_profile_notification_access_blocked_summary);
|
||||
}
|
||||
pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
|
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.settings.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.settingslib.RestrictedSwitchPreference;
|
||||
|
||||
/**
|
||||
* This widget with enabled filterTouchesWhenObscured attribute use to replace
|
||||
* the {@link RestrictedSwitchPreference} in the Special access app pages for
|
||||
* security.
|
||||
*/
|
||||
public class FilterTouchesRestrictedSwitchPreference extends RestrictedSwitchPreference {
|
||||
public FilterTouchesRestrictedSwitchPreference(Context context, AttributeSet attrs,
|
||||
int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
public FilterTouchesRestrictedSwitchPreference(Context context, AttributeSet attrs,
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public FilterTouchesRestrictedSwitchPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public FilterTouchesRestrictedSwitchPreference(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
final View switchView = holder.findViewById(android.R.id.switch_widget);
|
||||
if (switchView != null) {
|
||||
final View rootView = switchView.getRootView();
|
||||
rootView.setFilterTouchesWhenObscured(true);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.settings.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* This widget with enabled filterTouchesWhenObscured attribute use to replace
|
||||
* the {@link SwitchPreference} in the Special access app pages for security.
|
||||
*/
|
||||
public class FilterTouchesSwitchPreference extends SwitchPreference {
|
||||
|
||||
public FilterTouchesSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
public FilterTouchesSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public FilterTouchesSwitchPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public FilterTouchesSwitchPreference(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
final View switchView = holder.findViewById(android.R.id.switch_widget);
|
||||
if (switchView != null) {
|
||||
final View rootView = switchView.getRootView();
|
||||
rootView.setFilterTouchesWhenObscured(true);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user