Snap for 7708232 from 8203737671 to sc-v2-release

Change-Id: I505689cd978c6a530885a0318b321a1559fdf0cf
This commit is contained in:
Android Build Coastguard Worker
2021-09-06 23:09:20 +00:00
12 changed files with 454 additions and 52 deletions

View File

@@ -108,7 +108,9 @@
<uses-permission android:name="android.permission.READ_DREAM_SUPPRESSION" /> <uses-permission android:name="android.permission.READ_DREAM_SUPPRESSION" />
<uses-permission android:name="android.permission.MANAGE_APP_HIBERNATION" /> <uses-permission android:name="android.permission.MANAGE_APP_HIBERNATION" />
<application android:label="@string/settings_label" <application
android:name=".SettingsApplication"
android:label="@string/settings_label"
android:icon="@drawable/ic_launcher_settings" android:icon="@drawable/ic_launcher_settings"
android:theme="@style/Theme.Settings" android:theme="@style/Theme.Settings"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"

View File

@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<issues format="4"> <issues format="4">
<issue
id="LintError"
severity="Error"
message="No `.class` files were found in project &quot;.&quot;, so none of the classfile based checks could be run. Does the project need to be built first?"
category="Lint"
priority="10"
summary="Lint Failure"
explanation="This issue type represents a problem running lint itself. Examples include failure to find bytecode for source files (which means certain detectors could not be run), parsing errors in lint configuration files, etc.&#xA;These errors are not errors in your own code, but they are shown to make it clear that some checks were not completed.">
<location
file="."/>
</issue>
<issue <issue
id="HardCodedColor" id="HardCodedColor"
severity="Error" severity="Error"
@@ -1881,8 +1893,8 @@
priority="4" priority="4"
summary="Using hardcoded color" summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_teal&quot;>#ff80cbc4&lt;/color> &lt;!-- Material Teal 200 -->" errorLine1=" &lt;color name=&quot;SIM_color_cyan&quot;>#ff006D74&lt;/color> &lt;!-- Material Custom Cyan -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="188" line="188"
@@ -1897,8 +1909,8 @@
priority="4" priority="4"
summary="Using hardcoded color" summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_blue&quot;>#ff90caf9&lt;/color> &lt;!-- Material Blue 200 -->" errorLine1=" &lt;color name=&quot;SIM_color_blue800&quot;>#ff185ABC&lt;/color> &lt;!-- Material Blue 800 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="189" line="189"
@@ -1913,8 +1925,8 @@
priority="4" priority="4"
summary="Using hardcoded color" summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_indigo&quot;>#ffc5cae9&lt;/color> &lt;!-- Material Indigo 100 -->" errorLine1=" &lt;color name=&quot;SIM_color_green800&quot;>#ff137333&lt;/color> &lt;!-- Material Green 800 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="190" line="190"
@@ -1929,8 +1941,8 @@
priority="4" priority="4"
summary="Using hardcoded color" summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_purple&quot;>#ffe1bee7&lt;/color> &lt;!-- Material Purple 100 -->" errorLine1=" &lt;color name=&quot;SIM_color_purple800&quot;>#ff7627bb&lt;/color> &lt;!-- Material Purple 800 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="191" line="191"
@@ -1945,8 +1957,8 @@
priority="4" priority="4"
summary="Using hardcoded color" summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_pink&quot;>#fff48fb1&lt;/color> &lt;!-- Material Pink 200 -->" errorLine1=" &lt;color name=&quot;SIM_color_pink800&quot;>#ffb80672&lt;/color> &lt;!-- Material Pink 800 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="192" line="192"
@@ -1961,14 +1973,110 @@
priority="4" priority="4"
summary="Using hardcoded color" summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_red&quot;>#ffef9a9a&lt;/color> &lt;!-- Material Red 200 -->" errorLine1=" &lt;color name=&quot;SIM_color_orange&quot;>#ff995400&lt;/color> &lt;!-- Material Custom Orange -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="193" line="193"
column="5"/> column="5"/>
</issue> </issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_cyan&quot;>#ff4DD0E1&lt;/color> &lt;!-- Material Cyan 300 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="196"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_blue&quot;>#ff8AB4F8&lt;/color> &lt;!-- Material Blue 300 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="197"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_green&quot;>#ff81C995&lt;/color> &lt;!-- Material Green 300 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="198"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_purple&quot;>#ffC58AF9&lt;/color> &lt;!-- Material Purple 300 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="199"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_pink&quot;>#ffff8bcb&lt;/color> &lt;!-- Material Pink 300 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="200"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_orange&quot;>#fffcad70&lt;/color> &lt;!-- Material Orange 300 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="201"
column="5"/>
</issue>
<issue <issue
id="HardCodedColor" id="HardCodedColor"
severity="Error" severity="Error"
@@ -1981,7 +2089,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="199" line="207"
column="5"/> column="5"/>
</issue> </issue>
@@ -1997,7 +2105,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="200" line="208"
column="5"/> column="5"/>
</issue> </issue>
@@ -2013,7 +2121,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="201" line="209"
column="5"/> column="5"/>
</issue> </issue>
@@ -2029,7 +2137,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="202" line="210"
column="5"/> column="5"/>
</issue> </issue>
@@ -2045,7 +2153,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="204" line="212"
column="5"/> column="5"/>
</issue> </issue>
@@ -2061,7 +2169,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="206" line="214"
column="5"/> column="5"/>
</issue> </issue>
@@ -2077,7 +2185,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/colors.xml" file="res/values/colors.xml"
line="209" line="217"
column="5"/> column="5"/>
</issue> </issue>
@@ -4653,7 +4761,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location <location
file="res/values/strings.xml" file="res/values/strings.xml"
line="7100" line="7106"
column="36"/> column="36"/>
</issue> </issue>

