Snap for 7924855 from fcb067b577 to sc-v2-release
Change-Id: I9599d166bbf7ad8cfa664fffe5c2941668f2ad8f
This commit is contained in:
@@ -191,6 +191,7 @@
|
|||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity android:name=".SubSettings"
|
<activity android:name=".SubSettings"
|
||||||
|
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|smallestScreenSize"
|
||||||
android:theme="@style/Theme.SubSettings" />
|
android:theme="@style/Theme.SubSettings" />
|
||||||
|
|
||||||
<activity android:name=".Settings$CreateShortcutActivity"
|
<activity android:name=".Settings$CreateShortcutActivity"
|
||||||
@@ -314,12 +315,16 @@
|
|||||||
android:icon="@drawable/ic_homepage_network"
|
android:icon="@drawable/ic_homepage_network"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize">
|
android:configChanges="orientation|keyboardHidden|screenSize">
|
||||||
|
<intent-filter android:priority="1">
|
||||||
|
<action android:name="android.settings.WIFI_SETTINGS"/>
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.wifi.WifiSettings" />
|
android:value="com.android.settings.network.NetworkProviderSettings"/>
|
||||||
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
android:value="@string/menu_key_network"/>
|
android:value="@string/menu_key_network"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- Keep compatibility with old shortcuts. -->
|
<!-- Keep compatibility with old shortcuts. -->
|
||||||
@@ -330,9 +335,11 @@
|
|||||||
android:icon="@drawable/ic_homepage_network"
|
android:icon="@drawable/ic_homepage_network"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.wifi.WifiSettings" />
|
android:value="com.android.settings.network.NetworkProviderSettings"/>
|
||||||
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
android:value="@string/menu_key_network"/>
|
android:value="@string/menu_key_network"/>
|
||||||
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
|
android:value="true"/>
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -342,23 +349,19 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize">
|
android:configChanges="orientation|keyboardHidden|screenSize">
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="1">
|
||||||
<action android:name="android.settings.NETWORK_PROVIDER_SETTINGS" />
|
<action android:name="android.settings.NETWORK_PROVIDER_SETTINGS"/>
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="1">
|
||||||
<action android:name="android.settings.WIFI_SETTINGS" />
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="com.android.settings.SHORTCUT"/>
|
||||||
</intent-filter>
|
|
||||||
<intent-filter android:priority="1">
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="com.android.settings.SHORTCUT" />
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.network.NetworkProviderSettings" />
|
android:value="com.android.settings.network.NetworkProviderSettings"/>
|
||||||
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
android:value="@string/menu_key_network"/>
|
android:value="@string/menu_key_network"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -13289,6 +13289,10 @@
|
|||||||
<string name="lockscreen_privacy_controls_setting_toggle">Show device controls</string>
|
<string name="lockscreen_privacy_controls_setting_toggle">Show device controls</string>
|
||||||
<!-- Device controls summary [CHAR LIMIT=NONE] -->
|
<!-- Device controls summary [CHAR LIMIT=NONE] -->
|
||||||
<string name="lockscreen_privacy_controls_summary">Access controls when locked</string>
|
<string name="lockscreen_privacy_controls_summary">Access controls when locked</string>
|
||||||
|
<!-- Lockscreen double-line clock summary [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="lockscreen_double_line_clock_summary">Show double-line clock when available</string>
|
||||||
|
<!-- Lockscreen double-line clock toggle [CHAR LIMIT=60] -->
|
||||||
|
<string name="lockscreen_double_line_clock_setting_toggle">Double-line clock</string>
|
||||||
|
|
||||||
<!-- Title for RTT setting. [CHAR LIMIT=NONE] -->
|
<!-- Title for RTT setting. [CHAR LIMIT=NONE] -->
|
||||||
<string name="rtt_settings_title"></string>
|
<string name="rtt_settings_title"></string>
|
||||||
|
|||||||
@@ -56,6 +56,12 @@
|
|||||||
android:title="@string/lockscreen_privacy_controls_setting_toggle"
|
android:title="@string/lockscreen_privacy_controls_setting_toggle"
|
||||||
android:summary="@string/lockscreen_privacy_controls_summary"
|
android:summary="@string/lockscreen_privacy_controls_summary"
|
||||||
settings:controller="com.android.settings.display.ControlsPrivacyPreferenceController" />
|
settings:controller="com.android.settings.display.ControlsPrivacyPreferenceController" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="lockscreen_double_line_clock_switch"
|
||||||
|
android:title="@string/lockscreen_double_line_clock_setting_toggle"
|
||||||
|
android:summary="@string/lockscreen_double_line_clock_summary"
|
||||||
|
settings:controller="com.android.settings.display.LockscreenClockPreferenceController" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class PrivateVolumeForgetActivity extends SettingsActivity { /* empty */ }
|
public static class PrivateVolumeForgetActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class PublicVolumeSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class PublicVolumeSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class WifiSettings2Activity extends SettingsActivity { /* empty */ }
|
|
||||||
public static class NetworkProviderSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class NetworkProviderSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
/** Activity for the Wi-Fi network details settings. */
|
/** Activity for the Wi-Fi network details settings. */
|
||||||
public static class WifiDetailsSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class WifiDetailsSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ public class AccessibilityScreenSizeForSetupWizardActivity extends InstrumentedA
|
|||||||
int SCREEN_SIZE = 2;
|
int SCREEN_SIZE = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep the last height of the scroll view in the {@link GlifLayout}
|
||||||
|
private int mLastScrollViewHeight;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -143,11 +146,13 @@ public class AccessibilityScreenSizeForSetupWizardActivity extends InstrumentedA
|
|||||||
* Scrolls to bottom while {@link ScrollView} layout changed.
|
* Scrolls to bottom while {@link ScrollView} layout changed.
|
||||||
*/
|
*/
|
||||||
private void scrollToBottom() {
|
private void scrollToBottom() {
|
||||||
|
mLastScrollViewHeight = 0;
|
||||||
final GlifLayout layout = findViewById(R.id.setup_wizard_layout);
|
final GlifLayout layout = findViewById(R.id.setup_wizard_layout);
|
||||||
final ScrollView scrollView = layout.getScrollView();
|
final ScrollView scrollView = layout.getScrollView();
|
||||||
scrollView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
scrollView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
||||||
final int scrollViewHeight = scrollView.getHeight();
|
final int scrollViewHeight = scrollView.getHeight();
|
||||||
if (scrollViewHeight > 0) {
|
if (scrollViewHeight > 0 && scrollViewHeight != mLastScrollViewHeight) {
|
||||||
|
mLastScrollViewHeight = scrollViewHeight;
|
||||||
scrollView.post(() -> {
|
scrollView.post(() -> {
|
||||||
// Here is no need to show the scrolling animation. So disabled first and
|
// Here is no need to show the scrolling animation. So disabled first and
|
||||||
// then enabled it after scrolling finished.
|
// then enabled it after scrolling finished.
|
||||||
|
|||||||
@@ -271,12 +271,14 @@ public class BillingCycleSettings extends DataUsageBaseFragment implements
|
|||||||
mView = dialogInflater.inflate(R.layout.data_usage_bytes_editor, null, false);
|
mView = dialogInflater.inflate(R.layout.data_usage_bytes_editor, null, false);
|
||||||
setupPicker((EditText) mView.findViewById(R.id.bytes),
|
setupPicker((EditText) mView.findViewById(R.id.bytes),
|
||||||
(Spinner) mView.findViewById(R.id.size_spinner));
|
(Spinner) mView.findViewById(R.id.size_spinner));
|
||||||
return new AlertDialog.Builder(context)
|
Dialog dialog = new AlertDialog.Builder(context)
|
||||||
.setTitle(isLimit ? R.string.data_usage_limit_editor_title
|
.setTitle(isLimit ? R.string.data_usage_limit_editor_title
|
||||||
: R.string.data_usage_warning_editor_title)
|
: R.string.data_usage_warning_editor_title)
|
||||||
.setView(mView)
|
.setView(mView)
|
||||||
.setPositiveButton(R.string.data_usage_cycle_editor_positive, this)
|
.setPositiveButton(R.string.data_usage_cycle_editor_positive, this)
|
||||||
.create();
|
.create();
|
||||||
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupPicker(EditText bytesPicker, Spinner type) {
|
private void setupPicker(EditText bytesPicker, Spinner type) {
|
||||||
@@ -402,10 +404,12 @@ public class BillingCycleSettings extends DataUsageBaseFragment implements
|
|||||||
mCycleDayPicker.setValue(cycleDay);
|
mCycleDayPicker.setValue(cycleDay);
|
||||||
mCycleDayPicker.setWrapSelectorWheel(true);
|
mCycleDayPicker.setWrapSelectorWheel(true);
|
||||||
|
|
||||||
return builder.setTitle(R.string.data_usage_cycle_editor_title)
|
Dialog dialog = builder.setTitle(R.string.data_usage_cycle_editor_title)
|
||||||
.setView(view)
|
.setView(view)
|
||||||
.setPositiveButton(R.string.data_usage_cycle_editor_positive, this)
|
.setPositiveButton(R.string.data_usage_cycle_editor_positive, this)
|
||||||
.create();
|
.create();
|
||||||
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -466,12 +470,14 @@ public class BillingCycleSettings extends DataUsageBaseFragment implements
|
|||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
|
||||||
return new AlertDialog.Builder(context)
|
Dialog dialog = new AlertDialog.Builder(context)
|
||||||
.setTitle(R.string.data_usage_limit_dialog_title)
|
.setTitle(R.string.data_usage_limit_dialog_title)
|
||||||
.setMessage(R.string.data_usage_limit_dialog_mobile)
|
.setMessage(R.string.data_usage_limit_dialog_mobile)
|
||||||
.setPositiveButton(android.R.string.ok, this)
|
.setPositiveButton(android.R.string.ok, this)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.create();
|
.create();
|
||||||
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.display;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preference to enable/disable the large double-line clock on lockscreen
|
||||||
|
*/
|
||||||
|
public class LockscreenClockPreferenceController extends TogglePreferenceController {
|
||||||
|
|
||||||
|
private static final String SETTING_KEY = Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK;
|
||||||
|
|
||||||
|
public LockscreenClockPreferenceController(Context context, String preferenceKey) {
|
||||||
|
super(context, preferenceKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChecked() {
|
||||||
|
return Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setChecked(boolean isChecked) {
|
||||||
|
return Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY,
|
||||||
|
isChecked ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getSummary() {
|
||||||
|
return mContext.getText(R.string.lockscreen_double_line_clock_summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAvailabilityStatus() {
|
||||||
|
return AVAILABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateState(Preference preference) {
|
||||||
|
super.updateState(preference);
|
||||||
|
preference.setEnabled(true);
|
||||||
|
refreshSummary(preference);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSliceHighlightMenuRes() {
|
||||||
|
return R.string.menu_key_display;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,6 +50,7 @@ import com.android.settingslib.utils.ThreadUtils;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
@@ -326,12 +327,19 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
CellInfoUtil.getCellIdentityMccMnc(cellInfo.getCellIdentity()));
|
CellInfoUtil.getCellIdentityMccMnc(cellInfo.getCellIdentity()));
|
||||||
Class className = cellInfo.getClass();
|
Class className = cellInfo.getClass();
|
||||||
|
|
||||||
if (aggregatedList.stream().anyMatch(
|
Optional<CellInfo> itemInTheList = aggregatedList.stream().filter(
|
||||||
item -> {
|
item -> {
|
||||||
String itemPlmn = CellInfoUtil.getNetworkTitle(item.getCellIdentity(),
|
String itemPlmn = CellInfoUtil.getNetworkTitle(item.getCellIdentity(),
|
||||||
CellInfoUtil.getCellIdentityMccMnc(item.getCellIdentity()));
|
CellInfoUtil.getCellIdentityMccMnc(item.getCellIdentity()));
|
||||||
return itemPlmn.equals(plmn) && item.getClass().equals(className);
|
return itemPlmn.equals(plmn) && item.getClass().equals(className);
|
||||||
})) {
|
})
|
||||||
|
.findFirst();
|
||||||
|
if (itemInTheList.isPresent()) {
|
||||||
|
if (cellInfo.isRegistered() && !itemInTheList.get().isRegistered()) {
|
||||||
|
// Adding the registered cellinfo item into list. If there are two registered
|
||||||
|
// cellinfo items, then select first one from source list.
|
||||||
|
aggregatedList.set(aggregatedList.indexOf(itemInTheList.get()), cellInfo);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
aggregatedList.add(cellInfo);
|
aggregatedList.add(cellInfo);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public class NrAdvancedCallingPreferenceController extends TelephonyTogglePrefer
|
|||||||
Preference mPreference;
|
Preference mPreference;
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
private PhoneCallStateTelephonyCallback mTelephonyCallback;
|
private PhoneCallStateTelephonyCallback mTelephonyCallback;
|
||||||
|
private boolean mIsVonrEnabledFromCarrierConfig = false;
|
||||||
private boolean mIsVonrVisibleFromCarrierConfig = false;
|
private boolean mIsVonrVisibleFromCarrierConfig = false;
|
||||||
private boolean mIsNrEnableFromCarrierConfig = false;
|
private boolean mIsNrEnableFromCarrierConfig = false;
|
||||||
private boolean mHas5gCapability = false;
|
private boolean mHas5gCapability = false;
|
||||||
@@ -83,6 +84,9 @@ public class NrAdvancedCallingPreferenceController extends TelephonyTogglePrefer
|
|||||||
if (carrierConfig == null) {
|
if (carrierConfig == null) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
mIsVonrEnabledFromCarrierConfig = carrierConfig.getBoolean(
|
||||||
|
CarrierConfigManager.KEY_VONR_ENABLED_BOOL);
|
||||||
|
|
||||||
mIsVonrVisibleFromCarrierConfig = carrierConfig.getBoolean(
|
mIsVonrVisibleFromCarrierConfig = carrierConfig.getBoolean(
|
||||||
CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL);
|
CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL);
|
||||||
|
|
||||||
@@ -92,6 +96,7 @@ public class NrAdvancedCallingPreferenceController extends TelephonyTogglePrefer
|
|||||||
|
|
||||||
Log.d(TAG, "mHas5gCapability: " + mHas5gCapability
|
Log.d(TAG, "mHas5gCapability: " + mHas5gCapability
|
||||||
+ ",mIsNrEnabledFromCarrierConfig: " + mIsNrEnableFromCarrierConfig
|
+ ",mIsNrEnabledFromCarrierConfig: " + mIsNrEnableFromCarrierConfig
|
||||||
|
+ ",mIsVonrEnabledFromCarrierConfig: " + mIsVonrEnabledFromCarrierConfig
|
||||||
+ ",mIsVonrVisibleFromCarrierConfig: " + mIsVonrVisibleFromCarrierConfig);
|
+ ",mIsVonrVisibleFromCarrierConfig: " + mIsVonrVisibleFromCarrierConfig);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -100,7 +105,10 @@ public class NrAdvancedCallingPreferenceController extends TelephonyTogglePrefer
|
|||||||
public int getAvailabilityStatus(int subId) {
|
public int getAvailabilityStatus(int subId) {
|
||||||
init(subId);
|
init(subId);
|
||||||
|
|
||||||
if (mHas5gCapability && mIsNrEnableFromCarrierConfig && mIsVonrVisibleFromCarrierConfig) {
|
if (mHas5gCapability
|
||||||
|
&& mIsNrEnableFromCarrierConfig
|
||||||
|
&& mIsVonrEnabledFromCarrierConfig
|
||||||
|
&& mIsVonrVisibleFromCarrierConfig) {
|
||||||
return AVAILABLE;
|
return AVAILABLE;
|
||||||
}
|
}
|
||||||
return CONDITIONALLY_UNAVAILABLE;
|
return CONDITIONALLY_UNAVAILABLE;
|
||||||
|
|||||||
@@ -79,18 +79,20 @@ public final class PasswordUtils extends com.android.settingslib.Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Crashes the calling application and provides it with {@code message}. */
|
/** Crashes the calling application and provides it with {@code message}. */
|
||||||
public static void crashCallingApplication(IBinder activityToken, String message) {
|
public static void crashCallingApplication(IBinder activityToken, String message,
|
||||||
|
int exceptionTypeId) {
|
||||||
IActivityManager am = ActivityManager.getService();
|
IActivityManager am = ActivityManager.getService();
|
||||||
try {
|
try {
|
||||||
int uid = am.getLaunchedFromUid(activityToken);
|
int uid = am.getLaunchedFromUid(activityToken);
|
||||||
int userId = UserHandle.getUserId(uid);
|
int userId = UserHandle.getUserId(uid);
|
||||||
am.crashApplication(
|
am.crashApplicationWithType(
|
||||||
uid,
|
uid,
|
||||||
/* initialPid= */ -1,
|
/* initialPid= */ -1,
|
||||||
getCallingAppPackageName(activityToken),
|
getCallingAppPackageName(activityToken),
|
||||||
userId,
|
userId,
|
||||||
message,
|
message,
|
||||||
false);
|
false,
|
||||||
|
exceptionTypeId);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.v(TAG, "Could not talk to activity manager.", e);
|
Log.v(TAG, "Could not talk to activity manager.", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_I
|
|||||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;
|
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.RemoteServiceException.MissingRequestPasswordComplexityPermissionException;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.app.admin.DevicePolicyManager.PasswordComplexity;
|
import android.app.admin.DevicePolicyManager.PasswordComplexity;
|
||||||
import android.app.admin.PasswordMetrics;
|
import android.app.admin.PasswordMetrics;
|
||||||
@@ -101,7 +102,8 @@ public class SetNewPasswordActivity extends Activity implements SetNewPasswordCo
|
|||||||
PasswordUtils.crashCallingApplication(activityToken,
|
PasswordUtils.crashCallingApplication(activityToken,
|
||||||
"Must have permission "
|
"Must have permission "
|
||||||
+ REQUEST_PASSWORD_COMPLEXITY + " to use extra "
|
+ REQUEST_PASSWORD_COMPLEXITY + " to use extra "
|
||||||
+ EXTRA_PASSWORD_COMPLEXITY);
|
+ EXTRA_PASSWORD_COMPLEXITY,
|
||||||
|
MissingRequestPasswordComplexityPermissionException.TYPE_ID);
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static android.app.admin.DevicePolicyManager.EXTRA_PASSWORD_COMPLEXITY;
|
|||||||
|
|
||||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;
|
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;
|
||||||
|
|
||||||
|
import android.app.RemoteServiceException.MissingRequestPasswordComplexityPermissionException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -79,7 +80,8 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
|
|||||||
if (!hasPermission) {
|
if (!hasPermission) {
|
||||||
PasswordUtils.crashCallingApplication(activityToken,
|
PasswordUtils.crashCallingApplication(activityToken,
|
||||||
"Must have permission " + REQUEST_PASSWORD_COMPLEXITY
|
"Must have permission " + REQUEST_PASSWORD_COMPLEXITY
|
||||||
+ " to use extra " + EXTRA_PASSWORD_COMPLEXITY);
|
+ " to use extra " + EXTRA_PASSWORD_COMPLEXITY,
|
||||||
|
MissingRequestPasswordComplexityPermissionException.TYPE_ID);
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.display;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class LockscreenClockPreferenceControllerTest {
|
||||||
|
|
||||||
|
private static final String TEST_KEY = "test_key";
|
||||||
|
private static final String SETTING_KEY = Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private ContentResolver mContentResolver;
|
||||||
|
private LockscreenClockPreferenceController mController;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private Preference mPreference;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
MockitoAnnotations.initMocks(this);
|
||||||
|
mContext = RuntimeEnvironment.application;
|
||||||
|
mContentResolver = mContext.getContentResolver();
|
||||||
|
mController = new LockscreenClockPreferenceController(mContext, TEST_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isChecked_SettingIs1_returnTrue() {
|
||||||
|
Settings.Secure.putInt(mContentResolver, SETTING_KEY, 1);
|
||||||
|
|
||||||
|
assertThat(mController.isChecked()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isChecked_SettingIs0_returnFalse() {
|
||||||
|
Settings.Secure.putInt(mContentResolver, SETTING_KEY, 0);
|
||||||
|
|
||||||
|
assertThat(mController.isChecked()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isChecked_SettingIsNotSet_returnTrue() {
|
||||||
|
Settings.Secure.putString(mContentResolver, SETTING_KEY, null);
|
||||||
|
|
||||||
|
assertThat(mController.isChecked()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setChecked_true_SettingIsNot0() {
|
||||||
|
mController.setChecked(true);
|
||||||
|
|
||||||
|
assertThat(Settings.Secure.getInt(mContentResolver, SETTING_KEY, 0)).isNotEqualTo(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setChecked_false_SettingIs0() {
|
||||||
|
mController.setChecked(false);
|
||||||
|
|
||||||
|
assertThat(Settings.Secure.getInt(mContentResolver, SETTING_KEY, 0)).isEqualTo(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -166,6 +166,19 @@ public class NetworkSelectSettingsTest {
|
|||||||
assertThat(mNetworkSelectSettings.doAggregation(testList)).isEqualTo(expected);
|
assertThat(mNetworkSelectSettings.doAggregation(testList)).isEqualTo(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void doAggregation_hasDuplicateItemsDiffMccMncCase3_removeSamePlmnRatItem() {
|
||||||
|
List<CellInfo> testList = Arrays.asList(
|
||||||
|
createLteCellInfo(false, 123, "123", "232", "CarrierA"),
|
||||||
|
createLteCellInfo(false, 124, "123", "233", "CarrierA"),
|
||||||
|
createLteCellInfo(true, 125, "123", "234", "CarrierA"),
|
||||||
|
createGsmCellInfo(false, 126, "456", "232", "CarrierA"));
|
||||||
|
List<CellInfo> expected = Arrays.asList(
|
||||||
|
createLteCellInfo(true, 125, "123", "234", "CarrierA"),
|
||||||
|
createGsmCellInfo(false, 126, "456", "232", "CarrierA"));
|
||||||
|
assertThat(mNetworkSelectSettings.doAggregation(testList)).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
private CellInfoLte createLteCellInfo(boolean registered, int cellId, String mcc, String mnc,
|
private CellInfoLte createLteCellInfo(boolean registered, int cellId, String mcc, String mnc,
|
||||||
String plmnName) {
|
String plmnName) {
|
||||||
CellIdentityLte cil = new CellIdentityLte(
|
CellIdentityLte cil = new CellIdentityLte(
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ public class NrAdvancedCallingPreferenceControllerTest {
|
|||||||
mTelephonyManager).setVoNrEnabled(anyBoolean());
|
mTelephonyManager).setVoNrEnabled(anyBoolean());
|
||||||
mCarrierConfig = new PersistableBundle();
|
mCarrierConfig = new PersistableBundle();
|
||||||
doReturn(mCarrierConfig).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
|
doReturn(mCarrierConfig).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
|
||||||
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL, false);
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_ENABLED_BOOL, false);
|
||||||
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL, true);
|
||||||
mCarrierConfig.putIntArray(CarrierConfigManager.KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY,
|
mCarrierConfig.putIntArray(CarrierConfigManager.KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY,
|
||||||
new int[]{1, 2});
|
new int[]{1, 2});
|
||||||
|
|
||||||
@@ -92,7 +93,8 @@ public class NrAdvancedCallingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailabilityStatus_vonrDisabled_returnUnavailable() {
|
public void getAvailabilityStatus_vonrEnabledAndVisibleDisable_returnUnavailable() {
|
||||||
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_ENABLED_BOOL, true);
|
||||||
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL, false);
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL, false);
|
||||||
|
|
||||||
mController.init(SUB_ID);
|
mController.init(SUB_ID);
|
||||||
@@ -102,7 +104,30 @@ public class NrAdvancedCallingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailabilityStatus_vonrEnabled_returnAvailable() {
|
public void getAvailabilityStatus_vonrDisabledAndVisibleDisable_returnUnavailable() {
|
||||||
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_ENABLED_BOOL, false);
|
||||||
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL, false);
|
||||||
|
|
||||||
|
mController.init(SUB_ID);
|
||||||
|
|
||||||
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||||
|
BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAvailabilityStatus_vonrDisabledAndVisibleEnable_returnUnavailable() {
|
||||||
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_ENABLED_BOOL, false);
|
||||||
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL, true);
|
||||||
|
|
||||||
|
mController.init(SUB_ID);
|
||||||
|
|
||||||
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||||
|
BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAvailabilityStatus_vonrEnabledAndVisibleEnable_returnAvailable() {
|
||||||
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_ENABLED_BOOL, true);
|
||||||
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL, true);
|
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL, true);
|
||||||
|
|
||||||
mController.init(SUB_ID);
|
mController.init(SUB_ID);
|
||||||
|
|||||||
Reference in New Issue
Block a user