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:clearTaskOnLaunch="true"
android:theme="@style/Theme.Settings.NoActionBar">
<intent-filter>
<intent-filter android:priority="1000">
<action android:name="android.app.action.ADD_DEVICE_ADMIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

View File

@@ -5253,6 +5253,14 @@
<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] -->
<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] -->
<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] -->

View File

@@ -19,36 +19,31 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/zen_category_exceptions" >
<PreferenceCategory
android:key="zen_mode_settings_category_sound_vibration">
<!-- Alarms -->
<SwitchPreference
android:key="zen_mode_alarms"
android:title="@string/zen_mode_alarms"/>
<!-- Alarms -->
<SwitchPreference
android:key="zen_mode_alarms"
android:title="@string/zen_mode_alarms"/>
<!-- Media -->
<SwitchPreference
android:key="zen_mode_media"
android:title="@string/zen_mode_media"
android:summary="@string/zen_mode_media_summary"/>
<!-- Media -->
<SwitchPreference
android:key="zen_mode_media"
android:title="@string/zen_mode_media"
android:summary="@string/zen_mode_media_summary"/>
<!-- System -->
<SwitchPreference
android:key="zen_mode_system"
android:title="@string/zen_mode_system"
android:summary="@string/zen_mode_system_summary"/>
<!-- System -->
<SwitchPreference
android:key="zen_mode_system"
android:title="@string/zen_mode_system"
android:summary="@string/zen_mode_system_summary"/>
<!-- Reminders -->
<SwitchPreference
android:key="zen_mode_reminders"
android:title="@string/zen_mode_reminders"/>
<!-- Reminders -->
<SwitchPreference
android:key="zen_mode_reminders"
android:title="@string/zen_mode_reminders"/>
<!-- Events -->
<SwitchPreference
android:key="zen_mode_events"
android:title="@string/zen_mode_events"/>
</PreferenceCategory>
<!-- Events -->
<SwitchPreference
android:key="zen_mode_events"
android:title="@string/zen_mode_events"/>
</PreferenceScreen>

View File

@@ -20,8 +20,12 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.database.ContentObserver;
import android.location.SettingInjectorService;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;
@@ -66,6 +70,7 @@ public class LocationSettings extends DashboardFragment implements
private LocationSwitchBarController mSwitchBarController;
private LocationEnabler mLocationEnabler;
private RecentLocationAccessPreferenceController mController;
private ContentObserver mContentObserver;
@Override
public int getMetricsCategory() {
@@ -82,6 +87,16 @@ public class LocationSettings extends DashboardFragment implements
mSwitchBarController = new LocationSwitchBarController(activity, switchBar,
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
@@ -97,11 +112,9 @@ public class LocationSettings extends DashboardFragment implements
}
@Override
public void onPause() {
super.onPause();
if (mController != null) {
mController.clearPreferenceList();
}
public void onDestroy() {
super.onDestroy();
getContentResolver().unregisterContentObserver(mContentObserver);
}
@Override

View File

@@ -28,6 +28,7 @@ import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
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.
*/
public class RecentLocationAccessPreferenceController extends LocationBasePreferenceController {
public class RecentLocationAccessPreferenceController extends LocationBasePreferenceController
implements BasePreferenceController.UiBlocker {
public static final int MAX_APPS = 3;
@VisibleForTesting
RecentAppOpsAccess mRecentLocationApps;
private PreferenceCategory mCategoryRecentLocationRequests;
private int mType = ProfileSelectFragment.ProfileType.ALL;
private boolean mShowSystem = false;
private boolean mSystemSettingChanged = false;
private static class PackageEntryClickedListener implements
Preference.OnPreferenceClickListener {
@@ -80,23 +84,32 @@ public class RecentLocationAccessPreferenceController extends LocationBasePrefer
RecentAppOpsAccess recentLocationApps) {
super(context, key);
mRecentLocationApps = recentLocationApps;
mShowSystem = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey());
loadRecentAccesses();
}
@Override
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();
final Context prefContext = mCategoryRecentLocationRequests.getContext();
final List<RecentAppOpsAccess.Access> recentLocationAccesses = new ArrayList<>();
final UserManager userManager = UserManager.get(mContext);
final boolean showSystem = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
for (RecentAppOpsAccess.Access access : mRecentLocationApps.getAppListSorted(showSystem)) {
for (RecentAppOpsAccess.Access access : mRecentLocationApps.getAppListSorted(mShowSystem)) {
if (isRequestMatchesProfileType(userManager, access, mType)) {
recentLocationAccesses.add(access);
if (recentLocationAccesses.size() == MAX_APPS) {
@@ -177,4 +190,14 @@ public class RecentLocationAccessPreferenceController extends LocationBasePrefer
}
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);
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

View File

@@ -1102,6 +1102,7 @@ public class UserSettings extends SettingsPreferenceFragment
mUserListCategory.setTitle(R.string.user_list_title);
} else {
mUserListCategory.setTitle(null);
mUserListCategory.setLayoutResource(R.layout.empty_view);
}
// 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.when;
import android.content.ContentResolver;
import android.content.Context;
import android.os.Bundle;
@@ -41,6 +42,8 @@ public class LocationSettingsTest {
private SettingsActivity mActivity;
@Mock
private SettingsMainSwitchBar mSwitchBar;
@Mock
private ContentResolver mContentResolver;
private Context mContext;
private LocationSettings mLocationSettings;
@@ -52,6 +55,7 @@ public class LocationSettingsTest {
mLocationSettings = spy(new LocationSettings());
doReturn(mActivity).when(mLocationSettings).getActivity();
doReturn(mContext).when(mLocationSettings).getContext();
doReturn(mContentResolver).when(mActivity).getContentResolver();
when(mActivity.getSwitchBar()).thenReturn(mSwitchBar);
}