Snap for 8317698 from 798a0fab9c to tm-release

Change-Id: I938625b08928872a2e9e3d63a72ac8ffcc894027
This commit is contained in:
Android Build Coastguard Worker
2022-03-18 01:08:55 +00:00
8 changed files with 85 additions and 38 deletions

View File

@@ -1846,7 +1846,7 @@
android:exported="true" android:exported="true"
android:clearTaskOnLaunch="true" android:clearTaskOnLaunch="true"
android:theme="@style/Theme.Settings.NoActionBar"> android:theme="@style/Theme.Settings.NoActionBar">
<intent-filter> <intent-filter android:priority="1000">
<action android:name="android.app.action.ADD_DEVICE_ADMIN" /> <action android:name="android.app.action.ADD_DEVICE_ADMIN" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>

View File

@@ -5253,6 +5253,14 @@
<string name="accessibility_magnification_switch_shortcut_positive_button">Switch to accessibility button</string> <string name="accessibility_magnification_switch_shortcut_positive_button">Switch to accessibility button</string>
<!-- Title for the cancel button in accessibility switch shortcut dialog to keep the config shortcut value. [CHAR LIMIT=54] --> <!-- Title for the cancel button in accessibility switch shortcut dialog to keep the config shortcut value. [CHAR LIMIT=54] -->
<string name="accessibility_magnification_switch_shortcut_negative_button">Use triple-tap</string> <string name="accessibility_magnification_switch_shortcut_negative_button">Use triple-tap</string>
<!-- Title for the accessibility magnification triple tap warning dialog. [CHAR LIMIT=48] -->
<string name="accessibility_magnification_triple_tap_warning_title">This may slow down your keyboard</string>
<!-- Message for the accessibility magnification triple tap warning dialog. [CHAR LIMIT=none] -->
<string name="accessibility_magnification_triple_tap_warning_message">When using triple-tap to magnify part of your screen, you may notice issues over the keyboard.\n\nTo avoid this, you can change your magnification shortcut from triple-tap to another option.\n<annotation id="link">Change setting</annotation></string>
<!-- Title for the continue button in accessibility triple tap warning dialog to confirm the action. [CHAR LIMIT=30] -->
<string name="accessibility_magnification_triple_tap_warning_positive_button">Continue anyway</string>
<!-- Title for the cancel button in accessibility triple tap warning dialog to go back to edit. [CHAR LIMIT=12] -->
<string name="accessibility_magnification_triple_tap_warning_negative_button">Cancel</string>
<!-- Title for the accessibility preference screen to enable screen magnification settings. [CHAR LIMIT=35] --> <!-- Title for the accessibility preference screen to enable screen magnification settings. [CHAR LIMIT=35] -->
<string name="accessibility_magnification_service_settings_title">Magnification settings</string> <string name="accessibility_magnification_service_settings_title">Magnification settings</string>
<!-- Title for the accessibility preference screen to enable triple-tap gesture screen magnification. [CHAR LIMIT=35] --> <!-- Title for the accessibility preference screen to enable triple-tap gesture screen magnification. [CHAR LIMIT=35] -->

View File