Binary file not shown.

View File

@@ -1179,14 +1179,24 @@
<item>Cached (empty)</item> <item>Cached (empty)</item>
</string-array> </string-array>
<!-- Array of color for sim color for multi-sim in light mode -->
<string-array name="sim_color_light">
<item>@color/SIM_color_cyan</item>
<item>@color/SIM_color_blue800</item>
<item>@color/SIM_color_green800</item>
<item>@color/SIM_color_purple800</item>
<item>@color/SIM_color_pink800</item>
<item>@color/SIM_color_orange</item>
</string-array>
<!-- Array of titles for sim color for multi-sim --> <!-- Array of titles for sim color for multi-sim -->
<string-array name="color_picker"> <string-array name="color_picker">
<item>Teal</item> <item>Cyan</item>
<item>Blue</item> <item>Blue</item>
<item>Indigo</item> <item>Green</item>
<item>Purple</item> <item>Purple</item>
<item>Pink</item> <item>Pink</item>
<item>Red</item> <item>Orange</item>
</string-array> </string-array>
<!-- Automatic storage management settings. The amount of days for the automatic storage manager <!-- Automatic storage management settings. The amount of days for the automatic storage manager

View File

@@ -184,13 +184,21 @@
<color name="SIM_color_pink">#ffc2185b</color> <!-- Material Pink 700 --> <color name="SIM_color_pink">#ffc2185b</color> <!-- Material Pink 700 -->
<color name="SIM_color_red">#ffd32f2f</color> <!-- Material Red 700 --> <color name="SIM_color_red">#ffd32f2f</color> <!-- Material Red 700 -->
<!-- SIM colors updated for GAR -->
<color name="SIM_color_cyan">#ff006D74</color> <!-- Material Custom Cyan -->
<color name="SIM_color_blue800">#ff185ABC</color> <!-- Material Blue 800 -->
<color name="SIM_color_green800">#ff137333</color> <!-- Material Green 800 -->
<color name="SIM_color_purple800">#ff7627bb</color> <!-- Material Purple 800 -->
<color name="SIM_color_pink800">#ffb80672</color> <!-- Material Pink 800 -->
<color name="SIM_color_orange">#ff995400</color> <!-- Material Custom Orange -->
<!-- Dark mode SIM colors --> <!-- Dark mode SIM colors -->
<color name="SIM_dark_mode_color_teal">#ff80cbc4</color> <!-- Material Teal 200 --> <color name="SIM_dark_mode_color_cyan">#ff4DD0E1</color> <!-- Material Cyan 300 -->
<color name="SIM_dark_mode_color_blue">#ff90caf9</color> <!-- Material Blue 200 --> <color name="SIM_dark_mode_color_blue">#ff8AB4F8</color> <!-- Material Blue 300 -->
<color name="SIM_dark_mode_color_indigo">#ffc5cae9</color> <!-- Material Indigo 100 --> <color name="SIM_dark_mode_color_green">#ff81C995</color> <!-- Material Green 300 -->
<color name="SIM_dark_mode_color_purple">#ffe1bee7</color> <!-- Material Purple 100 --> <color name="SIM_dark_mode_color_purple">#ffC58AF9</color> <!-- Material Purple 300 -->
<color name="SIM_dark_mode_color_pink">#fff48fb1</color> <!-- Material Pink 200 --> <color name="SIM_dark_mode_color_pink">#ffff8bcb</color> <!-- Material Pink 300 -->
<color name="SIM_dark_mode_color_red">#ffef9a9a</color> <!-- Material Red 200 --> <color name="SIM_dark_mode_color_orange">#fffcad70</color> <!-- Material Orange 300 -->
<!-- Top app bar colors --> <!-- Top app bar colors -->
<color name="color_surface_header">@*android:color/surface_header_light</color> <color name="color_surface_header">@*android:color/surface_header_light</color>

