Snap for 7912506 from 4b59b75c59 to tm-release
Change-Id: I5358dea95a7f4eda4323c7fc8ae432c85ef9fcc4
This commit is contained in:
@@ -3375,6 +3375,7 @@
|
||||
<activity
|
||||
android:name="Settings$WifiCallingSettingsActivity"
|
||||
android:exported="true"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|smallestScreenSize|screenLayout"
|
||||
android:label="@string/wifi_calling_settings_title">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
167
res/layout/enable_nls_dialog_content.xml
Normal file
167
res/layout/enable_nls_dialog_content.xml
Normal file
@@ -0,0 +1,167 @@
|
||||
<?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>
|
||||
@@ -119,7 +119,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:minWidth="0dp"
|
||||
android:text="@string/see_more"/>
|
||||
android:text="@string/settings_button"/>
|
||||
|
||||
<Space
|
||||
android:layout_weight="1"
|
||||
|
||||
@@ -9392,10 +9392,17 @@
|
||||
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 and the text of messages you receive.
|
||||
including personal information such as contact names, photos, 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>
|
||||
@@ -12916,7 +12923,7 @@
|
||||
<string name="manual_mode_disallowed_summary">Unavailable when connected to <xliff:g id="carrier" example="verizon">%1$s</xliff:g></string>
|
||||
|
||||
<!-- See more items in contextual homepage [CHAR LIMIT=30]-->
|
||||
<string name="see_more">Settings</string>
|
||||
<string name="see_more">See more</string>
|
||||
<!-- See less items in contextual homepage [CHAR LIMIT=30]-->
|
||||
<string name="see_less">See less</string>
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
android:layout="@layout/preference_category_no_label"/>
|
||||
|
||||
<Preference
|
||||
android:key="configure_wifi_settings"
|
||||
android:key="configure_network_settings"
|
||||
android:title="@string/network_and_internet_preferences_title"
|
||||
settings:allowDividerAbove="true"
|
||||
android:fragment="com.android.settings.wifi.ConfigureWifiSettings"/>
|
||||
|
||||
@@ -26,6 +26,7 @@ import static com.android.settings.Utils.PROPERTY_APP_HIBERNATION_ENABLED;
|
||||
import static com.android.settings.Utils.PROPERTY_HIBERNATION_TARGETS_PRE_S_APPS;
|
||||
|
||||
import android.app.AppOpsManager;
|
||||
import android.apphibernation.AppHibernationManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.DeviceConfig;
|
||||
@@ -134,8 +135,15 @@ public final class HibernationSwitchPreferenceController extends AppInfoPreferen
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object isChecked) {
|
||||
try {
|
||||
final boolean checked = (boolean) isChecked;
|
||||
mAppOpsManager.setUidMode(OPSTR_AUTO_REVOKE_PERMISSIONS_IF_UNUSED, mPackageUid,
|
||||
(boolean) isChecked ? MODE_ALLOWED : MODE_IGNORED);
|
||||
checked ? MODE_ALLOWED : MODE_IGNORED);
|
||||
if (!checked) {
|
||||
final AppHibernationManager ahm =
|
||||
mContext.getSystemService(AppHibernationManager.class);
|
||||
ahm.setHibernatingForUser(mPackageName, false);
|
||||
ahm.setHibernatingGlobally(mPackageName, false);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,15 @@ package com.android.settings.applications.specialaccess.notificationaccess;
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
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;
|
||||
@@ -55,25 +62,49 @@ 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())
|
||||
.setMessage(summary)
|
||||
.setTitle(title)
|
||||
.setView(getDialogView(getContext(), label, parent, cn))
|
||||
.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;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.network.helper.SubscriptionAnnotation;
|
||||
@@ -202,12 +201,9 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
||||
|| mStatusCache.isPhysicalSimDisableSupport()) {
|
||||
final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, info.getSubscriptionId());
|
||||
// MobilenetworkActivity is singleTask, set SplitPairRule to show in 2-pane.
|
||||
ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome(
|
||||
mContext,
|
||||
intent.getComponent(),
|
||||
null /* secondaryIntentAction */,
|
||||
false /* clearTop */);
|
||||
// MobileNetworkActivity is singleTask, set SplitPairRule to show in 2-pane.
|
||||
MobileNetworkTwoPaneUtils.registerTwoPaneForMobileNetwork(mContext, intent,
|
||||
null);
|
||||
mContext.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.android.settings.network;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
|
||||
|
||||
public class MobileNetworkTwoPaneUtils {
|
||||
|
||||
private static final String TAG = "MobileNetworkTwoPaneUtils";
|
||||
|
||||
/**
|
||||
* TODO: b/206061070, the problem of multi-instance should be fixed in Android T to apply the
|
||||
* Settings' architecture and 2 panes mode instead of registering the rule.
|
||||
*
|
||||
* The launchMode of MobileNetworkActivity is singleTask, set SplitPairRule to show in 2-pane.
|
||||
*/
|
||||
public static void registerTwoPaneForMobileNetwork(Context context, Intent intent,
|
||||
@Nullable String secondaryIntentAction) {
|
||||
Log.d(TAG, "registerTwoPaneForMobileNetwork");
|
||||
ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome(
|
||||
context,
|
||||
intent.getComponent(),
|
||||
secondaryIntentAction /* secondaryIntentAction */,
|
||||
false /* clearTop */);
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,8 @@ public class NetworkProviderDownloadedSimListController extends
|
||||
pref.setOnPreferenceClickListener(clickedPref -> {
|
||||
final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, info.getSubscriptionId());
|
||||
// MobileNetworkActivity is singleTask, set SplitPairRule to show in 2-pane.
|
||||
MobileNetworkTwoPaneUtils.registerTwoPaneForMobileNetwork(mContext, intent, null);
|
||||
mContext.startActivity(intent);
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -60,6 +60,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.android.settings.AirplaneModeEnabler;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.RestrictedSettingsFragment;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.datausage.DataUsagePreference;
|
||||
@@ -133,7 +134,7 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
@VisibleForTesting
|
||||
static final String PREF_KEY_FIRST_ACCESS_POINTS = "first_access_points";
|
||||
private static final String PREF_KEY_ACCESS_POINTS = "access_points";
|
||||
private static final String PREF_KEY_CONFIGURE_WIFI_SETTINGS = "configure_wifi_settings";
|
||||
private static final String PREF_KEY_CONFIGURE_NETWORK_SETTINGS = "configure_network_settings";
|
||||
private static final String PREF_KEY_SAVED_NETWORKS = "saved_networks";
|
||||
@VisibleForTesting
|
||||
static final String PREF_KEY_DATA_USAGE = "non_carrier_data_usage";
|
||||
@@ -278,7 +279,7 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
if (!FeatureFlagUtils.isEnabled(getContext(), FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
if (!Utils.isProviderModelEnabled(getContext())) {
|
||||
final Intent intent = new Intent(getContext(), WifiSettingsActivity.class);
|
||||
final Bundle extras = getActivity().getIntent().getExtras();
|
||||
if (extras != null) {
|
||||
@@ -308,7 +309,7 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
mConnectedWifiEntryPreferenceCategory = findPreference(PREF_KEY_CONNECTED_ACCESS_POINTS);
|
||||
mFirstWifiEntryPreferenceCategory = findPreference(PREF_KEY_FIRST_ACCESS_POINTS);
|
||||
mWifiEntryPreferenceCategory = findPreference(PREF_KEY_ACCESS_POINTS);
|
||||
mConfigureWifiSettingsPreference = findPreference(PREF_KEY_CONFIGURE_WIFI_SETTINGS);
|
||||
mConfigureWifiSettingsPreference = findPreference(PREF_KEY_CONFIGURE_NETWORK_SETTINGS);
|
||||
mSavedNetworksPreference = findPreference(PREF_KEY_SAVED_NETWORKS);
|
||||
mAddWifiNetworkPreference = new AddWifiNetworkPreference(getPrefContext());
|
||||
mDataUsagePreference = findPreference(PREF_KEY_DATA_USAGE);
|
||||
@@ -1187,6 +1188,11 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.network_provider_settings) {
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return Utils.isProviderModelEnabled(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
||||
@@ -128,6 +128,9 @@ public class NetworkProviderSimListController extends AbstractPreferenceControll
|
||||
} else {
|
||||
final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, info.getSubscriptionId());
|
||||
// MobileNetworkActivity is singleTask, set SplitPairRule to show in 2-pane.
|
||||
MobileNetworkTwoPaneUtils.registerTwoPaneForMobileNetwork(mContext, intent,
|
||||
null);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -396,6 +396,8 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
private static void startMobileNetworkActivity(Context context, int subId) {
|
||||
final Intent intent = new Intent(context, MobileNetworkActivity.class);
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, subId);
|
||||
// MobileNetworkActivity is singleTask, set SplitPairRule to show in 2-pane.
|
||||
MobileNetworkTwoPaneUtils.registerTwoPaneForMobileNetwork(context, intent, null);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ import android.util.Log;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.HelpTrampoline;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.network.MobileNetworkTwoPaneUtils;
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
import com.android.settings.network.telephony.MobileNetworkActivity;
|
||||
|
||||
@@ -263,7 +264,9 @@ public class SimSelectNotification extends BroadcastReceiver {
|
||||
Intent resultIntent = new Intent(Settings.ACTION_MMS_MESSAGE_SETTING);
|
||||
resultIntent.setClass(context, MobileNetworkActivity.class);
|
||||
resultIntent.putExtra(Settings.EXTRA_SUB_ID, subId);
|
||||
resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// MobileNetworkActivity is singleTask, set SplitPairRule to show in 2-pane.
|
||||
MobileNetworkTwoPaneUtils.registerTwoPaneForMobileNetwork(context, resultIntent,
|
||||
Settings.ACTION_MMS_MESSAGE_SETTING);
|
||||
PendingIntent resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
|
||||
builder.setContentIntent(resultPendingIntent);
|
||||
|
||||
@@ -41,7 +41,6 @@ import androidx.appcompat.app.AlertDialog;
|
||||
import com.android.internal.net.VpnProfile;
|
||||
import com.android.net.module.util.ProxyUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.utils.AndroidKeystoreAliasLoader;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@@ -518,36 +517,31 @@ class ConfigDialog extends AlertDialog implements TextWatcher,
|
||||
String[] types = getContext().getResources().getStringArray(R.array.vpn_types);
|
||||
mTotalTypes = new ArrayList<>(Arrays.asList(types));
|
||||
mAllowedTypes = new ArrayList<>(Arrays.asList(types));
|
||||
|
||||
// Although FEATURE_IPSEC_TUNNELS should always be present in android S and beyond,
|
||||
// keep this check here just to be safe.
|
||||
if (!getContext().getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_IPSEC_TUNNELS)) {
|
||||
final List<String> typesList = new ArrayList<>(Arrays.asList(types));
|
||||
Log.wtf(TAG, "FEATURE_IPSEC_TUNNELS missing from system");
|
||||
}
|
||||
// If the vpn is new or is not already a legacy type,
|
||||
// don't allow the user to set the type to a legacy option.
|
||||
|
||||
// This must be removed from back to front in order to ensure index consistency
|
||||
typesList.remove(VpnProfile.TYPE_IKEV2_IPSEC_RSA);
|
||||
typesList.remove(VpnProfile.TYPE_IKEV2_IPSEC_PSK);
|
||||
typesList.remove(VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS);
|
||||
// Set the mProfile.type to TYPE_IKEV2_IPSEC_USER_PASS if the VPN not exist
|
||||
if (!mExists) {
|
||||
mProfile.type = VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS;
|
||||
}
|
||||
|
||||
types = typesList.toArray(new String[0]);
|
||||
} else if (Utils.isProviderModelEnabled(getContext())) {
|
||||
// If the provider mode is enabled and the vpn is new or is not already a legacy type,
|
||||
// don't allow the user to set the type to a legacy option.
|
||||
|
||||
// Set the mProfile.type to TYPE_IKEV2_IPSEC_USER_PASS if the VPN not exist
|
||||
if (!mExists) {
|
||||
mProfile.type = VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS;
|
||||
}
|
||||
|
||||
// Remove all types which are legacy types from the typesList
|
||||
if (!VpnProfile.isLegacyType(mProfile.type)) {
|
||||
for (int i = mAllowedTypes.size() - 1; i >= 0; i--) {
|
||||
// This must be removed from back to front in order to ensure index consistency
|
||||
if (VpnProfile.isLegacyType(i)) {
|
||||
mAllowedTypes.remove(i);
|
||||
}
|
||||
// Remove all types which are legacy types from the typesList
|
||||
if (!VpnProfile.isLegacyType(mProfile.type)) {
|
||||
for (int i = mAllowedTypes.size() - 1; i >= 0; i--) {
|
||||
// This must be removed from back to front in order to ensure index consistency
|
||||
if (VpnProfile.isLegacyType(i)) {
|
||||
mAllowedTypes.remove(i);
|
||||
}
|
||||
|
||||
types = mAllowedTypes.toArray(new String[0]);
|
||||
}
|
||||
|
||||
types = mAllowedTypes.toArray(new String[0]);
|
||||
}
|
||||
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(
|
||||
getContext(), android.R.layout.simple_spinner_item, types);
|
||||
|
||||
@@ -59,7 +59,6 @@ import com.android.internal.net.VpnConfig;
|
||||
import com.android.internal.net.VpnProfile;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.RestrictedSettingsFragment;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.widget.GearPreference;
|
||||
import com.android.settings.widget.GearPreference.OnGearClickListener;
|
||||
import com.android.settingslib.RestrictedLockUtilsInternal;
|
||||
@@ -130,12 +129,11 @@ public class VpnSettings extends RestrictedSettingsFragment implements
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
// Although FEATURE_IPSEC_TUNNELS should always be present in android S,
|
||||
// Although FEATURE_IPSEC_TUNNELS should always be present in android S and beyond,
|
||||
// keep this check here just to be safe.
|
||||
if (Utils.isProviderModelEnabled(getContext())
|
||||
&& !getContext().getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_IPSEC_TUNNELS)) {
|
||||
Log.w(LOG_TAG, "FEATURE_IPSEC_TUNNELS missing from system, cannot create new VPNs");
|
||||
if (!getContext().getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_IPSEC_TUNNELS)) {
|
||||
Log.wtf(LOG_TAG, "FEATURE_IPSEC_TUNNELS missing from system, cannot create new VPNs");
|
||||
return;
|
||||
} else {
|
||||
// By default, we should inflate this menu.
|
||||
|
||||
@@ -59,6 +59,7 @@ import com.android.settings.LinkifyUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.RestrictedSettingsFragment;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.datausage.DataUsagePreference;
|
||||
@@ -230,7 +231,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
if (Utils.isProviderModelEnabled(getContext())) {
|
||||
final Intent intent = new Intent("android.settings.NETWORK_PROVIDER_SETTINGS");
|
||||
// Add FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TASK to avoid multiple
|
||||
// instances issue. (e.g. b/191956700)
|
||||
@@ -1067,6 +1068,11 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.wifi_settings) {
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return !Utils.isProviderModelEnabled(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
||||
@@ -157,7 +157,7 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
/*
|
||||
* Launch carrier emergency address managemnent activity
|
||||
* Launch carrier emergency address management activity
|
||||
*/
|
||||
private final OnPreferenceClickListener mUpdateAddressListener =
|
||||
preference -> {
|
||||
|
||||
@@ -33,7 +33,6 @@ import android.net.Uri;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.drawable.IconCompat;
|
||||
@@ -274,7 +273,7 @@ public class WifiSlice implements CustomSliceable {
|
||||
final Uri contentUri = new Uri.Builder().appendPath(KEY_WIFI).build();
|
||||
final String className;
|
||||
final String key;
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
if (Utils.isProviderModelEnabled(mContext)) {
|
||||
className = NetworkProviderSettings.class.getName();
|
||||
key = WifiSwitchPreferenceController.KEY;
|
||||
} else {
|
||||
|
||||
@@ -34,6 +34,7 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.AppOpsManager;
|
||||
import android.apphibernation.AppHibernationManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.DeviceConfig;
|
||||
@@ -61,6 +62,8 @@ public class HibernationSwitchPreferenceControllerTest {
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
@Mock
|
||||
private AppHibernationManager mAppHibernationManager;
|
||||
@Mock
|
||||
private SwitchPreference mPreference;
|
||||
|
||||
private HibernationSwitchPreferenceController mController;
|
||||
@@ -71,6 +74,8 @@ public class HibernationSwitchPreferenceControllerTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||
when(mContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mAppOpsManager);
|
||||
when(mContext.getSystemService(AppHibernationManager.class))
|
||||
.thenReturn(mAppHibernationManager);
|
||||
when(mPackageManager.getPackageUid(eq(VALID_PACKAGE_NAME), anyInt()))
|
||||
.thenReturn(PACKAGE_UID);
|
||||
when(mPackageManager.getPackageUid(eq(INVALID_PACKAGE_NAME), anyInt()))
|
||||
@@ -109,6 +114,15 @@ public class HibernationSwitchPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_unhibernatesWhenExempted() {
|
||||
mController.setPackage(VALID_PACKAGE_NAME);
|
||||
mController.onPreferenceChange(mPreference, false);
|
||||
|
||||
verify(mAppHibernationManager).setHibernatingForUser(VALID_PACKAGE_NAME, false);
|
||||
verify(mAppHibernationManager).setHibernatingGlobally(VALID_PACKAGE_NAME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_exemptedByDefaultPackage_shouldNotCheck() {
|
||||
when(mAppOpsManager.unsafeCheckOpNoThrow(
|
||||
|
||||
Reference in New Issue
Block a user