@@ -19,9 +19,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/zen_category_exceptions" > android:title="@string/zen_category_exceptions" >
<PreferenceCategory
android:key="zen_mode_settings_category_sound_vibration">
<!-- Alarms --> <!-- Alarms -->
<SwitchPreference <SwitchPreference
android:key="zen_mode_alarms" android:key="zen_mode_alarms"
@@ -49,6 +46,4 @@
android:key="zen_mode_events" android:key="zen_mode_events"
android:title="@string/zen_mode_events"/> android:title="@string/zen_mode_events"/>
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -20,8 +20,12 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
import android.content.Context; import android.content.Context;
import android.database.ContentObserver;
import android.location.SettingInjectorService; import android.location.SettingInjectorService;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceGroup; import androidx.preference.PreferenceGroup;
@@ -66,6 +70,7 @@ public class LocationSettings extends DashboardFragment implements
private LocationSwitchBarController mSwitchBarController; private LocationSwitchBarController mSwitchBarController;
private LocationEnabler mLocationEnabler; private LocationEnabler mLocationEnabler;
private RecentLocationAccessPreferenceController mController; private RecentLocationAccessPreferenceController mController;
private ContentObserver mContentObserver;
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
@@ -82,6 +87,16 @@ public class LocationSettings extends DashboardFragment implements
mSwitchBarController = new LocationSwitchBarController(activity, switchBar, mSwitchBarController = new LocationSwitchBarController(activity, switchBar,
getSettingsLifecycle()); getSettingsLifecycle());
mLocationEnabler = new LocationEnabler(getContext(), this, getSettingsLifecycle()); mLocationEnabler = new LocationEnabler(getContext(), this, getSettingsLifecycle());
mContentObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
@Override
public void onChange(boolean selfChange) {
mController.updateShowSystem();
}
};
getContentResolver().registerContentObserver(
Settings.Secure.getUriFor(
Settings.Secure.LOCATION_SHOW_SYSTEM_OPS), /* notifyForDescendants= */
false, mContentObserver);
} }
@Override @Override
@@ -97,11 +112,9 @@ public class LocationSettings extends DashboardFragment implements
} }
@Override @Override
public void onPause() { public void onDestroy() {
super.onPause(); super.onDestroy();
if (mController != null) { getContentResolver().unregisterContentObserver(mContentObserver);
mController.clearPreferenceList();
}
} }
@Override @Override

View File