View File

@@ -5192,7 +5192,7 @@
<string name="allow_bind_app_widget_activity_allow_bind_title">Create widget and allow access?</string> <string name="allow_bind_app_widget_activity_allow_bind_title">Create widget and allow access?</string>
<!-- Message in dialog that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] --> <!-- Message in dialog that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] -->
<string name="allow_bind_app_widget_activity_allow_bind">After you create the widget, <xliff:g id="widget_host_name">%1$s</xliff:g> can access all data it displays.</string> <string name="allow_bind_app_widget_activity_allow_bind">After you create the widget, the application can access everything displayed.\n\nApplication: <xliff:g id="widget_host_name">%1$s</xliff:g>\nWidget: <xliff:g id="widget_label">%2$s</xliff:g>\n</string>
<!-- Text for checkbox that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] --> <!-- Text for checkbox that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] -->
<string name="allow_bind_app_widget_activity_always_allow_bind">Always allow <xliff:g id="widget_host_name">%1$s</xliff:g> to create widgets and access their data</string> <string name="allow_bind_app_widget_activity_always_allow_bind">Always allow <xliff:g id="widget_host_name">%1$s</xliff:g> to create widgets and access their data</string>

View File

@@ -19,6 +19,7 @@ package com.android.settings;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@@ -122,9 +123,12 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
return; return;
} }
} }
mAppWidgetManager = AppWidgetManager.getInstance(this);
final String widgetLabel = getWidgetLabel();
AlertController.AlertParams ap = mAlertParams; AlertController.AlertParams ap = mAlertParams;
ap.mTitle = getString(R.string.allow_bind_app_widget_activity_allow_bind_title); ap.mTitle = getString(R.string.allow_bind_app_widget_activity_allow_bind_title);
ap.mMessage = getString(R.string.allow_bind_app_widget_activity_allow_bind, label); ap.mMessage = getString(R.string.allow_bind_app_widget_activity_allow_bind, label,
widgetLabel);
ap.mPositiveButtonText = getString(R.string.create); ap.mPositiveButtonText = getString(R.string.create);
ap.mNegativeButtonText = getString(android.R.string.cancel); ap.mNegativeButtonText = getString(android.R.string.cancel);
ap.mPositiveButtonListener = this; ap.mPositiveButtonListener = this;
@@ -133,18 +137,30 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ap.mView = inflater.inflate(com.android.internal.R.layout.always_use_checkbox, null); ap.mView = inflater.inflate(com.android.internal.R.layout.always_use_checkbox, null);
mAlwaysUse = (CheckBox) ap.mView.findViewById(com.android.internal.R.id.alwaysUse); mAlwaysUse = (CheckBox) ap.mView.findViewById(com.android.internal.R.id.alwaysUse);
mAlwaysUse.setText(getString(R.string.allow_bind_app_widget_activity_always_allow_bind, label)); mAlwaysUse.setText(
getString(R.string.allow_bind_app_widget_activity_always_allow_bind, label));
mAlwaysUse.setPadding(mAlwaysUse.getPaddingLeft(), mAlwaysUse.setPadding(mAlwaysUse.getPaddingLeft(),
mAlwaysUse.getPaddingTop(), mAlwaysUse.getPaddingTop(),
mAlwaysUse.getPaddingRight(), mAlwaysUse.getPaddingRight(),
(int) (mAlwaysUse.getPaddingBottom() + (int) (mAlwaysUse.getPaddingBottom() +
getResources().getDimension(R.dimen.bind_app_widget_dialog_checkbox_bottom_padding))); getResources().getDimension(
R.dimen.bind_app_widget_dialog_checkbox_bottom_padding)));
mAppWidgetManager = AppWidgetManager.getInstance(this);
mAlwaysUse.setChecked(mAppWidgetManager.hasBindAppWidgetPermission(mCallingPackage, mAlwaysUse.setChecked(mAppWidgetManager.hasBindAppWidgetPermission(mCallingPackage,
mProfile.getIdentifier())); mProfile.getIdentifier()));
setupAlert(); setupAlert();
} }
private String getWidgetLabel() {
String label = "";
for (AppWidgetProviderInfo providerInfo : mAppWidgetManager.getInstalledProviders()) {
if (providerInfo.provider.equals(mComponentName)) {
label = providerInfo.loadLabel(getPackageManager());
break;
}
}
return label;
}
} }

