Merge "Change action WIFI_DPP_CONFIGURATOR_CHOOSE_SAVED_WIFI_NETWORK to PROCESS_WIFI_DPP_QR_CODE for more intuitive naming."
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index fd0fc6c..7b0b28e 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -2,6 +2,18 @@
<issues format="4">
<issue
+ id="LintError"
+ severity="Error"
+ message="No `.class` files were found in project ".", 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.
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
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
@@ -233,6 +245,22 @@
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.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="homepage_status_bar_color">#cc000000</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values-night/colors.xml"
+ line="25"
+ column="3"/>
+ </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.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" <color name="crypt_keeper_clock_foreground">#ff666666</color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -1289,11 +1317,27 @@
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.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="homepage_status_bar_color">#ccFFFFFF</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="133"
+ 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.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" <color name="qr_corner_line_color">#ffdadce0</color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="133"
+ line="136"
column="5"/>
</issue>
@@ -1309,7 +1353,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="134"
+ line="137"
column="5"/>
</issue>
@@ -1325,7 +1369,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="135"
+ line="138"
column="5"/>
</issue>
@@ -2477,7 +2521,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/strings.xml"
- line="5883"
+ line="5885"
column="36"/>
</issue>
@@ -2509,7 +2553,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="415"
+ line="388"
column="44"/>
</issue>
@@ -2525,7 +2569,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="421"
+ line="394"
column="44"/>
</issue>
@@ -2541,7 +2585,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="422"
+ line="395"
column="44"/>
</issue>
@@ -2557,7 +2601,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="457"
+ line="430"
column="34"/>
</issue>
diff --git a/res/layout/battery_header.xml b/res/layout/battery_header.xml
index d6ecafa..b3b699a 100644
--- a/res/layout/battery_header.xml
+++ b/res/layout/battery_header.xml
@@ -22,15 +22,12 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
- android:paddingTop="24dp"
- android:paddingBottom="24dp"
style="@style/EntityHeader">
<LinearLayout
- android:layout_width="0dp"
+ android:layout_width="170dp"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginStart="56dp"
+ android:layout_marginStart="72dp"
android:layout_marginEnd="8dp"
android:orientation="vertical">
@@ -39,8 +36,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
- android:fontFamily="@*android:string/config_headlineFontFamily"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1"/>
+ android:textAppearance="@style/TextAppearance.EntityHeaderTitle"
+ android:textSize="36sp" />
<TextView
android:id="@+id/summary1"
@@ -49,19 +46,20 @@
android:layout_marginTop="8dp"
android:minLines="2"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"/>
+ android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/summary2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"/>
-
+ android:textColor="?android:attr/textColorPrimary"/>
</LinearLayout>
<com.android.settings.fuelgauge.BatteryMeterView
android:id="@+id/battery_header_icon"
- android:layout_width="@dimen/battery_meter_width"
+ android:layout_width="match_parent"
android:layout_height="@dimen/battery_meter_height"
- android:layout_marginEnd="16dp"/>
+ android:layout_gravity="center"/>
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml
index 75d449f..1e5bdce 100644
--- a/res/layout/settings_homepage_container.xml
+++ b/res/layout/settings_homepage_container.xml
@@ -31,8 +31,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:paddingTop="@dimen/app_bar_height"
- android:descendantFocusability="blocksDescendants">
+ android:descendantFocusability="blocksDescendants"
+ android:paddingTop="104dp">
+ <!-- height of status bar(24dp) + height of action bar(48dp) + top/bottom margins(16dp) -->
<FrameLayout
android:id="@+id/contextual_cards_content"
@@ -52,6 +53,13 @@
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="@*android:dimen/status_bar_height"
+ android:background="@android:color/transparent"
+ app:layout_scrollFlags="scroll|enterAlways"/>
+
<include layout="@layout/search_bar"/>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index bc06f47..f864e03 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -21,5 +21,7 @@
<color name="switchbar_switch_thumb_tint">@android:color/black</color>
<color name="homepage_accessibility_background">#783BE5</color>
<color name="homepage_support_background">#3F5FBD</color>
+ <!-- 80% black for status bar of homepage -->
+ <color name="homepage_status_bar_color">#cc000000</color>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 2103649..5539d68 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -129,6 +129,9 @@
<!-- launcher icon color -->
<color name="icon_launcher_setting_color">@*android:color/accent_device_default_light</color>
+ <!-- 80% white for status bar of homepage -->
+ <color name="homepage_status_bar_color">#ccFFFFFF</color>
+
<!-- QR code scanner colors -->
<color name="qr_corner_line_color">#ffdadce0</color>
<color name="qr_focused_corner_line_color">#ff1a73e8</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 383f564..96822fc 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -105,8 +105,6 @@
<dimen name="search_bar_avatar_size">32dp</dimen>
<dimen name="search_bar_avatar_start_margin">4dp</dimen>
<dimen name="search_bar_avatar_end_margin">16dp</dimen>
- <!-- appbar height is equal search bar height (48dp) plus search bar top and bottom margin -->
- <dimen name="app_bar_height">80dp</dimen>
<!-- Dimensions for Wifi Assistant Card -->
<dimen name="wifi_assistant_padding_top_bottom">16dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a45be06..089ade9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2646,6 +2646,9 @@
<!-- Description about the feature adaptive brightness -->
<string name="auto_brightness_description">Your screen brightness will automatically adjust to your environment and activities. You can move the slider manually to help adaptive brightness learn your preferences.</string>
+ <!-- Display settings screen, display white balance settings title [CHAR LIMIT=30] -->
+ <string name="display_white_balance_title">Display white balance</string>
+
<!-- Night display screen, setting option name to enable night display (renamed "Night Light" with title caps). [CHAR LIMIT=30] -->
<string name="night_display_title">Night Light</string>
<!-- Night display screen, description of night display feature (renamed "Night Light" with title caps). [CHAR LIMIT=NONE] -->
@@ -5223,6 +5226,9 @@
<item quantity="other">%1$d apps restricted</item>
</plurals>
+ <!-- Title to display the battery percentage. [CHAR LIMIT=24] -->
+ <string name="battery_header_title_alternate"><xliff:g id="number" example="88">^1</xliff:g><small> <font size="20"><xliff:g id="unit" example="%">%</xliff:g></font></small></string>
+
<!-- Title for force stop dialog [CHAR LIMIT=30] -->
<string name="dialog_stop_title">Stop app?</string>
<!-- Message body for force stop dialog [CHAR LIMIT=NONE] -->
@@ -10036,12 +10042,12 @@
<!-- UI debug setting: ANGLE enabled app has been set [CHAR LIMIT=NONE] -->
<string name="angle_enabled_app_set">ANGLE enabled application: <xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
- <!-- UI debug setting: select an app to use updated graphics driver [CHAR LIMIT=100] -->
- <string name="updated_gfx_driver_dev_opt_in_app">Select app to use updated graphics driver</string>
- <!-- UI debug setting: no app selected to use updated GPU driver [CHAR LIMIT=100] -->
- <string name="updated_gfx_driver_dev_opt_in_app_not_set">No selected app to use updated graphics driver</string>
- <!-- UI debug setting: app selected to use updated graphics driver [CHAR LIMIT=NONE] -->
- <string name="updated_gfx_driver_dev_opt_in_app_set">Opt in application: <xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
+ <!-- UI debug setting: select an app to use Game Update Package [CHAR LIMIT=100] -->
+ <string name="gup_dev_opt_in_app">Use Game Update Package</string>
+ <!-- UI debug setting: no app selected to use Game Update Package [CHAR LIMIT=100] -->
+ <string name="gup_dev_opt_in_app_not_set">No selected app</string>
+ <!-- UI debug setting: app selected to use Game Update Package [CHAR LIMIT=NONE] -->
+ <string name="gup_dev_opt_in_app_set"><xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
<!-- Slices Strings -->
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index be45cd0..214c00c 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -424,9 +424,10 @@
android:summary="%s"
android:title="@string/simulate_color_space" />
- <Preference android:key="updated_gfx_driver_dev_opt_in_app"
- android:summary="@string/updated_gfx_driver_dev_opt_in_app_summary"
- android:title="@string/updated_gfx_driver_dev_opt_in_app" />
+ <Preference
+ android:title="@string/gup_dev_opt_in_app"
+ android:key="gup_dev_opt_in_app"
+ android:summary="@string/gup_dev_opt_in_app_summary" />
</PreferenceCategory>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 50a5649..76b3d2e 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -79,6 +79,11 @@
settings:controller="com.android.settings.display.ColorModePreferenceController"
settings:keywords="@string/keywords_color_mode" />
+ <SwitchPreference
+ android:key="display_white_balance"
+ android:title="@string/display_white_balance_title"
+ settings:controller="com.android.settings.display.DisplayWhiteBalancePreferenceController" />
+
<Preference
android:key="font_size"
android:title="@string/title_font_size"
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
index eab2a28..2ea3371 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
@@ -52,8 +52,6 @@
LocalBluetoothProfileManager.ServiceListener {
private static final String TAG = "BluetoothDeviceUpdater";
private static final boolean DBG = true;
- private static final String BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY =
- "persist.bluetooth.showdeviceswithoutnames";
protected final DevicePreferenceCallback mDevicePreferenceCallback;
protected final Map<BluetoothDevice, Preference> mPreferenceMap;
@@ -62,8 +60,6 @@
@VisibleForTesting
protected LocalBluetoothManager mLocalManager;
- private final boolean mShowDeviceWithoutNames;
-
@VisibleForTesting
final GearPreference.OnGearClickListener mDeviceProfilesListener = pref -> {
launchDeviceDetails(pref);
@@ -79,8 +75,6 @@
DevicePreferenceCallback devicePreferenceCallback, LocalBluetoothManager localManager) {
mFragment = fragment;
mDevicePreferenceCallback = devicePreferenceCallback;
- mShowDeviceWithoutNames = SystemProperties.getBoolean(
- BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, false);
mPreferenceMap = new HashMap<>();
mLocalManager = localManager;
}
@@ -223,7 +217,7 @@
if (!mPreferenceMap.containsKey(device)) {
BluetoothDevicePreference btPreference =
new BluetoothDevicePreference(mPrefContext, cachedDevice,
- mShowDeviceWithoutNames);
+ true /* showDeviceWithoutNames */);
btPreference.setOnGearClickListener(mDeviceProfilesListener);
if (this instanceof Preference.OnPreferenceClickListener) {
btPreference.setOnPreferenceClickListener(
diff --git a/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java b/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
index e65d2ad..a67aac4 100644
--- a/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
+++ b/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
@@ -32,5 +32,5 @@
int REQUEST_CODE_ANGLE_DRIVER_VALUES = 5;
- int REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP = 6;
+ int REQUEST_CODE_GUP_DEV_OPT_IN_APPS = 6;
}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index aa9918c..5990320 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -423,7 +423,7 @@
controllers.add(new SelectDebugAppPreferenceController(context, fragment));
controllers.add(new WaitForDebuggerPreferenceController(context));
controllers.add(new EnableGpuDebugLayersPreferenceController(context));
- controllers.add(new UpdatedGfxDriverDevOptInPreferenceController(context, fragment));
+ controllers.add(new GameUpdatePackageDevOptInPreferenceController(context, fragment));
controllers.add(new VerifyAppsOverUsbPreferenceController(context));
controllers.add(new LogdSizePreferenceController(context));
controllers.add(new LogPersistPreferenceController(context, fragment, lifecycle));
diff --git a/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceController.java b/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java
similarity index 74%
rename from src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceController.java
rename to src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java
index ad2131e..2d29505 100644
--- a/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceController.java
+++ b/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java
@@ -17,7 +17,7 @@
package com.android.settings.development;
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes
- .REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP;
+ .REQUEST_CODE_GUP_DEV_OPT_IN_APPS;
import android.app.Activity;
import android.content.Context;
@@ -33,17 +33,16 @@
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
// TODO(b/119221883): Need to override isAvailable() to return false when updatable graphics driver is not supported.
-public class UpdatedGfxDriverDevOptInPreferenceController
+public class GameUpdatePackageDevOptInPreferenceController
extends DeveloperOptionsPreferenceController
implements PreferenceControllerMixin, OnActivityResultListener {
- private static final String UPDATED_GFX_DRIVER_DEV_OPT_IN_APP_KEY =
- "updated_gfx_driver_dev_opt_in_app";
+ private static final String GUP_DEV_OPT_IN_APP_KEY = "gup_dev_opt_in_app";
private final DevelopmentSettingsDashboardFragment mFragment;
private final PackageManager mPackageManager;
- public UpdatedGfxDriverDevOptInPreferenceController(Context context,
+ public GameUpdatePackageDevOptInPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
@@ -52,16 +51,15 @@
@Override
public String getPreferenceKey() {
- return UPDATED_GFX_DRIVER_DEV_OPT_IN_APP_KEY;
+ return GUP_DEV_OPT_IN_APP_KEY;
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
- if (UPDATED_GFX_DRIVER_DEV_OPT_IN_APP_KEY.equals(preference.getKey())) {
+ if (GUP_DEV_OPT_IN_APP_KEY.equals(preference.getKey())) {
// pass it on to settings
final Intent intent = getActivityStartIntent();
- mFragment.startActivityForResult(intent,
- REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP);
+ mFragment.startActivityForResult(intent, REQUEST_CODE_GUP_DEV_OPT_IN_APPS);
return true;
}
return false;
@@ -74,12 +72,12 @@
@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode != REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP
+ if (requestCode != REQUEST_CODE_GUP_DEV_OPT_IN_APPS
|| resultCode != Activity.RESULT_OK) {
return false;
}
Settings.Global.putString(mContext.getContentResolver(),
- Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, data.getAction());
+ Settings.Global.GUP_DEV_OPT_IN_APPS, data.getAction());
updatePreferenceSummary();
return true;
}
@@ -88,7 +86,7 @@
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
mPreference.setSummary(mContext.getResources().getString(
- R.string.updated_gfx_driver_dev_opt_in_app_not_set));
+ R.string.gup_dev_opt_in_app_not_set));
}
@VisibleForTesting
@@ -99,15 +97,14 @@
}
private void updatePreferenceSummary() {
- final String updatedGfxDriverDevOptInApp = Settings.Global.getString(
- mContext.getContentResolver(), Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP);
- if (updatedGfxDriverDevOptInApp != null && !updatedGfxDriverDevOptInApp.isEmpty()) {
+ final String optInApp = Settings.Global.getString(
+ mContext.getContentResolver(), Settings.Global.GUP_DEV_OPT_IN_APPS);
+ if (optInApp != null && !optInApp.isEmpty()) {
mPreference.setSummary(mContext.getResources().getString(
- R.string.updated_gfx_driver_dev_opt_in_app_set,
- getAppLabel(updatedGfxDriverDevOptInApp)));
+ R.string.gup_dev_opt_in_app_set, getAppLabel(optInApp)));
} else {
mPreference.setSummary(mContext.getResources().getString(
- R.string.updated_gfx_driver_dev_opt_in_app_not_set));
+ R.string.gup_dev_opt_in_app_not_set));
}
}
diff --git a/src/com/android/settings/display/DisplayWhiteBalancePreferenceController.java b/src/com/android/settings/display/DisplayWhiteBalancePreferenceController.java
new file mode 100644
index 0000000..f1363a3
--- /dev/null
+++ b/src/com/android/settings/display/DisplayWhiteBalancePreferenceController.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.android.settings.display;
+
+import android.content.Context;
+import android.hardware.display.ColorDisplayManager;
+import android.os.UserHandle;
+import android.provider.Settings.Secure;
+import com.android.settings.core.TogglePreferenceController;
+
+public class DisplayWhiteBalancePreferenceController extends TogglePreferenceController {
+
+ public DisplayWhiteBalancePreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return ColorDisplayManager.isDisplayWhiteBalanceAvailable(mContext) ?
+ AVAILABLE : DISABLED_FOR_USER;
+ }
+
+ @Override
+ public boolean isChecked() {
+ return Secure.getIntForUser(mContext.getContentResolver(),
+ Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0, UserHandle.USER_CURRENT) == 1;
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ Secure.putIntForUser(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED,
+ isChecked ? 1 : 0, UserHandle.USER_CURRENT);
+ return true;
+ }
+}
diff --git a/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java b/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
index 48f4cc1..3064d4f 100644
--- a/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
@@ -21,8 +21,10 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.icu.text.NumberFormat;
import android.os.BatteryManager;
import android.os.PowerManager;
+import android.text.TextUtils;
import android.widget.TextView;
import androidx.annotation.VisibleForTesting;
@@ -83,7 +85,7 @@
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
- mBatteryLayoutPref = (LayoutPreference) screen.findPreference(getPreferenceKey());
+ mBatteryLayoutPref = screen.findPreference(getPreferenceKey());
mBatteryMeterView = mBatteryLayoutPref
.findViewById(R.id.battery_header_icon);
mBatteryPercentText = mBatteryLayoutPref.findViewById(R.id.battery_percent);
@@ -107,7 +109,7 @@
}
public void updateHeaderPreference(BatteryInfo info) {
- mBatteryPercentText.setText(Utils.formatPercentage(info.batteryLevel));
+ mBatteryPercentText.setText(formatBatteryPercentageText(info.batteryLevel));
if (info.remainingLabel == null) {
mSummary1.setText(info.statusLabel);
} else {
@@ -133,6 +135,11 @@
mBatteryMeterView.setBatteryLevel(batteryLevel);
mBatteryMeterView.setCharging(!discharging);
mBatteryMeterView.setPowerSave(mPowerManager.isPowerSaveMode());
- mBatteryPercentText.setText(Utils.formatPercentage(batteryLevel));
+ mBatteryPercentText.setText(formatBatteryPercentageText(batteryLevel));
+ }
+
+ private CharSequence formatBatteryPercentageText(int batteryLevel) {
+ return TextUtils.expandTemplate(mContext.getText(R.string.battery_header_title_alternate),
+ NumberFormat.getIntegerInstance().format(batteryLevel));
}
}
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index d3f11a0..d40006f 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -19,6 +19,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.util.FeatureFlagUtils;
+import android.view.View;
import android.widget.ImageView;
import android.widget.Toolbar;
@@ -47,6 +48,7 @@
return;
}
+ updateWindowProperties();
setContentView(R.layout.settings_homepage_container);
final Toolbar toolbar = findViewById(R.id.search_action_bar);
@@ -73,4 +75,15 @@
}
fragmentTransaction.commit();
}
+
+ private void updateWindowProperties() {
+ final View decorView = getWindow().getDecorView();
+ decorView.setSystemUiVisibility(
+ decorView.getSystemUiVisibility() |
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ );
+
+ getWindow().setStatusBarColor(getResources().getColor(R.color.homepage_status_bar_color));
+ }
}
\ No newline at end of file
diff --git a/src/com/android/settings/network/telephony/WifiCallingPreferenceController.java b/src/com/android/settings/network/telephony/WifiCallingPreferenceController.java
index 48fb710..ec9a841 100644
--- a/src/com/android/settings/network/telephony/WifiCallingPreferenceController.java
+++ b/src/com/android/settings/network/telephony/WifiCallingPreferenceController.java
@@ -72,7 +72,7 @@
&& MobileNetworkUtils.isWifiCallingEnabled(mContext,
SubscriptionManager.getPhoneId(mSubId))
? AVAILABLE
- : CONDITIONALLY_UNAVAILABLE;
+ : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/slices/SlicePreference.java b/src/com/android/settings/slices/SlicePreference.java
index 98719f7..37a53f4 100644
--- a/src/com/android/settings/slices/SlicePreference.java
+++ b/src/com/android/settings/slices/SlicePreference.java
@@ -33,12 +33,17 @@
public SlicePreference(Context context, AttributeSet attrs) {
super(context, attrs, R.attr.slicePreferenceStyle);
- mSliceView = findViewById(R.id.slice_view);
+ init();
}
public SlicePreference(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, R.attr.slicePreferenceStyle);
+ super(context, attrs, defStyleAttr);
+ init();
+ }
+
+ private void init() {
mSliceView = findViewById(R.id.slice_view);
+ mSliceView.showTitleItems(true);
}
public void onSliceUpdated(Slice slice) {
diff --git a/src/com/android/settings/widget/VideoPreference.java b/src/com/android/settings/widget/VideoPreference.java
index d5d4f5e..fd215d8 100644
--- a/src/com/android/settings/widget/VideoPreference.java
+++ b/src/com/android/settings/widget/VideoPreference.java
@@ -54,6 +54,7 @@
private float mAspectRadio = 1.0f;
private int mPreviewResource;
private boolean mViewVisible;
+ private Surface mSurface;
public VideoPreference(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -68,17 +69,12 @@
.authority(context.getPackageName())
.appendPath(String.valueOf(animation))
.build();
- mMediaPlayer = MediaPlayer.create(mContext, mVideoPath);
+ mPreviewResource = attributes.getResourceId(
+ R.styleable.VideoPreference_preview, 0);
+ initMediaPlayer();
if (mMediaPlayer != null && mMediaPlayer.getDuration() > 0) {
setVisible(true);
setLayoutResource(R.layout.video_preference);
-
- mPreviewResource = attributes.getResourceId(
- R.styleable.VideoPreference_preview, 0);
-
- mMediaPlayer.setOnSeekCompleteListener(mp -> mVideoReady = true);
-
- mMediaPlayer.setOnPreparedListener(mediaPlayer -> mediaPlayer.setLooping(true));
mAnimationAvailable = true;
updateAspectRatio();
} else {
@@ -127,9 +123,8 @@
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width,
int height) {
if (mMediaPlayer != null) {
- mMediaPlayer.setSurface(new Surface(surfaceTexture));
- mVideoReady = false;
- mMediaPlayer.seekTo(0);
+ mSurface = new Surface(surfaceTexture);
+ mMediaPlayer.setSurface(mSurface);
}
}
@@ -168,26 +163,40 @@
@Override
public void onDetached() {
- if (mMediaPlayer != null) {
- mMediaPlayer.stop();
- mMediaPlayer.reset();
- mMediaPlayer.release();
- }
+ releaseMediaPlayer();
super.onDetached();
}
public void onViewVisible(boolean videoPaused) {
mViewVisible = true;
mVideoPaused = videoPaused;
- if (mVideoReady && mMediaPlayer != null && !mMediaPlayer.isPlaying()) {
- mMediaPlayer.seekTo(0);
- }
+ initMediaPlayer();
}
public void onViewInvisible() {
mViewVisible = false;
- if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
- mMediaPlayer.pause();
+ releaseMediaPlayer();
+ }
+
+ private void initMediaPlayer() {
+ if (mMediaPlayer == null) {
+ mMediaPlayer = MediaPlayer.create(mContext, mVideoPath);
+ mMediaPlayer.seekTo(0);
+ mMediaPlayer.setOnSeekCompleteListener(mp -> mVideoReady = true);
+ mMediaPlayer.setOnPreparedListener(mediaPlayer -> mediaPlayer.setLooping(true));
+ if (mSurface != null) {
+ mMediaPlayer.setSurface(mSurface);
+ }
+ }
+ }
+
+ private void releaseMediaPlayer() {
+ if (mMediaPlayer != null) {
+ mMediaPlayer.stop();
+ mMediaPlayer.reset();
+ mMediaPlayer.release();
+ mMediaPlayer = null;
+ mVideoReady = false;
}
}
@@ -197,7 +206,6 @@
@VisibleForTesting
void updateAspectRatio() {
- mAspectRadio = mMediaPlayer.getVideoWidth() / (float)mMediaPlayer.getVideoHeight();
+ mAspectRadio = mMediaPlayer.getVideoWidth() / (float) mMediaPlayer.getVideoHeight();
}
-
}
diff --git a/tests/robotests/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java
similarity index 76%
rename from tests/robotests/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java
index e92f1a5..199cad6 100644
--- a/tests/robotests/src/com/android/settings/development/UpdatedGfxDriverDevOptInPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java
@@ -16,7 +16,7 @@
package com.android.settings.development;
-import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP;
+import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_GUP_DEV_OPT_IN_APPS;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
@@ -44,7 +44,7 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
-public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
+public class GameUpdatePackageDevOptInPreferenceControllerTest {
@Mock
private PreferenceScreen mPreferenceScreen;
@@ -53,13 +53,13 @@
private Context mContext;
private Preference mPreference;
- private UpdatedGfxDriverDevOptInPreferenceController mController;
+ private GameUpdatePackageDevOptInPreferenceController mController;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
- mController = spy(new UpdatedGfxDriverDevOptInPreferenceController(mContext, mFragment));
+ mController = spy(new GameUpdatePackageDevOptInPreferenceController(mContext, mFragment));
mPreference = new Preference(mContext);
mPreference.setKey(mController.getPreferenceKey());
@@ -75,18 +75,19 @@
mController.handlePreferenceTreeClick(mPreference);
verify(mFragment).startActivityForResult(activityStartIntent,
- REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP);
+ REQUEST_CODE_GUP_DEV_OPT_IN_APPS);
}
@Test
- public void updateState_foobarAppSelected_shouldUpdateSummaryWithUpdatedDriverDevOptInAppLabel() {
+ public void updateState_foobarAppSelected_shouldUpdateSummaryWithGUPDevOptInAppLabel() {
final String selectedApp = "foobar";
final ContentResolver contentResolver = mContext.getContentResolver();
Settings.Global.putString(contentResolver,
- Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, selectedApp);
+ Settings.Global.GUP_DEV_OPT_IN_APPS, selectedApp);
mController.updateState(mPreference);
- assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_set, selectedApp));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.gup_dev_opt_in_app_set, selectedApp));
}
@Test
@@ -94,23 +95,25 @@
final String selectedApp = null;
final ContentResolver contentResolver = mContext.getContentResolver();
Settings.Global.putString(contentResolver,
- Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, selectedApp);
+ Settings.Global.GUP_DEV_OPT_IN_APPS, selectedApp);
mController.updateState(mPreference);
- assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_not_set));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.gup_dev_opt_in_app_not_set));
}
@Test
- public void onActivityResult_foobarAppSelected_shouldUpdateSummaryWithUpdatedDriverDevOptInLabel() {
+ public void onActivityResult_foobarAppSelected_shouldUpdateSummaryWithGUPDevOptInLabel() {
Intent activityResultIntent = new Intent(mContext, AppPicker.class);
final String appLabel = "foobar";
activityResultIntent.setAction(appLabel);
final boolean result = mController
- .onActivityResult(REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, Activity.RESULT_OK,
+ .onActivityResult(REQUEST_CODE_GUP_DEV_OPT_IN_APPS, Activity.RESULT_OK,
activityResultIntent);
assertThat(result).isTrue();
- assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_set, appLabel));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.gup_dev_opt_in_app_set, appLabel));
}
@Test
@@ -124,6 +127,7 @@
mController.onDeveloperOptionsSwitchDisabled();
assertThat(mPreference.isEnabled()).isFalse();
- assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_not_set));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.gup_dev_opt_in_app_not_set));
}
}
diff --git a/tests/robotests/src/com/android/settings/display/DisplayWhiteBalancePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/DisplayWhiteBalancePreferenceControllerTest.java
new file mode 100644
index 0000000..0ce72fb
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/display/DisplayWhiteBalancePreferenceControllerTest.java
@@ -0,0 +1,78 @@
+package com.android.settings.display;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.provider.Settings;
+import android.provider.Settings.Secure;
+import com.android.settings.testutils.shadow.SettingsShadowResources;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {
+ SettingsShadowResources.class
+})
+public class DisplayWhiteBalancePreferenceControllerTest {
+
+ private Context mContext;
+ private DisplayWhiteBalancePreferenceController mController;
+
+ @After
+ public void tearDown() {
+ SettingsShadowResources.reset();
+ }
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ mController = new DisplayWhiteBalancePreferenceController(mContext, "display_white_balance");
+ }
+
+ @Test
+ public void isAvailable_configuredAvailable() {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.bool.config_displayWhiteBalanceAvailable, true);
+ assertThat(mController.isAvailable()).isTrue();
+ }
+
+ @Test
+ public void isAvailable_configuredUnavailable() {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.bool.config_displayWhiteBalanceAvailable, false);
+ assertThat(mController.isAvailable()).isFalse();
+ }
+
+ @Test
+ public void setChecked_true() {
+ mController.setChecked(true);
+ assertThat(Settings.Secure
+ .getInt(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0) == 1)
+ .isTrue();
+ }
+
+ @Test
+ public void setChecked_false() {
+ mController.setChecked(false);
+ assertThat(Settings.Secure
+ .getInt(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0) == 1)
+ .isFalse();
+ }
+
+ @Test
+ public void isChecked_true() {
+ Settings.Secure.putInt(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED, 1);
+ assertThat(mController.isChecked()).isTrue();
+ }
+
+ @Test
+ public void isChecked_false() {
+ Settings.Secure.putInt(mContext.getContentResolver(), Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0);
+ assertThat(mController.isChecked()).isFalse();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
index b22821b..5be7274 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
@@ -140,8 +140,9 @@
assertThat(((BatteryMeterView) mBatteryLayoutPref.findViewById(
R.id.battery_header_icon)).getBatteryLevel()).isEqualTo(BATTERY_LEVEL);
- assertThat(((TextView) mBatteryLayoutPref.findViewById(R.id.battery_percent)).getText())
- .isEqualTo("60%");
+ assertThat(((TextView) mBatteryLayoutPref.findViewById(R.id.battery_percent))
+ .getText().toString())
+ .isEqualTo("60 %");
}
@Test
@@ -195,7 +196,7 @@
assertThat(mBatteryMeterView.getBatteryLevel()).isEqualTo(BATTERY_LEVEL);
assertThat(mBatteryMeterView.getCharging()).isTrue();
- assertThat(mBatteryPercentText.getText()).isEqualTo("60%");
+ assertThat(mBatteryPercentText.getText().toString()).isEqualTo("60 %");
assertThat(mSummary.getText()).isEqualTo(BATTERY_STATUS);
assertThat(mSummary2.getText()).isEqualTo(BATTERY_STATUS);
}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
index 452e9b1..c0b1dab 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
@@ -32,6 +32,7 @@
import com.android.ims.ImsConfig;
import com.android.ims.ImsManager;
+import com.android.settings.core.BasePreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -109,4 +110,12 @@
assertThat(mPreferenceCategory.isVisible()).isFalse();
}
+
+ @Test
+ public void getAvailabilityStatus_noWiFiCalling_shouldReturnUnsupported() {
+ mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(
+ BasePreferenceController.UNSUPPORTED_ON_DEVICE);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
index 396b9df..4cd6be4 100644
--- a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
@@ -92,4 +92,13 @@
verify(mMediaPlayer, never()).start();
}
+
+ @Test
+ public void onViewInvisible_shouldReleaseMediaplayer() {
+ mVideoPreference.onViewVisible(false);
+
+ mVideoPreference.onViewInvisible();
+
+ verify(mMediaPlayer).release();
+ }
}