@@ -28,6 +28,7 @@ import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.dashboard.DashboardFragment; import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.profileselector.ProfileSelectFragment; import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
import com.android.settingslib.applications.RecentAppOpsAccess; import com.android.settingslib.applications.RecentAppOpsAccess;
@@ -40,12 +41,15 @@ import java.util.List;
/** /**
* Preference controller that handles the display of apps that access locations. * Preference controller that handles the display of apps that access locations.
*/ */
public class RecentLocationAccessPreferenceController extends LocationBasePreferenceController { public class RecentLocationAccessPreferenceController extends LocationBasePreferenceController
implements BasePreferenceController.UiBlocker {
public static final int MAX_APPS = 3; public static final int MAX_APPS = 3;
@VisibleForTesting @VisibleForTesting
RecentAppOpsAccess mRecentLocationApps; RecentAppOpsAccess mRecentLocationApps;
private PreferenceCategory mCategoryRecentLocationRequests; private PreferenceCategory mCategoryRecentLocationRequests;
private int mType = ProfileSelectFragment.ProfileType.ALL; private int mType = ProfileSelectFragment.ProfileType.ALL;
private boolean mShowSystem = false;
private boolean mSystemSettingChanged = false;
private static class PackageEntryClickedListener implements private static class PackageEntryClickedListener implements
Preference.OnPreferenceClickListener { Preference.OnPreferenceClickListener {
@@ -80,23 +84,32 @@ public class RecentLocationAccessPreferenceController extends LocationBasePrefer
RecentAppOpsAccess recentLocationApps) { RecentAppOpsAccess recentLocationApps) {
super(context, key); super(context, key);
mRecentLocationApps = recentLocationApps; mRecentLocationApps = recentLocationApps;
mShowSystem = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
} }
@Override @Override
public void displayPreference(PreferenceScreen screen) { public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen); super.displayPreference(screen);
mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey()); mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey());
loadRecentAccesses();
} }
@Override @Override
public void updateState(Preference preference) { public void updateState(Preference preference) {
// Only reload the recent accesses in updateState if the system setting has changed.
if (mSystemSettingChanged) {
loadRecentAccesses();
mSystemSettingChanged = false;
}
}
private void loadRecentAccesses() {
mCategoryRecentLocationRequests.removeAll(); mCategoryRecentLocationRequests.removeAll();
final Context prefContext = mCategoryRecentLocationRequests.getContext(); final Context prefContext = mCategoryRecentLocationRequests.getContext();
final List<RecentAppOpsAccess.Access> recentLocationAccesses = new ArrayList<>(); final List<RecentAppOpsAccess.Access> recentLocationAccesses = new ArrayList<>();
final UserManager userManager = UserManager.get(mContext); final UserManager userManager = UserManager.get(mContext);
final boolean showSystem = Settings.Secure.getInt(mContext.getContentResolver(), for (RecentAppOpsAccess.Access access : mRecentLocationApps.getAppListSorted(mShowSystem)) {
Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
for (RecentAppOpsAccess.Access access : mRecentLocationApps.getAppListSorted(showSystem)) {
if (isRequestMatchesProfileType(userManager, access, mType)) { if (isRequestMatchesProfileType(userManager, access, mType)) {
recentLocationAccesses.add(access); recentLocationAccesses.add(access);
if (recentLocationAccesses.size() == MAX_APPS) { if (recentLocationAccesses.size() == MAX_APPS) {
@@ -177,4 +190,14 @@ public class RecentLocationAccessPreferenceController extends LocationBasePrefer
} }
return false; return false;
} }
/**
* Update the state of the showSystem setting flag and load the new results.
*/
void updateShowSystem() {
mSystemSettingChanged = true;
mShowSystem = !mShowSystem;
clearPreferenceList();
loadRecentAccesses();
}
} }

View File

@@ -184,7 +184,10 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
phoneTitle.setVisibility(info.isOpportunistic() ? View.GONE : View.VISIBLE); phoneTitle.setVisibility(info.isOpportunistic() ? View.GONE : View.VISIBLE);
final TextView phoneNumber = view.findViewById(R.id.number_value); final TextView phoneNumber = view.findViewById(R.id.number_value);
phoneNumber.setText(DeviceInfoUtils.getBidiFormattedPhoneNumber(getContext(), info)); final String pn = DeviceInfoUtils.getBidiFormattedPhoneNumber(getContext(), info);
if (!TextUtils.isEmpty(pn)) {
phoneNumber.setText(pn);
}
} }
@Override @Override

View File

@@ -1102,6 +1102,7 @@ public class UserSettings extends SettingsPreferenceFragment
mUserListCategory.setTitle(R.string.user_list_title); mUserListCategory.setTitle(R.string.user_list_title);
} else { } else {
mUserListCategory.setTitle(null); mUserListCategory.setTitle(null);
mUserListCategory.setLayoutResource(R.layout.empty_view);
} }
// Remove everything from mUserListCategory and add new users. // Remove everything from mUserListCategory and add new users.

View File

@@ -20,6 +20,7 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
@@ -41,6 +42,8 @@ public class LocationSettingsTest {
private SettingsActivity mActivity; private SettingsActivity mActivity;
@Mock @Mock
private SettingsMainSwitchBar mSwitchBar; private SettingsMainSwitchBar mSwitchBar;
@Mock
private ContentResolver mContentResolver;
private Context mContext; private Context mContext;
private LocationSettings mLocationSettings; private LocationSettings mLocationSettings;
@@ -52,6 +55,7 @@ public class LocationSettingsTest {
mLocationSettings = spy(new LocationSettings()); mLocationSettings = spy(new LocationSettings());
doReturn(mActivity).when(mLocationSettings).getActivity(); doReturn(mActivity).when(mLocationSettings).getActivity();
doReturn(mContext).when(mLocationSettings).getContext(); doReturn(mContext).when(mLocationSettings).getContext();
doReturn(mContentResolver).when(mActivity).getContentResolver();
when(mActivity.getSwitchBar()).thenReturn(mSwitchBar); when(mActivity.getSwitchBar()).thenReturn(mSwitchBar);
} }