View File

@@ -0,0 +1,34 @@
/*
* 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;
import android.app.Application;
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
/** Settings application which sets up activity embedding rules for the large screen device. */
public class SettingsApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
final ActivityEmbeddingRulesController controller =
new ActivityEmbeddingRulesController(this);
controller.initRules();
}
}

View File

@@ -0,0 +1,108 @@
/*
* 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.activityembedding;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.LayoutDirection;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.window.embedding.ActivityFilter;
import androidx.window.embedding.SplitController;
import androidx.window.embedding.SplitPairFilter;
import androidx.window.embedding.SplitPairRule;
import androidx.window.embedding.SplitPlaceholderRule;
import com.android.settings.Settings;
import com.android.settings.SubSettings;
import java.util.HashSet;
import java.util.Set;
/** A class to initialize split rules for activity embedding. */
public class ActivityEmbeddingRulesController {
private static final String TAG = "ActivityEmbeddingCtrl ";
private final Context mContext;
private final SplitController mSplitController;
public ActivityEmbeddingRulesController(Context context) {
mContext = context;
mSplitController = new SplitController(context);
}
/**
* Set up embedding rules to place activities to the right pane.
*/
public void initRules() {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(mContext)) {
Log.d(TAG, "Not support this feature now");
return;
}
mSplitController.clearRegisteredRules();
// Set a placeholder for home page.
mSplitController.registerRule(getHomepagePlaceholderRule());
// Set subsettings rule.
mSplitController.registerRule(getSubSettingsPairRule());
}
private SplitPlaceholderRule getHomepagePlaceholderRule() {
final Set<ActivityFilter> activityFilters = new HashSet<>();
activityFilters.add(new ActivityFilter(getComponentName(Settings.class)));
final Intent intent = new Intent();
intent.setComponent(getComponentName(Settings.NetworkDashboardActivity.class));
final SplitPlaceholderRule placeholderRule = new SplitPlaceholderRule(
activityFilters,
intent,
ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthPx(mContext),
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthPx(mContext),
ActivityEmbeddingUtils.SPLIT_RATIO,
LayoutDirection.LOCALE);
return placeholderRule;
}
private SplitPairRule getSubSettingsPairRule() {
final Set<SplitPairFilter> pairFilters = new HashSet<>();
pairFilters.add(new SplitPairFilter(
getComponentName(Settings.class),
getComponentName(SubSettings.class),
null /* secondaryActivityIntentAction */,
null /* secondaryActivityIntentCategory */));
final SplitPairRule rule = new SplitPairRule(
pairFilters,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
true /* clearTop */,
ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthPx(mContext),
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthPx(mContext),
ActivityEmbeddingUtils.SPLIT_RATIO,
LayoutDirection.LOCALE);
return rule;
}
@NonNull
private ComponentName getComponentName(Class<? extends Activity> activityClass) {
return new ComponentName(mContext.getPackageName(), activityClass.getName());
}
}

View File

