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
Change-Id: I85842db3faa558ea61bc878ca76ff6d8ce1a4b03
This commit is contained in:
Sunny Shao
2020-07-02 17:20:26 +08:00
parent ba7f6d7d45
commit 7359b3840f
7 changed files with 127 additions and 10 deletions

View File

@@ -33,7 +33,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;
@@ -46,6 +45,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;
@@ -127,7 +127,8 @@ public abstract class ManagedServiceSettings extends EmptyTextSettings {
Log.e(TAG, "can't find package name", e);
}
final String summary = service.loadLabel(mPm).toString();
final SwitchPreference pref = new SwitchPreference(getPrefContext());
final FilterTouchesSwitchPreference pref = new FilterTouchesSwitchPreference(
getPrefContext());
pref.setPersistent(false);
pref.setIcon(mIconDrawableFactory.getBadgedIcon(service, service.applicationInfo,
UserHandle.getUserId(service.applicationInfo.uid)));
@@ -141,7 +142,7 @@ public abstract class ManagedServiceSettings extends EmptyTextSettings {
pref.setChecked(isServiceEnabled(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() {