Snap for 7908497 from d8e3836c10 to tm-release
Change-Id: Id111b443e67f2e6521f9adfede2e659f67638aa9
This commit is contained in:
@@ -234,6 +234,11 @@
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden">
|
||||
<!-- Note: Since the framework does not support the multiple requests of network scan
|
||||
from the UI, this singleTask can protect that there is only one
|
||||
Settings$NetworkSelectActivity which can request the network scan.
|
||||
If removing the "singleTask" in the future, please also modify the
|
||||
Settings$NetworkSelectActivity's structure. -->
|
||||
<intent-filter android:priority="1">
|
||||
<!-- Displays the MobileNetworkActivity and opt-in dialog for capability discovery. -->
|
||||
<action android:name="android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN" />
|
||||
@@ -351,6 +356,16 @@
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="Settings$NetworkSelectActivity"
|
||||
android:label="@string/choose_network_title"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|smallestScreenSize">
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.network.telephony.NetworkSelectSettings" />
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="Settings$WifiDetailsSettingsActivity"
|
||||
android:label="@string/wifi_details_title"
|
||||
|
||||
Binary file not shown.
@@ -1,167 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:textDirection="locale"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:gravity="top">
|
||||
|
||||
<LinearLayout
|
||||
android:theme="@style/Theme.AlertDialog"
|
||||
style="@style/AccessibilityDialog">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/app_icon"
|
||||
style="@style/AccessibilityDialogServiceIcon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/AccessibilityDialogTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/prompt"
|
||||
android:text="@string/nls_warning_prompt"
|
||||
style="@style/AccessibilityDialogDescription" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="24dp" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/read_icon"
|
||||
android:src="@drawable/ic_visibility_18dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
style="@style/AccessibilityDialogIcon" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/read_title"
|
||||
android:text="@string/nls_feature_read_title"
|
||||
style="@style/AccessibilityDialogPermissionTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/read_description"
|
||||
android:text="@string/nls_feature_read_summary"
|
||||
style="@style/AccessibilityDialogPermissionDescription" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="24dp" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/reply_icon"
|
||||
android:src="@drawable/ic_promote_conversation"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
style="@style/AccessibilityDialogIcon" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reply_title"
|
||||
android:text="@string/nls_feature_reply_title"
|
||||
style="@style/AccessibilityDialogPermissionTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reply_description"
|
||||
android:text="@string/nls_feature_reply_summary"
|
||||
style="@style/AccessibilityDialogPermissionDescription" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="24dp" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings_icon"
|
||||
android:src="@drawable/ic_do_not_disturb_on_24dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
style="@style/AccessibilityDialogIcon" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_title"
|
||||
android:text="@string/nls_feature_settings_title"
|
||||
style="@style/AccessibilityDialogPermissionTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_description"
|
||||
android:text="@string/nls_feature_settings_summary"
|
||||
style="@style/AccessibilityDialogPermissionDescription" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Buttons on bottom of dialog -->
|
||||
<LinearLayout
|
||||
style="@style/AccessibilityDialogButtonList">
|
||||
|
||||
<Space
|
||||
style="@style/AccessibilityDialogButtonBarSpace"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/allow_button"
|
||||
android:text="@string/accessibility_dialog_button_allow"
|
||||
style="@style/AccessibilityDialogButton" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/deny_button"
|
||||
android:text="@string/accessibility_dialog_button_deny"
|
||||
style="@style/AccessibilityDialogButton" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
@@ -9392,17 +9392,10 @@
|
||||
listener, displayed as a dialog message. [CHAR LIMIT=NONE] -->
|
||||
<string name="notification_listener_security_warning_summary">
|
||||
<xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to read all notifications,
|
||||
including personal information such as contact names, photos, and the text of messages you receive.
|
||||
including personal information such as contact names and the text of messages you receive.
|
||||
This app will also be able to snooze or dismiss notifications or take action on buttons in notifications, including answering phone calls.
|
||||
\n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings.
|
||||
</string>
|
||||
<string name="nls_warning_prompt"><xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to:</string>
|
||||
<string name="nls_feature_read_title">Read your notifications</string>
|
||||
<string name="nls_feature_read_summary">It can read your notifications, including personal information such as contacts, messages, and photos.</string>
|
||||
<string name="nls_feature_reply_title">Reply to messages</string>
|
||||
<string name="nls_feature_reply_summary">It can reply to messages and take action on buttons in notifications, including snoozing or dismissing notifications and answering calls.</string>
|
||||
<string name="nls_feature_settings_title">Change settings</string>
|
||||
<string name="nls_feature_settings_summary">It can turn Do Not Disturb on or off and change related settings.</string>
|
||||
<string name="notification_listener_disable_warning_summary">
|
||||
If you turn off notification access for <xliff:g id="notification_listener_name">%1$s</xliff:g>, Do Not Disturb access may also be turned off.
|
||||
</string>
|
||||
|
||||
@@ -223,7 +223,6 @@
|
||||
<Preference
|
||||
android:key="choose_network_key"
|
||||
android:title="@string/choose_network_title"
|
||||
android:fragment="com.android.phone.NetworkSelectSetting"
|
||||
settings:controller="com.android.settings.network.telephony.gsm.OpenNetworkSelectPagePreferenceController"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ public class Settings extends SettingsActivity {
|
||||
public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class WifiSettings2Activity extends SettingsActivity { /* empty */ }
|
||||
public static class NetworkProviderSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class NetworkSelectActivity extends SettingsActivity { /* empty */ }
|
||||
/** Activity for the Wi-Fi network details settings. */
|
||||
public static class WifiDetailsSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class WifiP2pSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
|
||||
@@ -29,6 +29,7 @@ import androidx.window.embedding.SplitController;
|
||||
import androidx.window.embedding.SplitPairFilter;
|
||||
import androidx.window.embedding.SplitPairRule;
|
||||
import androidx.window.embedding.SplitPlaceholderRule;
|
||||
import androidx.window.embedding.SplitRule;
|
||||
|
||||
import com.android.settings.Settings;
|
||||
import com.android.settings.SubSettings;
|
||||
@@ -81,8 +82,8 @@ public class ActivityEmbeddingRulesController {
|
||||
secondaryIntentAction));
|
||||
|
||||
SplitController.getInstance().registerRule(new SplitPairRule(filters,
|
||||
finishPrimaryWithSecondary,
|
||||
finishSecondaryWithPrimary,
|
||||
finishPrimaryWithSecondary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
|
||||
finishSecondaryWithPrimary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
|
||||
clearTop,
|
||||
ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthPx(context),
|
||||
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthPx(context),
|
||||
@@ -154,6 +155,8 @@ public class ActivityEmbeddingRulesController {
|
||||
final SplitPlaceholderRule placeholderRule = new SplitPlaceholderRule(
|
||||
activityFilters,
|
||||
intent,
|
||||
true /* stickyPlaceholder */,
|
||||
SplitRule.FINISH_ADJACENT,
|
||||
ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthPx(mContext),
|
||||
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthPx(mContext),
|
||||
ActivityEmbeddingUtils.SPLIT_RATIO,
|
||||
|
||||
@@ -18,15 +18,8 @@ package com.android.settings.applications.specialaccess.notificationaccess;
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -62,49 +55,25 @@ public class ScaryWarningDialogFragment extends InstrumentedDialogFragment {
|
||||
.getString(KEY_COMPONENT));
|
||||
NotificationAccessDetails parent = (NotificationAccessDetails) getTargetFragment();
|
||||
|
||||
final String title = getResources().getString(
|
||||
R.string.notification_listener_security_warning_title, label);
|
||||
final String summary = getResources().getString(
|
||||
R.string.notification_listener_security_warning_summary, label);
|
||||
return new AlertDialog.Builder(getContext())
|
||||
.setView(getDialogView(getContext(), label, parent, cn))
|
||||
.setMessage(summary)
|
||||
.setTitle(title)
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(R.string.allow,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
parent.enable(cn);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.deny,
|
||||
(dialog, id) -> {
|
||||
// pass
|
||||
})
|
||||
.create();
|
||||
}
|
||||
|
||||
private View getDialogView(Context context, CharSequence label,
|
||||
NotificationAccessDetails parent, ComponentName cn) {
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(
|
||||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
View content = inflater.inflate(R.layout.enable_nls_dialog_content, null);
|
||||
|
||||
Drawable icon = null;
|
||||
try {
|
||||
icon = context.getPackageManager().getApplicationIcon(cn.getPackageName());
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
}
|
||||
|
||||
ImageView appIcon = content.findViewById(R.id.app_icon);
|
||||
if (icon != null) {
|
||||
appIcon.setImageDrawable(icon);
|
||||
} else {
|
||||
appIcon.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final String title = context.getResources().getString(
|
||||
R.string.notification_listener_security_warning_title, label);
|
||||
((TextView) content.findViewById(R.id.title)).setText(title);
|
||||
|
||||
final String prompt = context.getResources().getString(
|
||||
R.string.nls_warning_prompt, label);
|
||||
((TextView) content.findViewById(R.id.prompt)).setText(prompt);
|
||||
|
||||
Button allowButton = content.findViewById(R.id.allow_button);
|
||||
allowButton.setOnClickListener((view) -> {
|
||||
parent.enable(cn);
|
||||
dismiss();
|
||||
});
|
||||
Button denyButton = content.findViewById(R.id.deny_button);
|
||||
denyButton.setOnClickListener((view) -> {
|
||||
dismiss();
|
||||
});
|
||||
return content;
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,7 @@ import com.android.settings.network.NetworkDashboardFragment;
|
||||
import com.android.settings.network.NetworkProviderSettings;
|
||||
import com.android.settings.network.apn.ApnEditor;
|
||||
import com.android.settings.network.apn.ApnSettings;
|
||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
||||
import com.android.settings.nfc.AndroidBeam;
|
||||
import com.android.settings.nfc.PaymentSettings;
|
||||
import com.android.settings.notification.ConfigureNotificationSettings;
|
||||
@@ -319,6 +320,7 @@ public class SettingsGateway {
|
||||
InteractAcrossProfilesDetails.class.getName(),
|
||||
MediaControlsSettings.class.getName(),
|
||||
NetworkProviderSettings.class.getName(),
|
||||
NetworkSelectSettings.class.getName(),
|
||||
AlarmsAndRemindersDetails.class.getName(),
|
||||
MediaManagementAppsDetails.class.getName(),
|
||||
AutoBrightnessSettings.class.getName()
|
||||
@@ -343,6 +345,7 @@ public class SettingsGateway {
|
||||
Settings.WifiSettingsActivity.class.getName(),
|
||||
Settings.DataUsageSummaryActivity.class.getName(),
|
||||
Settings.NetworkProviderSettingsActivity.class.getName(),
|
||||
Settings.NetworkSelectActivity.class.getName(),
|
||||
// Home page > Connected devices
|
||||
Settings.BluetoothSettingsActivity.class.getName(),
|
||||
Settings.WifiDisplaySettingsActivity.class.getName(),
|
||||
|
||||
@@ -272,8 +272,6 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
if (mWifiManager != null) {
|
||||
setLoading(true, false);
|
||||
mIsViewLoading = true;
|
||||
getView().postDelayed(mRemoveLoadingRunnable,
|
||||
mWifiManager.isWifiEnabled() ? 1000 : 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,6 +429,10 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (mIsViewLoading) {
|
||||
final long delayMillis = mWifiManager.isWifiEnabled() ? 1000 : 100;
|
||||
getView().postDelayed(mRemoveLoadingRunnable, delayMillis);
|
||||
}
|
||||
if (mIsRestricted) {
|
||||
restrictUi();
|
||||
return;
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.settings.network.telephony;
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -101,7 +102,7 @@ public class NetworkSelectSettings extends DashboardFragment {
|
||||
@VisibleForTesting
|
||||
protected void onCreateInitialization() {
|
||||
mUseNewApi = enableNewAutoSelectNetworkUI(getContext());
|
||||
mSubId = getArguments().getInt(Settings.EXTRA_SUB_ID);
|
||||
mSubId = getSubId();
|
||||
|
||||
mPreferenceCategory = getPreferenceCategory(PREF_KEY_NETWORK_OPERATORS);
|
||||
mStatusMessagePreference = new Preference(getContext());
|
||||
@@ -120,7 +121,7 @@ public class NetworkSelectSettings extends DashboardFragment {
|
||||
mMetricsFeatureProvider = getMetricsFeatureProvider(getContext());
|
||||
mIsAggregationEnabled = enableAggregation(getContext());
|
||||
Log.d(TAG, "init: mUseNewApi:" + mUseNewApi
|
||||
+ " ,mIsAggregationEnabled:" + mIsAggregationEnabled);
|
||||
+ " ,mIsAggregationEnabled:" + mIsAggregationEnabled + " ,mSubId:" + mSubId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
@@ -174,6 +175,18 @@ public class NetworkSelectSettings extends DashboardFragment {
|
||||
getPreferenceScreen().setEnabled(enable);
|
||||
}
|
||||
|
||||
@Keep
|
||||
@VisibleForTesting
|
||||
protected int getSubId() {
|
||||
int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||
Intent intent = getActivity().getIntent();
|
||||
if (intent != null) {
|
||||
subId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
|
||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||
}
|
||||
return subId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
@@ -20,9 +20,8 @@ import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.os.Looper;
|
||||
@@ -43,10 +42,8 @@ import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.network.AllowedNetworkTypesListener;
|
||||
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
||||
import com.android.settings.network.telephony.TelephonyTogglePreferenceController;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
@@ -151,25 +148,26 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
if (isChecked) {
|
||||
setAutomaticSelectionMode();
|
||||
return false;
|
||||
} else {
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(NetworkSelectSettings.class.getName())
|
||||
.setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT)
|
||||
.setTitleRes(R.string.choose_network_title)
|
||||
.setArguments(bundle)
|
||||
.launch();
|
||||
return false;
|
||||
if (mSwitchPreference != null) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings",
|
||||
"com.android.settings.Settings$NetworkSelectActivity");
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
|
||||
mSwitchPreference.setIntent(intent);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
Future setAutomaticSelectionMode() {
|
||||
final long startMillis = SystemClock.elapsedRealtime();
|
||||
showAutoSelectProgressBar();
|
||||
mSwitchPreference.setEnabled(false);
|
||||
if (mSwitchPreference != null) {
|
||||
mSwitchPreference.setIntent(null);
|
||||
mSwitchPreference.setEnabled(false);
|
||||
}
|
||||
return ThreadUtils.postOnBackgroundThread(() -> {
|
||||
// set network selection mode in background
|
||||
mTelephonyManager.setNetworkSelectionModeAutomatic();
|
||||
|
||||
@@ -19,14 +19,12 @@ package com.android.settings.network.telephony.gsm;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
@@ -35,10 +33,8 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.network.AllowedNetworkTypesListener;
|
||||
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
||||
import com.android.settings.network.telephony.TelephonyBasePreferenceController;
|
||||
|
||||
/**
|
||||
@@ -102,6 +98,12 @@ public class OpenNetworkSelectPagePreferenceController extends
|
||||
super.updateState(preference);
|
||||
preference.setEnabled(mTelephonyManager.getNetworkSelectionMode()
|
||||
!= TelephonyManager.NETWORK_SELECTION_MODE_AUTO);
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings",
|
||||
"com.android.settings.Settings$NetworkSelectActivity");
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
|
||||
preference.setIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,23 +116,6 @@ public class OpenNetworkSelectPagePreferenceController extends
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(NetworkSelectSettings.class.getName())
|
||||
.setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT)
|
||||
.setTitleRes(R.string.choose_network_title)
|
||||
.setArguments(bundle)
|
||||
.launch();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public OpenNetworkSelectPagePreferenceController init(Lifecycle lifecycle, int subId) {
|
||||
mSubId = subId;
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.content.Context;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
@@ -344,6 +345,7 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
|
||||
|
||||
@VisibleForTesting
|
||||
void switchUser() {
|
||||
Trace.beginSection("UserDetailSettings.switchUser");
|
||||
try {
|
||||
if (mUserInfo.isGuest()) {
|
||||
mMetricsFeatureProvider.action(getActivity(), SettingsEnums.ACTION_SWITCH_TO_GUEST);
|
||||
@@ -352,6 +354,7 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
|
||||
} catch (RemoteException re) {
|
||||
Log.e(TAG, "Error while switching to other user.");
|
||||
} finally {
|
||||
Trace.endSection();
|
||||
finishFragment();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.ContactsContract;
|
||||
@@ -798,6 +799,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
private void addUserNow(final int userType) {
|
||||
Trace.beginAsyncSection("UserSettings.addUserNow", 0);
|
||||
synchronized (mUserLock) {
|
||||
mAddingUser = true;
|
||||
mAddingUserName = userType == USER_TYPE_USER
|
||||
@@ -824,6 +826,11 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
runAddUser();
|
||||
Trace.endAsyncSection("UserSettings.addUserNow", 0);
|
||||
}
|
||||
|
||||
private void runAddUser() {
|
||||
UserInfo user;
|
||||
String username;
|
||||
|
||||
@@ -1198,8 +1205,10 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
} else if (pref == mAddGuest) {
|
||||
mAddGuest.setEnabled(false); // prevent multiple tap issue
|
||||
mMetricsFeatureProvider.action(getActivity(), SettingsEnums.ACTION_USER_GUEST_ADD);
|
||||
Trace.beginSection("UserSettings.addGuest");
|
||||
UserInfo guest = mUserManager.createGuest(
|
||||
getContext(), getString(com.android.settingslib.R.string.user_guest));
|
||||
Trace.endSection();
|
||||
if (guest == null) {
|
||||
Toast.makeText(getContext(),
|
||||
com.android.settingslib.R.string.add_user_failed,
|
||||
|
||||
@@ -122,10 +122,6 @@ public class NetworkSelectSettingsTest {
|
||||
|
||||
public TargetClass(NetworkSelectSettingsTest env) {
|
||||
mTestEnv = env;
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(Settings.EXTRA_SUB_ID, SUB_ID);
|
||||
setArguments(bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -184,6 +180,11 @@ public class NetworkSelectSettingsTest {
|
||||
protected boolean enableAggregation(Context context) {
|
||||
return mTestEnv.mIsAggregationEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSubId() {
|
||||
return SUB_ID;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user