@@ -0,0 +1,65 @@
/*
* 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.activityembedding;
import android.content.Context;
import android.util.DisplayMetrics;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.util.TypedValue;
import androidx.window.embedding.SplitController;
/** An util class collecting all common methods for the embedding activity features. */
public class ActivityEmbeddingUtils {
public static final float SPLIT_RATIO = 0.5f;
// The smallest value of current width of the window when the split should be used.
private static final float MIN_CURRENT_SCREEN_SPLIT_WIDTH_DP = 600f;
// The smallest value of the smallest-width (sw) of the window in any rotation when
// the split should be used.
private static final float MIN_SMALLEST_SCREEN_SPLIT_WIDTH_DP = 600f;
private static final String TAG = "ActivityEmbeddingUtils";
/** Get the smallest pixel value of width of the window when the split should be used. */
public static int getMinCurrentScreenSplitWidthPx(Context context) {
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
return (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, MIN_CURRENT_SCREEN_SPLIT_WIDTH_DP, dm);
}
/**
* Get the smallest pixel value of the smallest-width (sw) of the window in any rotation when
* the split should be used.
*/
public static int getMinSmallestScreenSplitWidthPx(Context context) {
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
return (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, MIN_SMALLEST_SCREEN_SPLIT_WIDTH_DP, dm);
}
/** Whether to support embedding activity feature. */
public static boolean isEmbeddingActivityEnabled(Context context) {
final boolean isFlagEnabled = FeatureFlagUtils.isEnabled(context,
FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN);
final boolean isSplitSupported = new SplitController(context).isSplitSupported();
Log.d(TAG, "isFlagEnabled = " + isFlagEnabled);
Log.d(TAG, "isSplitSupported = " + isSplitSupported);
return isFlagEnabled && isSplitSupported;
}
}

View File

@@ -52,6 +52,7 @@ import com.android.settingslib.DeviceInfoUtils;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -108,18 +109,18 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
mSubId = getArguments().getInt(KEY_SUBSCRIPTION_ID); mSubId = getArguments().getInt(KEY_SUBSCRIPTION_ID);
Resources res = context.getResources(); Resources res = context.getResources();
mLightDarkMap = ImmutableMap.<Integer, Integer>builder() mLightDarkMap = ImmutableMap.<Integer, Integer>builder()
.put(res.getInteger(R.color.SIM_color_teal), .put(res.getInteger(R.color.SIM_color_cyan),
res.getInteger(R.color.SIM_dark_mode_color_teal)) res.getInteger(R.color.SIM_dark_mode_color_cyan))
.put(res.getInteger(R.color.SIM_color_blue), .put(res.getInteger(R.color.SIM_color_blue800),
res.getInteger(R.color.SIM_dark_mode_color_blue)) res.getInteger(R.color.SIM_dark_mode_color_blue))
.put(res.getInteger(R.color.SIM_color_indigo), .put(res.getInteger(R.color.SIM_color_green800),
res.getInteger(R.color.SIM_dark_mode_color_indigo)) res.getInteger(R.color.SIM_dark_mode_color_green))
.put(res.getInteger(R.color.SIM_color_purple), .put(res.getInteger(R.color.SIM_color_purple800),
res.getInteger(R.color.SIM_dark_mode_color_purple)) res.getInteger(R.color.SIM_dark_mode_color_purple))
.put(res.getInteger(R.color.SIM_color_pink), .put(res.getInteger(R.color.SIM_color_pink800),
res.getInteger(R.color.SIM_dark_mode_color_pink)) res.getInteger(R.color.SIM_dark_mode_color_pink))
.put(res.getInteger(R.color.SIM_color_red), .put(res.getInteger(R.color.SIM_color_orange),
res.getInteger(R.color.SIM_dark_mode_color_red)) res.getInteger(R.color.SIM_dark_mode_color_orange))
.build(); .build();
} }
@@ -175,12 +176,7 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
final ColorAdapter adapter = new ColorAdapter(getContext(), final ColorAdapter adapter = new ColorAdapter(getContext(),
R.layout.dialog_mobile_network_color_picker_item, mColors); R.layout.dialog_mobile_network_color_picker_item, mColors);
mColorSpinner.setAdapter(adapter); mColorSpinner.setAdapter(adapter);
for (int i = 0; i < mColors.length; i++) { mColorSpinner.setSelection(getSimColorIndex(info.getIconTint()));
if (mColors[i].getColor() == info.getIconTint()) {
mColorSpinner.setSelection(i);
break;
}
}
final TextView operatorName = view.findViewById(R.id.operator_name_value); final TextView operatorName = view.findViewById(R.id.operator_name_value);
mTelephonyManager = mTelephonyManager.createForSubscriptionId(mSubId); mTelephonyManager = mTelephonyManager.createForSubscriptionId(mSubId);
@@ -239,7 +235,7 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
private Color[] getColors() { private Color[] getColors() {
final Resources res = getContext().getResources(); final Resources res = getContext().getResources();
final int[] colorInts = res.getIntArray(com.android.internal.R.array.sim_colors); final int[] colorInts = res.getIntArray(R.array.sim_color_light);
final String[] colorStrings = res.getStringArray(R.array.color_picker); final String[] colorStrings = res.getStringArray(R.array.color_picker);
final int iconSize = res.getDimensionPixelSize(R.dimen.color_swatch_size); final int iconSize = res.getDimensionPixelSize(R.dimen.color_swatch_size);
final int strokeWidth = res.getDimensionPixelSize(R.dimen.color_swatch_stroke_width); final int strokeWidth = res.getDimensionPixelSize(R.dimen.color_swatch_stroke_width);
@@ -286,4 +282,31 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
private int getDarkColor(int lightColor) { private int getDarkColor(int lightColor) {
return mLightDarkMap.getOrDefault(lightColor, lightColor); return mLightDarkMap.getOrDefault(lightColor, lightColor);
} }
/*
* Get the color index from previous color that defined in Android OS
* (frameworks/base/core/res/res/values/arrays.xml). If can't find the color, continue to look
* for it in the new color plattee. If not, give it the first index.
*/
private int getSimColorIndex(int color) {
int index = -1;
final int[] previousSimColorInts =
getContext().getResources().getIntArray(com.android.internal.R.array.sim_colors);
for (int i = 0; i < previousSimColorInts.length; i++) {
if (previousSimColorInts[i] == color) {
index = i;
}
}
if (index == -1) {
for (int i = 0; i < mColors.length; i++) {
if (mColors[i].getColor() == color) {
index = i;
}
}
}
return index == -1 ? 0 : index;
}
} }

View File

@@ -159,7 +159,7 @@ public class RenameMobileNetworkDialogFragmentTest {
eq(SubscriptionManager.NAME_SOURCE_USER_INPUT)); eq(SubscriptionManager.NAME_SOURCE_USER_INPUT));
assertThat(captor.getValue()).isEqualTo("test2"); assertThat(captor.getValue()).isEqualTo("test2");
verify(mSubscriptionMgr) verify(mSubscriptionMgr)
.setIconTint(eq(Color.parseColor("#ff00796b" /* teal */)), eq(mSubscriptionId)); .setIconTint(eq(Color.parseColor("#ff006D74" /* cyan */)), eq(mSubscriptionId));
} }
@Test @Test
@@ -174,6 +174,34 @@ public class RenameMobileNetworkDialogFragmentTest {
assertThat(view.findViewById(R.id.number_label).getVisibility()).isEqualTo(View.GONE); assertThat(view.findViewById(R.id.number_label).getVisibility()).isEqualTo(View.GONE);
} }
@Test
public void populateView_getPreviousSimColor_setCorrectSelection() {
final View view = LayoutInflater.from(mActivity).inflate(
R.layout.dialog_mobile_network_rename, null);
when(mSubscriptionInfo.getIconTint())
.thenReturn(Color.parseColor("#ff3367d6"/* blue700 */));
startDialog();
mFragment.populateView(view);
final Spinner colorSpinnerView = mFragment.getColorSpinnerView();
assertThat(colorSpinnerView.getSelectedItemPosition()).isEqualTo(1);
}
@Test
public void populateView_getUpdatedSimColor_setCorrectSelection() {
final View view = LayoutInflater.from(mActivity).inflate(
R.layout.dialog_mobile_network_rename, null);
when(mSubscriptionInfo.getIconTint())
.thenReturn(Color.parseColor("#ff137333"/* Green800 */));
startDialog();
mFragment.populateView(view);
final Spinner colorSpinnerView = mFragment.getColorSpinnerView();
assertThat(colorSpinnerView.getSelectedItemPosition()).isEqualTo(2);
}
/** /**
* Helper method to start the dialog * Helper method to start the dialog
*/ */