summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xAndroid.bp1
-rw-r--r--apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java2
-rw-r--r--apex/jobscheduler/service/java/com/android/server/AppStateTrackerImpl.java27
-rw-r--r--apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java29
-rw-r--r--apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java2
-rw-r--r--apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java8
-rw-r--r--core/java/android/app/StatusBarManager.java2
-rw-r--r--core/java/android/app/admin/SystemUpdateInfo.java4
-rw-r--r--core/java/android/content/Intent.java9
-rw-r--r--core/java/android/os/BatteryManager.java7
-rw-r--r--core/java/android/os/FileUtils.java4
-rw-r--r--core/java/android/os/Trace.java4
-rw-r--r--core/java/android/os/UpdateEngine.java11
-rw-r--r--core/java/android/provider/Settings.java25
-rw-r--r--core/java/android/security/net/config/PinSet.java10
-rw-r--r--core/java/android/text/style/TextAppearanceSpan.java18
-rw-r--r--core/java/android/util/BoostFramework.java104
-rw-r--r--core/java/android/widget/AbsListView.java16
-rw-r--r--core/java/android/widget/TextView.java6
-rw-r--r--core/java/com/android/internal/app/ChooserActivity.java7
-rw-r--r--core/java/com/android/internal/graphics/fonts/DynamicMetrics.java151
-rw-r--r--core/java/com/android/internal/ice/hardware/HIDLHelper.java44
-rw-r--r--core/java/com/android/internal/ice/hardware/LineageHardwareManager.java259
-rw-r--r--core/java/com/android/internal/ice/hardware/TouchscreenGesture.aidl20
-rw-r--r--core/java/com/android/internal/ice/hardware/TouchscreenGesture.java78
-rw-r--r--core/java/com/android/internal/notification/SystemNotificationChannels.java2
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java22
-rw-r--r--core/java/com/android/internal/os/DeviceKeyHandler.java31
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp5
-rw-r--r--core/proto/android/server/appstatetracker.proto5
-rw-r--r--core/res/res/drawable/toast_frame.xml2
-rw-r--r--core/res/res/values/config.xml4
-rw-r--r--core/res/res/values/ice_config.xml54
-rw-r--r--core/res/res/values/ice_symbols.xml38
-rw-r--r--data/fonts/Android.bp10
-rw-r--r--data/fonts/fonts.xml132
-rw-r--r--data/keyboards/Generic.kcm2
-rw-r--r--graphics/java/android/graphics/Paint.java2
-rw-r--r--graphics/java/android/graphics/Typeface.java30
-rw-r--r--libs/hwui/Android.bp3
-rw-r--r--packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml4
-rw-r--r--packages/SettingsLib/res/drawable/ic_4g_plus_mobiledata.xml23
-rw-r--r--packages/SettingsLib/res/drawable/ic_lte_plus_mobiledata.xml27
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatteryStatus.java9
-rw-r--r--packages/SystemUI/Android.bp1
-rw-r--r--packages/SystemUI/AndroidManifest.xml4
-rw-r--r--packages/SystemUI/IceManifest.xml39
-rw-r--r--packages/SystemUI/customization/res/font/clock.xml27
-rw-r--r--packages/SystemUI/customization/res/font/google_sans_clock.ttfbin0 -> 131700 bytes
-rw-r--r--packages/SystemUI/customization/res/layout/clock_default_large.xml2
-rw-r--r--packages/SystemUI/customization/res/layout/clock_default_small.xml2
-rw-r--r--packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml2
-rw-r--r--packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.pngbin0 -> 108 bytes
-rw-r--r--packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml29
-rw-r--r--packages/SystemUI/res/drawable/dialog_tri_state_middle_bg.xml29
-rw-r--r--packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml29
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_aod.xml11
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_brightness_auto.xml35
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_brightness_auto_off.xml55
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_brightness_auto_off_avd.xml74
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_brightness_auto_on.xml56
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_brightness_auto_on_avd.xml74
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_caffeine.xml27
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_heads_up.xml36
-rw-r--r--packages/SystemUI/res/drawable/ic_speaker_group_24dp.xml22
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_airplanemode.xml25
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_alarm.xml25
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_auto_rotate.xml27
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_camera.xml25
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_cast.xml25
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_clock.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_do_not_disturb.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_ethernet.xml34
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_headset.xml25
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_hotspot.xml32
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_mobile_network.xml26
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_mute.xml26
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_priority.xml27
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_vibrate.xml26
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_wifi.xml26
-rw-r--r--packages/SystemUI/res/drawable/ic_statusbar_work.xml26
-rw-r--r--packages/SystemUI/res/drawable/ic_vpn_key.xml28
-rw-r--r--packages/SystemUI/res/drawable/stat_sys_dnd.xml4
-rw-r--r--packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml4
-rw-r--r--packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml6
-rw-r--r--packages/SystemUI/res/drawable/volume_background.xml12
-rw-r--r--packages/SystemUI/res/layout-land/volume_dialog.xml48
-rw-r--r--packages/SystemUI/res/layout/quick_settings_auto_brightness.xml26
-rw-r--r--packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml4
-rw-r--r--packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml5
-rw-r--r--packages/SystemUI/res/layout/super_notification_shade.xml2
-rw-r--r--packages/SystemUI/res/layout/tri_state_dialog.xml60
-rw-r--r--packages/SystemUI/res/layout/tuner_activity.xml7
-rw-r--r--packages/SystemUI/res/layout/udfps_view.xml6
-rw-r--r--packages/SystemUI/res/layout/volume_dialog.xml48
-rw-r--r--packages/SystemUI/res/values-land/config.xml8
-rw-r--r--packages/SystemUI/res/values-land/dimens.xml7
-rw-r--r--packages/SystemUI/res/values/attrs.xml1
-rw-r--r--packages/SystemUI/res/values/config.xml4
-rw-r--r--packages/SystemUI/res/values/dimens.xml4
-rw-r--r--packages/SystemUI/res/values/ice_config.xml22
-rw-r--r--packages/SystemUI/res/values/ice_dimens.xml42
-rw-r--r--packages/SystemUI/res/values/ice_strings.xml36
-rw-r--r--packages/SystemUI/res/values/ice_styles.xml23
-rw-r--r--packages/SystemUI/res/values/styles.xml3
-rw-r--r--packages/SystemUI/res/xml/status_bar_prefs.xml131
-rw-r--r--packages/SystemUI/res/xml/tuner_prefs.xml90
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java20
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java9
-rwxr-xr-xpackages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java7
-rw-r--r--packages/SystemUI/src/com/android/keyguard/PasswordTextView.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIService.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java159
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt31
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt18
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/flags/Flags.kt7
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt30
-rw-r--r--packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt48
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java53
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSFragment.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanel.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java37
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java163
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/CaffeineTile.java255
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java139
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java66
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleIconView.kt136
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleSlider.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java39
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java16
-rwxr-xr-xpackages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/toast/SystemUIToast.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/tristate/TriStateUiController.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/tristate/TriStateUiControllerImpl.java503
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/StatusBarTuner.java44
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java40
-rw-r--r--packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java63
-rw-r--r--packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java496
-rw-r--r--packages/overlays/Android.mk1
-rw-r--r--proto/src/metrics_constants/metrics_constants.proto3
-rw-r--r--services/core/Android.bp2
-rw-r--r--services/core/java/com/android/server/BatteryService.java32
-rw-r--r--services/core/java/com/android/server/ExtconUEventObserver.java1
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java2
-rw-r--r--services/core/java/com/android/server/UiModeManagerService.java5
-rw-r--r--services/core/java/com/android/server/WiredAccessoryManager.java4
-rw-r--r--services/core/java/com/android/server/am/ActiveServices.java125
-rw-r--r--services/core/java/com/android/server/am/UserController.java3
-rw-r--r--services/core/java/com/android/server/location/gnss/GnssLocationProvider.java10
-rwxr-xr-xservices/core/java/com/android/server/notification/NotificationManagerService.java4
-rw-r--r--services/core/java/com/android/server/notification/PreferencesHelper.java47
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java55
-rw-r--r--services/core/java/com/android/server/pm/Settings.java4
-rw-r--r--services/core/java/com/android/server/pm/ShortcutService.java2
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java8
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java67
-rw-r--r--services/core/java/com/android/server/power/Notifier.java6
-rw-r--r--services/core/java/com/android/server/textservices/TextServicesManagerService.java26
-rw-r--r--services/core/java/com/android/server/webkit/SystemImpl.java2
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java101
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java2
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskSupervisor.java26
-rw-r--r--services/core/java/com/android/server/wm/AlertWindowNotification.java15
-rw-r--r--services/core/java/com/android/server/wm/RemoteDisplayChangeController.java10
-rw-r--r--services/core/java/com/android/server/wm/Session.java3
-rw-r--r--services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java4
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java2
192 files changed, 5296 insertions, 827 deletions
diff --git a/Android.bp b/Android.bp
index 429a0c471645..1762197eb9ed 100755
--- a/Android.bp
+++ b/Android.bp
@@ -246,6 +246,7 @@ java_library {
"com.android.sysprop.init",
"com.android.sysprop.localization",
"PlatformProperties",
+ "vendor.lineage.touch-V1.0-java",
],
sdk_version: "core_platform",
installable: false,
diff --git a/apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java b/apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java
index caf7e7f4a4ed..7ec603de40fd 100644
--- a/apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java
+++ b/apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java
@@ -73,6 +73,8 @@ public interface DeviceIdleInternal {
boolean isAppOnWhitelist(int appid);
+ int[] getPowerSaveWhitelistSystemAppIds();
+
int[] getPowerSaveWhitelistUserAppIds();
int[] getPowerSaveTempWhitelistAppIds();
diff --git a/apex/jobscheduler/service/java/com/android/server/AppStateTrackerImpl.java b/apex/jobscheduler/service/java/com/android/server/AppStateTrackerImpl.java
index fab5b5fd6933..606f0df0dfda 100644
--- a/apex/jobscheduler/service/java/com/android/server/AppStateTrackerImpl.java
+++ b/apex/jobscheduler/service/java/com/android/server/AppStateTrackerImpl.java
@@ -109,6 +109,12 @@ public class AppStateTrackerImpl implements AppStateTracker {
final SparseBooleanArray mActiveUids = new SparseBooleanArray();
/**
+ * System exemption list in the device idle controller.
+ */
+ @GuardedBy("mLock")
+ private int[] mPowerExemptSystemAppIds = new int[0];
+
+ /**
* System except-idle + user exemption list in the device idle controller.
*/
@GuardedBy("mLock")
@@ -1075,6 +1081,7 @@ public class AppStateTrackerImpl implements AppStateTracker {
* Called by device idle controller to update the power save exemption lists.
*/
public void setPowerSaveExemptionListAppIds(
+ int[] powerSaveExemptionListSystemAppIdArray,
int[] powerSaveExemptionListExceptIdleAppIdArray,
int[] powerSaveExemptionListUserAppIdArray,
int[] tempExemptionListAppIdArray) {
@@ -1082,6 +1089,7 @@ public class AppStateTrackerImpl implements AppStateTracker {
final int[] previousExemptionList = mPowerExemptAllAppIds;
final int[] previousTempExemptionList = mTempExemptAppIds;
+ mPowerExemptSystemAppIds = powerSaveExemptionListSystemAppIdArray;
mPowerExemptAllAppIds = powerSaveExemptionListExceptIdleAppIdArray;
mTempExemptAppIds = tempExemptionListAppIdArray;
mPowerExemptUserAppIds = powerSaveExemptionListUserAppIdArray;
@@ -1302,6 +1310,18 @@ public class AppStateTrackerImpl implements AppStateTracker {
}
/**
+ * @return whether or not a UID is in either the user defined power-save exemption list or the
+ system full exemption list (not including except-idle)
+ */
+ public boolean isUidPowerSaveIdleExempt(int uid) {
+ final int appId = UserHandle.getAppId(uid);
+ synchronized (mLock) {
+ return ArrayUtils.contains(mPowerExemptUserAppIds, appId)
+ || ArrayUtils.contains(mPowerExemptSystemAppIds, appId);
+ }
+ }
+
+ /**
* @return whether a UID is in the temp power-save exemption list or not.
*
* Note clients normally shouldn't need to access it. It's only for dumpsys.
@@ -1338,6 +1358,9 @@ public class AppStateTrackerImpl implements AppStateTracker {
pw.print("Active uids: ");
dumpUids(pw, mActiveUids);
+ pw.print("System exemption list appids: ");
+ pw.println(Arrays.toString(mPowerExemptSystemAppIds));
+
pw.print("Except-idle + user exemption list appids: ");
pw.println(Arrays.toString(mPowerExemptAllAppIds));
@@ -1415,6 +1438,10 @@ public class AppStateTrackerImpl implements AppStateTracker {
}
}
+ for (int appId : mPowerExemptSystemAppIds) {
+ proto.write(AppStateTrackerProto.POWER_SAVE_SYSTEM_EXEMPT_APP_IDS, appId);
+ }
+
for (int appId : mPowerExemptAllAppIds) {
proto.write(AppStateTrackerProto.POWER_SAVE_EXEMPT_APP_IDS, appId);
}
diff --git a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
index 40d1b4c9b267..40a51bd3470a 100644
--- a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
+++ b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
@@ -563,6 +563,12 @@ public class DeviceIdleController extends SystemService
private final SparseBooleanArray mPowerSaveWhitelistSystemAppIds = new SparseBooleanArray();
/**
+ * Current system app IDs that are in the complete power save white list. This array can
+ * be shared with others because it will not be modified once set.
+ */
+ private int[] mPowerSaveWhitelistSystemAppIdArray = new int[0];
+
+ /**
* App IDs that have been white-listed to opt out of power save restrictions, except
* for device idle modes.
*/
@@ -2089,6 +2095,11 @@ public class DeviceIdleController extends SystemService
return DeviceIdleController.this.isAppOnWhitelistInternal(appid);
}
+ @Override
+ public int[] getPowerSaveWhitelistSystemAppIds() {
+ return DeviceIdleController.this.getPowerSaveSystemWhitelistAppIds();
+ }
+
/**
* Returns the array of app ids whitelisted by user. Take care not to
* modify this, as it is a reference to the original copy. But the reference
@@ -2271,6 +2282,12 @@ public class DeviceIdleController extends SystemService
}
}
+ int[] getPowerSaveSystemWhitelistAppIds() {
+ synchronized (this) {
+ return mPowerSaveWhitelistSystemAppIdArray;
+ }
+ }
+
int[] getPowerSaveWhitelistUserAppIds() {
synchronized (this) {
return mPowerSaveWhitelistUserAppIdArray;
@@ -2281,6 +2298,16 @@ public class DeviceIdleController extends SystemService
return new File(Environment.getDataDirectory(), "system");
}
+ /** Returns the keys of a SparseBooleanArray, paying no attention to its values. */
+ private static int[] keysToIntArray(final SparseBooleanArray sparseArray) {
+ final int size = sparseArray.size();
+ final int[] array = new int[size];
+ for (int i = 0; i < size; i++) {
+ array[i] = sparseArray.keyAt(i);
+ }
+ return array;
+ }
+
@Override
public void onStart() {
final PackageManager pm = getContext().getPackageManager();
@@ -2317,6 +2344,7 @@ public class DeviceIdleController extends SystemService
} catch (PackageManager.NameNotFoundException e) {
}
}
+ mPowerSaveWhitelistSystemAppIdArray = keysToIntArray(mPowerSaveWhitelistSystemAppIds);
mConstants = mInjector.getConstants(this);
@@ -4222,6 +4250,7 @@ public class DeviceIdleController extends SystemService
private void passWhiteListsToForceAppStandbyTrackerLocked() {
mAppStateTracker.setPowerSaveExemptionListAppIds(
+ mPowerSaveWhitelistSystemAppIdArray,
mPowerSaveWhitelistExceptIdleAppIdArray,
mPowerSaveWhitelistUserAppIdArray,
mTempWhitelistAppIdArray);
diff --git a/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java b/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java
index f1a39310e2f8..3672d369dd66 100644
--- a/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java
@@ -2861,7 +2861,7 @@ public class AlarmManagerService extends SystemService {
} else if (workSource == null && (UserHandle.isCore(callingUid)
|| UserHandle.isSameApp(callingUid, mSystemUiUid)
|| ((mAppStateTracker != null)
- && mAppStateTracker.isUidPowerSaveUserExempt(callingUid)))) {
+ && mAppStateTracker.isUidPowerSaveIdleExempt(callingUid)))) {
flags |= FLAG_ALLOW_WHILE_IDLE_UNRESTRICTED;
flags &= ~(FLAG_ALLOW_WHILE_IDLE | FLAG_PRIORITIZE);
}
diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java
index abbe177c5d49..01f0b30cc48a 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java
@@ -74,6 +74,7 @@ public final class DeviceIdleJobsController extends StateController {
* True when in device idle mode, so we don't want to schedule any jobs.
*/
private boolean mDeviceIdleMode;
+ private int[] mPowerSaveWhitelistSystemAppIds;
private int[] mDeviceIdleWhitelistAppIds;
private int[] mPowerSaveTempWhitelistAppIds;
@@ -133,6 +134,8 @@ public final class DeviceIdleJobsController extends StateController {
mLocalDeviceIdleController =
LocalServices.getService(DeviceIdleInternal.class);
mDeviceIdleWhitelistAppIds = mLocalDeviceIdleController.getPowerSaveWhitelistUserAppIds();
+ mPowerSaveWhitelistSystemAppIds =
+ mLocalDeviceIdleController.getPowerSaveWhitelistSystemAppIds();
mPowerSaveTempWhitelistAppIds =
mLocalDeviceIdleController.getPowerSaveTempWhitelistAppIds();
mDeviceIdleUpdateFunctor = new DeviceIdleUpdateFunctor();
@@ -196,8 +199,9 @@ public final class DeviceIdleJobsController extends StateController {
* Checks if the given job's scheduling app id exists in the device idle user whitelist.
*/
boolean isWhitelistedLocked(JobStatus job) {
- return Arrays.binarySearch(mDeviceIdleWhitelistAppIds,
- UserHandle.getAppId(job.getSourceUid())) >= 0;
+ final int appId = UserHandle.getAppId(job.getSourceUid());
+ return Arrays.binarySearch(mDeviceIdleWhitelistAppIds, appId) >= 0
+ || Arrays.binarySearch(mPowerSaveWhitelistSystemAppIds, appId) >= 0;
}
/**
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index 3c0a724b9ff7..5bde079d085e 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -231,6 +231,8 @@ public class StatusBarManager {
public static final int CAMERA_LAUNCH_SOURCE_LIFT_TRIGGER = 2;
/** @hide */
public static final int CAMERA_LAUNCH_SOURCE_QUICK_AFFORDANCE = 3;
+ /** @hide */
+ public static final int CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE = 4;
/**
* Session flag for {@link #registerSessionListener} indicating the listener
diff --git a/core/java/android/app/admin/SystemUpdateInfo.java b/core/java/android/app/admin/SystemUpdateInfo.java
index b88bf76c96ca..fdf2b3f54311 100644
--- a/core/java/android/app/admin/SystemUpdateInfo.java
+++ b/core/java/android/app/admin/SystemUpdateInfo.java
@@ -132,7 +132,7 @@ public final class SystemUpdateInfo implements Parcelable {
out.startTag(null, tag);
out.attributeLong(null, ATTR_RECEIVED_TIME, mReceivedTime);
out.attributeInt(null, ATTR_SECURITY_PATCH_STATE, mSecurityPatchState);
- out.attribute(null, ATTR_ORIGINAL_BUILD , Build.FINGERPRINT);
+ out.attribute(null, ATTR_ORIGINAL_BUILD , Build.VERSION.INCREMENTAL);
out.endTag(null, tag);
}
@@ -141,7 +141,7 @@ public final class SystemUpdateInfo implements Parcelable {
public static SystemUpdateInfo readFromXml(TypedXmlPullParser parser) {
// If an OTA has been applied (build fingerprint has changed), discard stale info.
final String buildFingerprint = parser.getAttributeValue(null, ATTR_ORIGINAL_BUILD );
- if (!Build.FINGERPRINT.equals(buildFingerprint)) {
+ if (!Build.VERSION.INCREMENTAL.equals(buildFingerprint)) {
return null;
}
try {
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 7e2bb0bb1eb4..c1f97b472dd2 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -5091,6 +5091,15 @@ public class Intent implements Parcelable, Cloneable {
public static final String ACTION_SHOW_FOREGROUND_SERVICE_MANAGER =
"android.intent.action.SHOW_FOREGROUND_SERVICE_MANAGER";
+ /**
+ * Broadcast action: notify the system that the user has performed a gesture on the screen
+ * to launch the camera. Broadcast should be protected to receivers holding the
+ * {@link Manifest.permission#STATUS_BAR_SERVICE} permission.
+ * @hide
+ */
+ public static final String ACTION_SCREEN_CAMERA_GESTURE =
+ "android.intent.action.SCREEN_CAMERA_GESTURE";
+
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Standard intent categories (see addCategory()).
diff --git a/core/java/android/os/BatteryManager.java b/core/java/android/os/BatteryManager.java
index 76f857bd91b7..f0b251f66022 100644
--- a/core/java/android/os/BatteryManager.java
+++ b/core/java/android/os/BatteryManager.java
@@ -163,6 +163,13 @@ public class BatteryManager {
@SystemApi
public static final String EXTRA_EVENT_TIMESTAMP = "android.os.extra.EVENT_TIMESTAMP";
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * boolean value to indicate OEM fast charging
+ * {@hide}
+ */
+ public static final String EXTRA_OEM_FAST_CHARGER = "oem_fast_charger";
+
// values for "status" field in the ACTION_BATTERY_CHANGED Intent
public static final int BATTERY_STATUS_UNKNOWN = Constants.BATTERY_STATUS_UNKNOWN;
public static final int BATTERY_STATUS_CHARGING = Constants.BATTERY_STATUS_CHARGING;
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java
index edfcb3d6f12a..0621ebc9d942 100644
--- a/core/java/android/os/FileUtils.java
+++ b/core/java/android/os/FileUtils.java
@@ -1299,11 +1299,13 @@ public final class FileUtils {
public static long roundStorageSize(long size) {
long val = 1;
long pow = 1;
- while ((val * pow) < size) {
+ long pow1024 = 1;
+ while ((val * pow1024) < size) {
val <<= 1;
if (val > 512) {
val = 1;
pow *= 1000;
+ pow1024 *= 1024;
}
}
return val * pow;
diff --git a/core/java/android/os/Trace.java b/core/java/android/os/Trace.java
index ca3433764308..5839027dd4d4 100644
--- a/core/java/android/os/Trace.java
+++ b/core/java/android/os/Trace.java
@@ -161,6 +161,10 @@ public final class Trace {
@UnsupportedAppUsage
@SystemApi(client = MODULE_LIBRARIES)
public static boolean isTagEnabled(long traceTag) {
+ if (!Build.IS_DEBUGGABLE) {
+ return false;
+ }
+
long tags = nativeGetEnabledTags();
return (tags & traceTag) != 0;
}
diff --git a/core/java/android/os/UpdateEngine.java b/core/java/android/os/UpdateEngine.java
index b7e3068a437c..16bb78e345ba 100644
--- a/core/java/android/os/UpdateEngine.java
+++ b/core/java/android/os/UpdateEngine.java
@@ -462,6 +462,17 @@ public class UpdateEngine {
}
/**
+ * @hide
+ */
+ public void setPerformanceMode(boolean enable) {
+ try {
+ mUpdateEngine.setPerformanceMode(enable);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Unbinds the last bound callback function.
*/
public boolean unbind() {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 5b1006b8c024..966438325efa 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -5155,6 +5155,12 @@ public final class Settings {
public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
/**
+ * Whether or not to vibrate when a touchscreen gesture is detected
+ * @hide
+ */
+ public static final String TOUCHSCREEN_GESTURE_HAPTIC_FEEDBACK = "touchscreen_gesture_haptic_feedback";
+
+ /**
* Control whether the accelerometer will be used to change screen
* orientation. If 0, it will not be used unless explicitly requested
* by the application; if 1, it will be used by default unless explicitly
@@ -5517,6 +5523,12 @@ public final class Settings {
public static final String DESKTOP_MODE = "desktop_mode";
/**
+ * Whether to play the camera shutter sound on taking a screenshot.
+ * @hide
+ */
+ public static final String SCREENSHOT_SHUTTER_SOUND = "screenshot_shutter_sound";
+
+ /**
* IMPORTANT: If you add a new public settings you also have to add it to
* PUBLIC_SETTINGS below. If the new setting is hidden you have to add
* it to PRIVATE_SETTINGS below. Also add a validator that can validate
@@ -11205,6 +11217,19 @@ public final class Settings {
public static void setLocationProviderEnabled(ContentResolver cr,
String provider, boolean enabled) {
}
+
+ /**
+ * Controls whether double tap to sleep is enabled.
+ * @hide
+ */
+ @Readable
+ public static final String DOUBLE_TAP_SLEEP_GESTURE = "double_tap_sleep_gesture";
+
+ /**
+ * Whether to show swipe up hint in gestural nav mode
+ * @hide
+ */
+ public static final String NAVIGATION_BAR_HINT = "navigation_bar_hint";
}
/**
diff --git a/core/java/android/security/net/config/PinSet.java b/core/java/android/security/net/config/PinSet.java
index d3c975eb3101..e1942e513510 100644
--- a/core/java/android/security/net/config/PinSet.java
+++ b/core/java/android/security/net/config/PinSet.java
@@ -19,6 +19,7 @@ package android.security.net.config;
import android.util.ArraySet;
import java.util.Collections;
import java.util.Set;
+import java.util.stream.Collectors;
/** @hide */
public final class PinSet {
@@ -26,6 +27,7 @@ public final class PinSet {
new PinSet(Collections.<Pin>emptySet(), Long.MAX_VALUE);
public final long expirationTime;
public final Set<Pin> pins;
+ private final Set<String> algorithms;
public PinSet(Set<Pin> pins, long expirationTime) {
if (pins == null) {
@@ -33,14 +35,12 @@ public final class PinSet {
}
this.pins = pins;
this.expirationTime = expirationTime;
+ this.algorithms = pins.stream()
+ .map(pin -> pin.digestAlgorithm)
+ .collect(Collectors.toCollection(ArraySet::new));
}
Set<String> getPinAlgorithms() {
- // TODO: Cache this.
- Set<String> algorithms = new ArraySet<String>();
- for (Pin pin : pins) {
- algorithms.add(pin.digestAlgorithm);
- }
return algorithms;
}
}
diff --git a/core/java/android/text/style/TextAppearanceSpan.java b/core/java/android/text/style/TextAppearanceSpan.java
index adb379a397b7..0987142e3973 100644
--- a/core/java/android/text/style/TextAppearanceSpan.java
+++ b/core/java/android/text/style/TextAppearanceSpan.java
@@ -29,6 +29,8 @@ import android.text.ParcelableSpan;
import android.text.TextPaint;
import android.text.TextUtils;
+import com.android.internal.graphics.fonts.DynamicMetrics;
+
/**
* Sets the text appearance using the given
* {@link android.R.styleable#TextAppearance TextAppearance} attributes.
@@ -487,17 +489,17 @@ public class TextAppearanceSpan extends MetricAffectingSpan implements Parcelabl
styledTypeface = null;
}
+ Typeface finalTypeface = null;
if (styledTypeface != null) {
- final Typeface readyTypeface;
if (mTextFontWeight >= 0) {
final int weight = Math.min(FontStyle.FONT_WEIGHT_MAX, mTextFontWeight);
final boolean italic = (style & Typeface.ITALIC) != 0;
- readyTypeface = ds.setTypeface(Typeface.create(styledTypeface, weight, italic));
+ finalTypeface = ds.setTypeface(Typeface.create(styledTypeface, weight, italic));
} else {
- readyTypeface = styledTypeface;
+ finalTypeface = styledTypeface;
}
- int fake = style & ~readyTypeface.getStyle();
+ int fake = style & ~finalTypeface.getStyle();
if ((fake & Typeface.BOLD) != 0) {
ds.setFakeBoldText(true);
@@ -507,7 +509,7 @@ public class TextAppearanceSpan extends MetricAffectingSpan implements Parcelabl
ds.setTextSkewX(-0.25f);
}
- ds.setTypeface(readyTypeface);
+ ds.setTypeface(finalTypeface);
}
if (mTextSize > 0) {
@@ -526,6 +528,12 @@ public class TextAppearanceSpan extends MetricAffectingSpan implements Parcelabl
ds.setLetterSpacing(mLetterSpacing);
}
+ if ((!mHasLetterSpacing || mLetterSpacing == 0.0f) &&
+ mTextSize > 0 && finalTypeface != null &&
+ finalTypeface.isSystemFont()) {
+ ds.setLetterSpacing(DynamicMetrics.calcTracking(mTextSize));
+ }
+
if (mFontFeatureSettings != null) {
ds.setFontFeatureSettings(mFontFeatureSettings);
}
diff --git a/core/java/android/util/BoostFramework.java b/core/java/android/util/BoostFramework.java
index bcd50d9e9b36..8dedc080ee7d 100644
--- a/core/java/android/util/BoostFramework.java
+++ b/core/java/android/util/BoostFramework.java
@@ -30,6 +30,7 @@
package android.util;
import android.content.Context;
+import android.content.res.Resources;
import android.graphics.BLASTBufferQueue;
import android.os.SystemProperties;
import android.util.Log;
@@ -68,7 +69,6 @@ public class BoostFramework {
private static Method sperfHintAcqRelFunc = null;
private static Method sperfHintRenewFunc = null;
private static Method sPerfEventFunc = null;
- private static Method sPerfGetPerfHalVerFunc = null;
private static Method sPerfSyncRequest = null;
private static Method sIOPStart = null;
@@ -80,6 +80,9 @@ public class BoostFramework {
private static Class<?> sUxPerfClass = null;
private static Method sUxIOPStart = null;
+ private static final boolean sIsSupported = Resources.getSystem().getBoolean(
+ com.android.internal.R.bool.config_supportsBoostFramework);
+
/** @hide */
private Object mPerf = null;
private Object mUxPerf = null;
@@ -240,7 +243,7 @@ public class BoostFramework {
private void initFunctions () {
synchronized(BoostFramework.class) {
- if (sIsLoaded == false) {
+ if (sIsSupported && sIsLoaded == false) {
try {
sPerfClass = Class.forName(PERFORMANCE_CLASS);
@@ -289,15 +292,6 @@ public class BoostFramework {
sperfHintRenewFunc = sPerfClass.getMethod("perfHintRenew", argClasses);
try {
- argClasses = new Class[] {};
- sPerfGetPerfHalVerFunc = sPerfClass.getMethod("perfGetHalVer", argClasses);
-
- } catch (Exception e) {
- Log.i(TAG, "BoostFramework() : Exception_1 = perfGetHalVer not supported");
- sPerfGetPerfHalVerFunc = null;
- }
-
- try {
argClasses = new Class[] {int.class, int.class, String.class, int.class, String.class};
sUXEngineEvents = sPerfClass.getDeclaredMethod("perfUXEngine_events",
argClasses);
@@ -334,6 +328,9 @@ public class BoostFramework {
/** @hide */
public int perfLockAcquire(int duration, int... list) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sAcquireFunc != null) {
Object retVal = sAcquireFunc.invoke(mPerf, duration, list);
@@ -348,6 +345,9 @@ public class BoostFramework {
/** @hide */
public int perfLockRelease() {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sReleaseFunc != null) {
Object retVal = sReleaseFunc.invoke(mPerf);
@@ -362,6 +362,9 @@ public class BoostFramework {
/** @hide */
public int perfLockReleaseHandler(int handle) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sReleaseHandlerFunc != null) {
Object retVal = sReleaseHandlerFunc.invoke(mPerf, handle);
@@ -386,6 +389,9 @@ public class BoostFramework {
/** @hide */
public int perfHint(int hint, String userDataStr, int userData1, int userData2) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sPerfHintFunc != null) {
Object retVal = sPerfHintFunc.invoke(mPerf, hint, userDataStr, userData1, userData2);
@@ -400,20 +406,15 @@ public class BoostFramework {
/** @hide */
public double getPerfHalVersion() {
double retVal = PERF_HAL_V22;
- try {
- if (sPerfGetPerfHalVerFunc != null) {
- Object ret = sPerfGetPerfHalVerFunc.invoke(mPerf);
- retVal = (double)ret;
- }
- } catch(Exception e) {
- Log.e(TAG,"Exception " + e);
- }
return retVal;
}
/** @hide */
public int perfGetFeedback(int req, String pkg_name) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sFeedbackFunc != null) {
Object retVal = sFeedbackFunc.invoke(mPerf, req, pkg_name);
@@ -428,6 +429,9 @@ public class BoostFramework {
/** @hide */
public int perfGetFeedbackExtn(int req, String pkg_name, int numArgs, int... list) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sFeedbackFuncExtn != null) {
Object retVal = sFeedbackFuncExtn.invoke(mPerf, req, pkg_name, numArgs, list);
@@ -442,6 +446,9 @@ public class BoostFramework {
/** @hide */
public int perfIOPrefetchStart(int pid, String pkgName, String codePath) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
Object retVal = sIOPStart.invoke(mPerf, pid, pkgName, codePath);
ret = (int) retVal;
@@ -461,6 +468,9 @@ public class BoostFramework {
/** @hide */
public int perfIOPrefetchStop() {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
Object retVal = sIOPStop.invoke(mPerf);
ret = (int) retVal;
@@ -478,6 +488,9 @@ public class BoostFramework {
/** @hide */
public int perfUXEngine_events(int opcode, int pid, String pkgName, int lat, String codePath) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sUXEngineEvents == null) {
return ret;
@@ -495,6 +508,9 @@ public class BoostFramework {
/** @hide */
public String perfUXEngine_trigger(int opcode) {
String ret = null;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sUXEngineTrigger == null) {
return ret;
@@ -510,6 +526,9 @@ public class BoostFramework {
/** @hide */
public String perfSyncRequest(int opcode) {
String ret = null;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sPerfSyncRequest == null) {
return ret;
@@ -525,6 +544,9 @@ public class BoostFramework {
/** @hide */
public String perfGetProp(String prop_name, String def_val) {
String ret = "";
+ if (!sIsSupported) {
+ return def_val;
+ }
try {
if (sPerfGetPropFunc != null) {
Object retVal = sPerfGetPropFunc.invoke(mPerf, prop_name, def_val);
@@ -541,6 +563,9 @@ public class BoostFramework {
/** @hide */
public int perfLockAcqAndRelease(int handle, int duration, int numArgs,int reserveNumArgs, int... list) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sAcqAndReleaseFunc != null) {
Object retVal = sAcqAndReleaseFunc.invoke(mPerf, handle, duration, numArgs, reserveNumArgs, list);
@@ -559,6 +584,9 @@ public class BoostFramework {
/** @hide */
public void perfEvent(int eventId, String pkg_name, int numArgs, int... list) {
+ if (!sIsSupported) {
+ return;
+ }
try {
if (sPerfEventFunc != null) {
sPerfEventFunc.invoke(mPerf, eventId, pkg_name, numArgs, list);
@@ -587,6 +615,9 @@ public class BoostFramework {
public int perfHintAcqRel(int handle, int hint, String pkg_name, int duration,
int hintType, int numArgs, int... list) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sperfHintAcqRelFunc != null) {
Object retVal = sperfHintAcqRelFunc.invoke(mPerf,handle, hint, pkg_name,
@@ -618,6 +649,9 @@ public class BoostFramework {
public int perfHintRenew(int handle, int hint, String pkg_name, int duration,
int hintType, int numArgs, int... list) {
int ret = -1;
+ if (!sIsSupported) {
+ return ret;
+ }
try {
if (sperfHintRenewFunc != null) {
Object retVal = sperfHintRenewFunc.invoke(mPerf,handle, hint, pkg_name,
@@ -657,7 +691,7 @@ public class BoostFramework {
private static Method sGetAdjustedAnimationClock = null;
private static void initQXPerfFuncs() {
- if (sQXIsLoaded) return;
+ if (!sIsSupported || sQXIsLoaded) return;
try {
sScrollOptProp = SystemProperties.getBoolean(SCROLL_OPT_PROP, false);
@@ -712,6 +746,9 @@ public class BoostFramework {
/** @hide */
public static void setFrameInterval(long frameIntervalNanos) {
+ if (!sIsSupported) {
+ return;
+ }
if (sQXIsLoaded) {
if (sScrollOptEnable && sSetFrameInterval != null) {
try {
@@ -744,6 +781,9 @@ public class BoostFramework {
/** @hide */
public static void disableOptimizer(boolean disabled) {
+ if (!sIsSupported) {
+ return;
+ }
if (sScrollOptEnable && sDisableOptimizer != null) {
try {
sDisableOptimizer.invoke(null, disabled);
@@ -755,6 +795,9 @@ public class BoostFramework {
/** @hide */
public static void setBLASTBufferQueue(BLASTBufferQueue blastBufferQueue) {
+ if (!sIsSupported) {
+ return;
+ }
if (sScrollOptEnable && sSetBLASTBufferQueue != null) {
try {
sSetBLASTBufferQueue.invoke(null, blastBufferQueue);
@@ -766,6 +809,9 @@ public class BoostFramework {
/** @hide */
public static void setMotionType(int eventType) {
+ if (!sIsSupported) {
+ return;
+ }
if (sScrollOptEnable && sSetMotionType != null) {
try {
sSetMotionType.invoke(null, eventType);
@@ -777,6 +823,9 @@ public class BoostFramework {
/** @hide */
public static void setVsyncTime(long vsyncTimeNanos) {
+ if (!sIsSupported) {
+ return;
+ }
if (sScrollOptEnable && sSetVsyncTime != null) {
try {
sSetVsyncTime.invoke(null, vsyncTimeNanos);
@@ -788,6 +837,9 @@ public class BoostFramework {
/** @hide */
public static void setUITaskStatus(boolean running) {
+ if (!sIsSupported) {
+ return;
+ }
if (sScrollOptEnable && sSetUITaskStatus != null) {
try {
sSetUITaskStatus.invoke(null, running);
@@ -799,6 +851,9 @@ public class BoostFramework {
/** @hide */
public static void setFlingFlag(int flag) {
+ if (!sIsSupported) {
+ return;
+ }
if (sScrollOptEnable && sSetFlingFlag != null) {
try {
sSetFlingFlag.invoke(null, flag);
@@ -811,6 +866,9 @@ public class BoostFramework {
/** @hide */
public static boolean shouldUseVsync(boolean defaultVsyncFlag) {
boolean useVsync = defaultVsyncFlag;
+ if (!sIsSupported) {
+ return useVsync;
+ }
if (sScrollOptEnable && sShouldUseVsync != null) {
try {
Object retVal = sShouldUseVsync.invoke(null);
@@ -825,6 +883,9 @@ public class BoostFramework {
/** @hide */
public static long getFrameDelay(long defaultDelay, long lastFrameTimeNanos) {
long frameDelay = defaultDelay;
+ if (!sIsSupported) {
+ return frameDelay;
+ }
if (sScrollOptEnable && sGetFrameDelay != null) {
try {
Object retVal = sGetFrameDelay.invoke(null, lastFrameTimeNanos);
@@ -839,6 +900,9 @@ public class BoostFramework {
/** @hide */
public static long getAdjustedAnimationClock(long frameTimeNanos) {
long newFrameTimeNanos = frameTimeNanos;
+ if (!sIsSupported) {
+ return newFrameTimeNanos;
+ }
if (sScrollOptEnable && sGetAdjustedAnimationClock != null) {
try {
Object retVal = sGetAdjustedAnimationClock.invoke(null,
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 1926978b933c..2c2cdca45d9a 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -689,6 +689,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
private int mMinimumVelocity;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 124051740)
private int mMaximumVelocity;
+ private int mDecacheThreshold;
private float mVelocityScale = 1.0f;
final boolean[] mIsScrap = new boolean[1];
@@ -1017,6 +1018,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
+ mDecacheThreshold = mMaximumVelocity / 2;
mOverscrollDistance = configuration.getScaledOverscrollDistance();
mOverflingDistance = configuration.getScaledOverflingDistance();
@@ -4890,7 +4892,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
// Keep the fling alive a little longer
postDelayed(this, FLYWHEEL_TIMEOUT);
} else {
- endFling();
+ endFling(false); // Don't disable the scrolling cache right after it was enabled
mTouchMode = TOUCH_MODE_SCROLL;
reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
}
@@ -4906,6 +4908,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
// Use AbsListView#fling(int) instead
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
void start(int initialVelocity) {
+ if (Math.abs(initialVelocity) > mDecacheThreshold) {
+ // For long flings, scrolling cache causes stutter, so don't use it
+ clearScrollingCache();
+ }
+
int initialY = initialVelocity < 0 ? Integer.MAX_VALUE : 0;
mLastFlingY = initialY;
mScroller.setInterpolator(null);
@@ -4986,6 +4993,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
// To interrupt a fling early you should use smoothScrollBy(0,0) instead
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
void endFling() {
+ endFling(true);
+ }
+
+ void endFling(boolean clearCache) {
mTouchMode = TOUCH_MODE_REST;
removeCallbacks(this);
@@ -4994,7 +5005,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
if (!mSuppressIdleStateChangeCall) {
reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
}
- clearScrollingCache();
+ if (clearCache)
+ clearScrollingCache();
mScroller.abortAnimation();
if (mFlingStrictSpan != null) {
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 7d59d26b5121..1c4a770b0a7a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -206,6 +206,7 @@ import android.widget.RemoteViews.RemoteView;
import com.android.internal.accessibility.util.AccessibilityUtils;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.graphics.fonts.DynamicMetrics;
import com.android.internal.inputmethod.EditableInputConnection;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -4270,6 +4271,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
setLetterSpacing(attributes.mLetterSpacing);
}
+ if ((!attributes.mHasLetterSpacing || attributes.mLetterSpacing == 0.0f) &&
+ DynamicMetrics.shouldModifyFont(mTextPaint.getTypeface())) {
+ setLetterSpacing(DynamicMetrics.calcTracking(mTextPaint.getTextSize()));
+ }
+
if (attributes.mFontFeatureSettings != null) {
setFontFeatureSettings(attributes.mFontFeatureSettings);
}
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 0a778a6538c3..d5f110a05363 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -1416,15 +1416,18 @@ public class ChooserActivity extends ResolverActivity implements
final ViewGroup actionRow =
(ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row);
+ String action = targetIntent.getAction();
+
//TODO: addActionButton(actionRow, createCopyButton());
if (shouldNearbyShareBeIncludedAsActionButton()) {
addActionButton(actionRow, createNearbyButton(targetIntent));
}
- addActionButton(actionRow, createEditButton(targetIntent));
+ if (!Intent.ACTION_SEND_MULTIPLE.equals(action)) {
+ addActionButton(actionRow, createEditButton(targetIntent));
+ }
mPreviewCoord = new ContentPreviewCoordinator(contentPreviewLayout, false);
- String action = targetIntent.getAction();
if (Intent.ACTION_SEND.equals(action)) {
Uri uri = targetIntent.getParcelableExtra(Intent.EXTRA_STREAM);
if (!validForContentPreview(uri)) {
diff --git a/core/java/com/android/internal/graphics/fonts/DynamicMetrics.java b/core/java/com/android/internal/graphics/fonts/DynamicMetrics.java
new file mode 100644
index 000000000000..5d723fd5f364
--- /dev/null
+++ b/core/java/com/android/internal/graphics/fonts/DynamicMetrics.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2022 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.internal.graphics.fonts;
+
+import android.app.ActivityThread;
+import android.content.ComponentCallbacks;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.graphics.Typeface;
+
+public class DynamicMetrics {
+ // https://rsms.me/inter/dynmetrics/
+ private static final float A = -0.0223f;
+ private static final float B = 0.185f;
+ private static final float C = -0.1745f;
+
+ private static float sDensity = 0.0f;
+
+ // Precalculated tracking LUT up to 32 dp, in steps of 0.5 dp to minimize rounding errors.
+ // Sizes are close enough that we can cast them to ints for lookup.
+ // In most cases, we should never have to calculate tracking at runtime because of this.
+ private static final float[] TRACKING_LUT = {
+ /* 0.0dp */ 0.1627f,
+ /* 0.5dp */ 0.147242871675558f,
+ /* 1.0dp */ 0.1330772180324039f,
+ /* 1.5dp */ 0.12009513371985438f,
+ /* 2.0dp */ 0.10819772909994156f,
+ /* 2.5dp */ 0.09729437696617904f,
+ /* 3.0dp */ 0.08730202220051463f,
+ /* 3.5dp */ 0.0781445491098568f,
+ /* 4.0dp */ 0.06975220162292829f,
+ /* 4.5dp */ 0.062061051930857966f,
+ /* 5.0dp */ 0.055012513523938045f,
+ /* 5.5dp */ 0.04855289491515605f,
+ /* 6.0dp */ 0.04263299065103837f,
+ /* 6.5dp */ 0.03720770649437408f,
+ /* 7.0dp */ 0.032235715923688846f,
+ /* 7.5dp */ 0.027679145332890072f,
+ /* 8.0dp */ 0.02350328553312564f,
+ /* 8.5dp */ 0.019676327359252226f,
+ /* 9.0dp */ 0.016169119366923862f,
+ /* 9.5dp */ 0.012954945774584309f,
+ /* 10.0dp */ 0.010009322958860013f,
+ /* 10.5dp */ 0.007309812953179257f,
+ /* 11.0dp */ 0.004835852528962955f,
+ /* 11.5dp */ 0.002568596557431524f,
+ /* 12.0dp */ 0.0004907744588531701f,
+ /* 12.5dp */ -0.0014134413542490412f,
+ /* 13.0dp */ -0.0031585560420509667f,
+ /* 13.5dp */ -0.004757862828932768f,
+ /* 14.0dp */ -0.006223544263193034f,
+ /* 14.5dp */ -0.007566765016306747f,
+ /* 15.0dp */ -0.008797756928615424f,
+ /* 15.5dp */ -0.00992589694927596f,
+ /* 16.0dp */ -0.010959778564167369f,
+ /* 16.5dp */ -0.01190727725584982f,
+ /* 17.0dp */ -0.012775610494210232f,
+ /* 17.5dp */ -0.013571392714766779f,
+ /* 18.0dp */ -0.014300685703423587f,
+ /* 18.5dp */ -0.014969044771476151f,
+ /* 19.0dp */ -0.01558156107260065f,
+ /* 19.5dp */ -0.01614290038417221f,
+ /* 20.0dp */ -0.016657338648324763f,
+ /* 20.5dp */ -0.017128794543482675f,
+ /* 21.0dp */ -0.01756085933447426f,
+ /* 21.5dp */ -0.017956824228607303f,
+ /* 22.0dp */ -0.018319705446088512f,
+ /* 22.5dp */ -0.018652267195758174f,
+ /* 23.0dp */ -0.01895704273115516f,
+ /* 23.5dp */ -0.01923635364730468f,
+ /* 24.0dp */ -0.019492327565219923f,
+ /* 24.5dp */ -0.01972691433882746f,
+ /* 25.0dp */ -0.019941900907770843f,
+ /* 25.5dp */ -0.02013892490923212f,
+ /* 26.0dp */ -0.020319487152457818f,
+ /* 26.5dp */ -0.02048496305101277f,
+ /* 27.0dp */ -0.020636613099845737f,
+ /* 27.5dp */ -0.02077559247697482f,
+ /* 28.0dp */ -0.020902959842932358f,
+ /* 28.5dp */ -0.021019685404998267f,
+ /* 29.0dp */ -0.021126658307650148f,
+ /* 29.5dp */ -0.0212246934055262f,
+ /* 30.0dp */ -0.02131453747049323f,
+ /* 30.5dp */ -0.02139687488010142f,
+ /* 31.0dp */ -0.021472332830757092f,
+ /* 31.5dp */ -0.0215414861153242f,
+ /* 32.0dp */ -0.02160486150154747f,
+ };
+
+ private static final ComponentCallbacks callbacks = new ComponentCallbacks() {
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ sDensity = getDensity();
+ }
+
+ @Override
+ public void onLowMemory() {}
+ };
+
+ private DynamicMetrics() {}
+
+ public static float calcTracking(float sizePx) {
+ if (sDensity == 0.0f) {
+ Context context = ActivityThread.currentApplication();
+ if (context == null) {
+ return 0.0f;
+ }
+
+ sDensity = getDensity();
+ context.registerComponentCallbacks(callbacks);
+ }
+
+ // Pixels -> sp
+ float sizeDp = sizePx / sDensity;
+ int lutIndex = (int) (sizeDp * 2); // 0.5dp steps
+
+ // Precalculated lookup
+ if (lutIndex < TRACKING_LUT.length) {
+ return TRACKING_LUT[lutIndex];
+ }
+
+ return A + B * (float) Math.exp(C * sizeDp);
+ }
+
+ public static boolean shouldModifyFont(Typeface typeface) {
+ return typeface == null || typeface.isSystemFont();
+ }
+
+ private static float getDensity() {
+ Context context = ActivityThread.currentApplication();
+ if (context == null) {
+ return 1.0f;
+ }
+
+ return context.getResources().getDisplayMetrics().scaledDensity;
+ }
+}
diff --git a/core/java/com/android/internal/ice/hardware/HIDLHelper.java b/core/java/com/android/internal/ice/hardware/HIDLHelper.java
new file mode 100644
index 000000000000..a596c0e5e3da
--- /dev/null
+++ b/core/java/com/android/internal/ice/hardware/HIDLHelper.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 The LineageOS 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.internal.ice.hardware;
+
+import android.util.Range;
+
+import java.util.ArrayList;
+
+class HIDLHelper {
+
+ static TouchscreenGesture[] fromHIDLGestures(
+ ArrayList<vendor.lineage.touch.V1_0.Gesture> gestures) {
+ int size = gestures.size();
+ TouchscreenGesture[] r = new TouchscreenGesture[size];
+ for (int i = 0; i < size; i++) {
+ vendor.lineage.touch.V1_0.Gesture g = gestures.get(i);
+ r[i] = new TouchscreenGesture(g.id, g.name, g.keycode);
+ }
+ return r;
+ }
+
+ static vendor.lineage.touch.V1_0.Gesture toHIDLGesture(TouchscreenGesture gesture) {
+ vendor.lineage.touch.V1_0.Gesture g = new vendor.lineage.touch.V1_0.Gesture();
+ g.id = gesture.id;
+ g.name = gesture.name;
+ g.keycode = gesture.keycode;
+ return g;
+ }
+
+}
diff --git a/core/java/com/android/internal/ice/hardware/LineageHardwareManager.java b/core/java/com/android/internal/ice/hardware/LineageHardwareManager.java
new file mode 100644
index 000000000000..1c0797784183
--- /dev/null
+++ b/core/java/com/android/internal/ice/hardware/LineageHardwareManager.java
@@ -0,0 +1,259 @@
+/*
+ * Copyright (C) 2015-2016 The CyanogenMod Project
+ * 2017-2019 The LineageOS 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.internal.ice.hardware;
+
+import android.content.Context;
+import android.hidl.base.V1_0.IBase;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.ArrayMap;
+import android.util.Log;
+import android.util.Range;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.ArrayUtils;
+
+import com.android.internal.ice.hardware.HIDLHelper;
+
+import vendor.lineage.touch.V1_0.IGloveMode;
+import vendor.lineage.touch.V1_0.IKeyDisabler;
+import vendor.lineage.touch.V1_0.IStylusMode;
+import vendor.lineage.touch.V1_0.ITouchscreenGesture;
+
+import java.io.UnsupportedEncodingException;
+import java.lang.IllegalArgumentException;
+import java.lang.reflect.Field;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * Manages access to LineageOS hardware extensions
+ *
+ * <p>
+ * This manager requires the HARDWARE_ABSTRACTION_ACCESS permission.
+ * <p>
+ * To get the instance of this class, utilize LineageHardwareManager#getInstance(Context context)
+ */
+public final class LineageHardwareManager {
+ private static final String TAG = "LineageHardwareManager";
+
+ // The VisibleForTesting annotation is to ensure Proguard doesn't remove these
+ // fields, as they might be used via reflection. When the @Keep annotation in
+ // the support library is properly handled in the platform, we should change this.
+
+ /**
+ * High touch sensitivity for touch panels
+ */
+ @VisibleForTesting
+ public static final int FEATURE_HIGH_TOUCH_SENSITIVITY = 0x10;
+
+ /**
+ * Hardware navigation key disablement
+ */
+ @VisibleForTesting
+ public static final int FEATURE_KEY_DISABLE = 0x20;
+
+ /**
+ * Touchscreen hovering
+ */
+ @VisibleForTesting
+ public static final int FEATURE_TOUCH_HOVERING = 0x800;
+
+ /**
+ * Touchscreen gesture
+ */
+ @VisibleForTesting
+ public static final int FEATURE_TOUCHSCREEN_GESTURES = 0x80000;
+
+ private static final List<Integer> BOOLEAN_FEATURES = Arrays.asList(
+ FEATURE_HIGH_TOUCH_SENSITIVITY,
+ FEATURE_KEY_DISABLE,
+ FEATURE_TOUCH_HOVERING
+ );
+
+ private static LineageHardwareManager sLineageHardwareManagerInstance;
+
+ private Context mContext;
+
+ // HIDL hals
+ private HashMap<Integer, IBase> mHIDLMap = new HashMap<Integer, IBase>();
+
+ /**
+ * @hide to prevent subclassing from outside of the framework
+ */
+ private LineageHardwareManager(Context context) {
+ Context appContext = context.getApplicationContext();
+ if (appContext != null) {
+ mContext = appContext;
+ } else {
+ mContext = context;
+ }
+ }
+
+ /**
+ * Determine if a Lineage Hardware feature is supported on this device
+ *
+ * @param feature The Lineage Hardware feature to query
+ *
+ * @return true if the feature is supported, false otherwise.
+ */
+ public boolean isSupported(int feature) {
+ return isSupportedHIDL(feature);
+ }
+
+ private boolean isSupportedHIDL(int feature) {
+ if (!mHIDLMap.containsKey(feature)) {
+ mHIDLMap.put(feature, getHIDLService(feature));
+ }
+ return mHIDLMap.get(feature) != null;
+ }
+
+ private IBase getHIDLService(int feature) {
+ try {
+ switch (feature) {
+ case FEATURE_HIGH_TOUCH_SENSITIVITY:
+ return IGloveMode.getService(true);
+ case FEATURE_KEY_DISABLE:
+ return IKeyDisabler.getService(true);
+ case FEATURE_TOUCH_HOVERING:
+ return IStylusMode.getService(true);
+ case FEATURE_TOUCHSCREEN_GESTURES:
+ return ITouchscreenGesture.getService(true);
+ }
+ } catch (NoSuchElementException | RemoteException e) {
+ }
+ return null;
+ }
+
+ /**
+ * Get or create an instance of the {@link com.android.internal.custom.hardware.LineageHardwareManager}
+ * @param context
+ * @return {@link LineageHardwareManager}
+ */
+ public static LineageHardwareManager getInstance(Context context) {
+ if (sLineageHardwareManagerInstance == null) {
+ sLineageHardwareManagerInstance = new LineageHardwareManager(context);
+ }
+ return sLineageHardwareManagerInstance;
+ }
+
+ /**
+ * Determine if the given feature is enabled or disabled.
+ *
+ * Only used for features which have simple enable/disable controls.
+ *
+ * @param feature the Lineage Hardware feature to query
+ *
+ * @return true if the feature is enabled, false otherwise.
+ */
+ public boolean get(int feature) {
+ if (!BOOLEAN_FEATURES.contains(feature)) {
+ throw new IllegalArgumentException(feature + " is not a boolean");
+ }
+
+ try {
+ if (isSupportedHIDL(feature)) {
+ IBase obj = mHIDLMap.get(feature);
+ switch (feature) {
+ case FEATURE_HIGH_TOUCH_SENSITIVITY:
+ IGloveMode gloveMode = (IGloveMode) obj;
+ return gloveMode.isEnabled();
+ case FEATURE_KEY_DISABLE:
+ IKeyDisabler keyDisabler = (IKeyDisabler) obj;
+ return keyDisabler.isEnabled();
+ case FEATURE_TOUCH_HOVERING:
+ IStylusMode stylusMode = (IStylusMode) obj;
+ return stylusMode.isEnabled();
+ }
+ }
+ } catch (RemoteException e) {
+ }
+ return false;
+ }
+
+ /**
+ * Enable or disable the given feature
+ *
+ * Only used for features which have simple enable/disable controls.
+ *
+ * @param feature the Lineage Hardware feature to set
+ * @param enable true to enable, false to disale
+ *
+ * @return true if the feature is enabled, false otherwise.
+ */
+ public boolean set(int feature, boolean enable) {
+ if (!BOOLEAN_FEATURES.contains(feature)) {
+ throw new IllegalArgumentException(feature + " is not a boolean");
+ }
+
+ try {
+ if (isSupportedHIDL(feature)) {
+ IBase obj = mHIDLMap.get(feature);
+ switch (feature) {
+ case FEATURE_HIGH_TOUCH_SENSITIVITY:
+ IGloveMode gloveMode = (IGloveMode) obj;
+ return gloveMode.setEnabled(enable);
+ case FEATURE_KEY_DISABLE:
+ IKeyDisabler keyDisabler = (IKeyDisabler) obj;
+ return keyDisabler.setEnabled(enable);
+ case FEATURE_TOUCH_HOVERING:
+ IStylusMode stylusMode = (IStylusMode) obj;
+ return stylusMode.setEnabled(enable);
+ }
+ }
+ } catch (RemoteException e) {
+ }
+ return false;
+ }
+
+ /**
+ * @return a list of available touchscreen gestures on the devices
+ */
+ public TouchscreenGesture[] getTouchscreenGestures() {
+ try {
+ if (isSupportedHIDL(FEATURE_TOUCHSCREEN_GESTURES)) {
+ ITouchscreenGesture touchscreenGesture = (ITouchscreenGesture)
+ mHIDLMap.get(FEATURE_TOUCHSCREEN_GESTURES);
+ return HIDLHelper.fromHIDLGestures(touchscreenGesture.getSupportedGestures());
+ }
+ } catch (RemoteException e) {
+ }
+ return null;
+ }
+
+ /**
+ * @return true if setting the activation status was successful
+ */
+ public boolean setTouchscreenGestureEnabled(
+ TouchscreenGesture gesture, boolean state) {
+ try {
+ if (isSupportedHIDL(FEATURE_TOUCHSCREEN_GESTURES)) {
+ ITouchscreenGesture touchscreenGesture = (ITouchscreenGesture)
+ mHIDLMap.get(FEATURE_TOUCHSCREEN_GESTURES);
+ return touchscreenGesture.setGestureEnabled(
+ HIDLHelper.toHIDLGesture(gesture), state);
+ }
+ } catch (RemoteException e) {
+ }
+ return false;
+ }
+}
diff --git a/core/java/com/android/internal/ice/hardware/TouchscreenGesture.aidl b/core/java/com/android/internal/ice/hardware/TouchscreenGesture.aidl
new file mode 100644
index 000000000000..e922eee9a1b6
--- /dev/null
+++ b/core/java/com/android/internal/ice/hardware/TouchscreenGesture.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod Project
+ * 2017 The LineageOS 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.internal.ice.hardware;
+
+parcelable TouchscreenGesture;
diff --git a/core/java/com/android/internal/ice/hardware/TouchscreenGesture.java b/core/java/com/android/internal/ice/hardware/TouchscreenGesture.java
new file mode 100644
index 000000000000..166dd3223d2c
--- /dev/null
+++ b/core/java/com/android/internal/ice/hardware/TouchscreenGesture.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod Project
+ * 2017 The LineageOS 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.internal.ice.hardware;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Touchscreen gestures API
+ *
+ * A device may implement several touchscreen gestures for use while
+ * the display is turned off, such as drawing alphabets and shapes.
+ * These gestures can be interpreted by userspace to activate certain
+ * actions and launch certain apps, such as to skip music tracks,
+ * to turn on the flashlight, or to launch the camera app.
+ *
+ * This *should always* be supported by the hardware directly.
+ * A lot of recent touch controllers have a firmware option for this.
+ *
+ * This API provides support for enumerating the gestures
+ * supported by the touchscreen.
+ *
+ * A TouchscreenGesture is referenced by it's identifier and carries an
+ * associated name (up to the user to translate this value).
+ */
+public class TouchscreenGesture implements Parcelable {
+
+ public final int id;
+ public final String name;
+ public final int keycode;
+
+ public TouchscreenGesture(int id, String name, int keycode) {
+ this.id = id;
+ this.name = name;
+ this.keycode = keycode;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeInt(id);
+ parcel.writeString(name);
+ parcel.writeInt(keycode);
+ }
+
+ /** @hide */
+ public static final Parcelable.Creator<TouchscreenGesture> CREATOR =
+ new Parcelable.Creator<TouchscreenGesture>() {
+
+ public TouchscreenGesture createFromParcel(Parcel in) {
+ return new TouchscreenGesture(in.readInt(), in.readString(), in.readInt());
+ }
+
+ @Override
+ public TouchscreenGesture[] newArray(int size) {
+ return new TouchscreenGesture[size];
+ }
+ };
+}
diff --git a/core/java/com/android/internal/notification/SystemNotificationChannels.java b/core/java/com/android/internal/notification/SystemNotificationChannels.java
index 681b46a01c8d..89e6d1f50307 100644
--- a/core/java/com/android/internal/notification/SystemNotificationChannels.java
+++ b/core/java/com/android/internal/notification/SystemNotificationChannels.java
@@ -113,7 +113,7 @@ public class SystemNotificationChannels {
final NotificationChannel developerImportant = new NotificationChannel(
DEVELOPER_IMPORTANT,
context.getString(R.string.notification_channel_developer_important),
- NotificationManager.IMPORTANCE_HIGH);
+ NotificationManager.IMPORTANCE_MIN);
developer.setBlockable(true);
channelsList.add(developerImportant);
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index e1e57de15346..af54f6b3e0e4 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -13659,17 +13659,17 @@ public class BatteryStatsImpl extends BatteryStats {
// We store the power drain as mAms.
controllerMaMs = info.getControllerEnergyUsedMicroJoules() / opVolt;
mWifiActivity.getPowerCounter().addCountLocked((long) controllerMaMs);
+ // Converting uWs to mAms.
+ // Conversion: (uWs * (1000ms / 1s) * (1mW / 1000uW)) / mV = mAms
+ long monitoredRailChargeConsumedMaMs =
+ (long) (mTmpRailStats.getWifiTotalEnergyUseduWs() / opVolt);
+ mWifiActivity.getMonitoredRailChargeConsumedMaMs().addCountLocked(
+ monitoredRailChargeConsumedMaMs);
+ mHistoryCur.wifiRailChargeMah +=
+ (monitoredRailChargeConsumedMaMs / MILLISECONDS_IN_HOUR);
+ addHistoryRecordLocked(elapsedRealtimeMs, uptimeMs);
+ mTmpRailStats.resetWifiTotalEnergyUsed();
}
- // Converting uWs to mAms.
- // Conversion: (uWs * (1000ms / 1s) * (1mW / 1000uW)) / mV = mAms
- long monitoredRailChargeConsumedMaMs =
- (long) (mTmpRailStats.getWifiTotalEnergyUseduWs() / opVolt);
- mWifiActivity.getMonitoredRailChargeConsumedMaMs().addCountLocked(
- monitoredRailChargeConsumedMaMs);
- mHistoryCur.wifiRailChargeMah +=
- (monitoredRailChargeConsumedMaMs / MILLISECONDS_IN_HOUR);
- addHistoryRecordLocked(elapsedRealtimeMs, uptimeMs);
- mTmpRailStats.resetWifiTotalEnergyUsed();
if (uidEstimatedConsumptionMah != null) {
totalEstimatedConsumptionMah = Math.max(controllerMaMs / MILLISECONDS_IN_HOUR,
@@ -13742,7 +13742,7 @@ public class BatteryStatsImpl extends BatteryStats {
final SparseDoubleArray uidEstimatedConsumptionMah;
final long dataConsumedChargeUC;
if (consumedChargeUC > 0 && mMobileRadioPowerCalculator != null
- && mGlobalMeasuredEnergyStats != null) {
+ && mGlobalMeasuredEnergyStats != null && totalRadioDurationMs != 0) {
// Crudely attribute power consumption. Added (totalRadioDurationMs / 2) to the
// numerator for long rounding.
final long phoneConsumedChargeUC =
diff --git a/core/java/com/android/internal/os/DeviceKeyHandler.java b/core/java/com/android/internal/os/DeviceKeyHandler.java
new file mode 100644
index 000000000000..8902337f3ebb
--- /dev/null
+++ b/core/java/com/android/internal/os/DeviceKeyHandler.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.internal.os;
+
+import android.view.KeyEvent;
+
+public interface DeviceKeyHandler {
+
+ /**
+ * Invoked when an unknown key was detected by the system, letting the device handle
+ * this special keys prior to pass the key to the active app.
+ *
+ * @param event The key event to be handled
+ * @return null if event is consumed, KeyEvent to be handled otherwise
+ */
+ public KeyEvent handleKeyEvent(KeyEvent event);
+}
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 9655fb6c5c8d..ace90ae1256c 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -645,10 +645,7 @@ static void PreApplicationInit() {
void *mBelugaHandle = nullptr;
void (*mBeluga)() = nullptr;
mBelugaHandle = dlopen("libbeluga.so", RTLD_NOW);
- if (!mBelugaHandle) {
- ALOGW("Unable to open libbeluga.so: %s.", dlerror());
- }
- else {
+ if (mBelugaHandle) {
mBeluga = (void (*) ())dlsym(mBelugaHandle, "beluga");
if (mBeluga)
mBeluga();
diff --git a/core/proto/android/server/appstatetracker.proto b/core/proto/android/server/appstatetracker.proto
index f5583d4f476f..0d0fb097d963 100644
--- a/core/proto/android/server/appstatetracker.proto
+++ b/core/proto/android/server/appstatetracker.proto
@@ -25,7 +25,7 @@ option java_multiple_files = true;
// Dump from com.android.server.AppStateTracker.
//
-// Next ID: 14
+// Next ID: 15
message AppStateTrackerProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -41,6 +41,9 @@ message AppStateTrackerProto {
// UIDs currently in the foreground.
repeated int32 foreground_uids = 11;
+ // App ids that are in power-save system exemption list.
+ repeated int32 power_save_system_exempt_app_ids = 14;
+
// App ids that are in power-save exemption list.
repeated int32 power_save_exempt_app_ids = 3;
diff --git a/core/res/res/drawable/toast_frame.xml b/core/res/res/drawable/toast_frame.xml
index a8cdef6d05f1..34987394b2ec 100644
--- a/core/res/res/drawable/toast_frame.xml
+++ b/core/res/res/drawable/toast_frame.xml
@@ -17,7 +17,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <solid android:color="?android:attr/colorSurface" />
+ <solid android:color="?android:attr/colorBackgroundFloating" />
<corners android:radius="28dp" />
</shape>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 7f4400e3f55b..be6e6fa8cdad 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -901,11 +901,11 @@
<integer name="config_defaultNightDisplayCustomEndTime">21600000</integer>
<!-- Minimum color temperature, in Kelvin, supported by Night display. -->
- <integer name="config_nightDisplayColorTemperatureMin">2596</integer>
+ <integer name="config_nightDisplayColorTemperatureMin">1600</integer>
<!-- Default color temperature, in Kelvin, to tint the screen when Night display is
activated. -->
- <integer name="config_nightDisplayColorTemperatureDefault">2850</integer>
+ <integer name="config_nightDisplayColorTemperatureDefault">2650</integer>
<!-- Maximum color temperature, in Kelvin, supported by Night display. -->
<integer name="config_nightDisplayColorTemperatureMax">4082</integer>
diff --git a/core/res/res/values/ice_config.xml b/core/res/res/values/ice_config.xml
new file mode 100644
index 000000000000..265fbc248b0b
--- /dev/null
+++ b/core/res/res/values/ice_config.xml
@@ -0,0 +1,54 @@
+<!--
+ Copyright (C) 2022 Project ICE
+
+ 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.
+-->
+<resources>
+ <!-- The list of components which should be automatically disabled for a specific device.
+ Note: this MUST not be used to randomly disable components, ask for approval first! -->
+ <string-array name="config_deviceDisabledComponents" translatable="false">
+ </string-array>
+
+ <!-- The list of components which should be automatically disabled for all devices. -->
+ <string-array name="config_globallyDisabledComponents" translatable="false">
+ </string-array>
+
+ <!-- The list of components which should be forced to be enabled. -->
+ <string-array name="config_forceEnabledComponents" translatable="false">
+ </string-array>
+
+ <!-- Paths to the libraries that contain device specific key handlers -->
+ <string-array name="config_deviceKeyHandlerLibs" translatable="false">
+ </string-array>
+
+ <!-- Names of the key handler classes -->
+ <string-array name="config_deviceKeyHandlerClasses" translatable="false">
+ </string-array>
+
+ <!-- Path to fast charging status file to detect whether an oem fast charger is active -->
+ <string name="config_oemFastChargerStatusPath" translatable="false"></string>
+
+ <!-- Expected value from fast charging status file -->
+ <string name="config_oemFastChargerStatusValue" translatable="false">1</string>
+
+ <!-- Whether device has an alert slider -->
+ <bool name="config_hasAlertSlider" translatable="false">false</bool>
+
+ <!-- The location of the device's alert slider:
+ 0: Left side
+ 1: Right side -->
+ <integer name="config_alertSliderLocation">0</integer>
+
+ <!-- Whether device supports QTI Boost Framework -->
+ <bool name="config_supportsBoostFramework">true</bool>
+</resources>
diff --git a/core/res/res/values/ice_symbols.xml b/core/res/res/values/ice_symbols.xml
new file mode 100644
index 000000000000..dcc26d998032
--- /dev/null
+++ b/core/res/res/values/ice_symbols.xml
@@ -0,0 +1,38 @@
+<!--
+ Copyright (C) 2022 Project ICE
+
+ 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.
+-->
+<resources>
+ <!-- Package Manager -->
+ <java-symbol type="array" name="config_deviceDisabledComponents" />
+ <java-symbol type="array" name="config_globallyDisabledComponents" />
+ <java-symbol type="array" name="config_forceEnabledComponents" />
+
+ <!-- Device keyhandlers -->
+ <java-symbol type="array" name="config_deviceKeyHandlerLibs" />
+ <java-symbol type="array" name="config_deviceKeyHandlerClasses" />
+
+ <!-- Path to fast charging status file to detect whether an oem fast charger is active -->
+ <java-symbol type="string" name="config_oemFastChargerStatusPath" />
+
+ <!-- Expected value from fast charging status file -->
+ <java-symbol type="string" name="config_oemFastChargerStatusValue" />
+
+ <!-- Alert Slider -->
+ <java-symbol type="bool" name="config_hasAlertSlider" />
+ <java-symbol type="integer" name="config_alertSliderLocation" />
+
+ <!-- Boost Framework -->
+ <java-symbol type="bool" name="config_supportsBoostFramework" />
+</resources>
diff --git a/data/fonts/Android.bp b/data/fonts/Android.bp
index f90a74d939f4..81716878df3a 100644
--- a/data/fonts/Android.bp
+++ b/data/fonts/Android.bp
@@ -30,16 +30,6 @@ license {
}
prebuilt_font {
- name: "DroidSansMono.ttf",
- src: "DroidSansMono.ttf",
- required: [
- // Roboto-Regular.ttf provides DroidSans.ttf as a symlink to itself
- // Roboto-Regular.ttf provides DroidSans-Bold.ttf as a symlink to itself
- "Roboto-Regular.ttf",
- ],
-}
-
-prebuilt_font {
name: "AndroidClock.ttf",
src: "AndroidClock.ttf",
}
diff --git a/data/fonts/fonts.xml b/data/fonts/fonts.xml
index f8c015f28a50..af451169e549 100644
--- a/data/fonts/fonts.xml
+++ b/data/fonts/fonts.xml
@@ -25,88 +25,92 @@
<!-- first font is default -->
<family name="sans-serif">
<font weight="100" style="normal">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="0" />
+ <axis tag="slnt" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="100" />
</font>
<font weight="200" style="normal">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="0" />
+ <axis tag="slnt" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="200" />
</font>
<font weight="300" style="normal">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="0" />
+ <axis tag="slnt" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="300" />
</font>
- <font weight="400" style="normal">RobotoStatic-Regular.ttf</font>
+ <font weight="400" style="normal">Roboto-Regular.ttf
+ <axis tag="slnt" stylevalue="0" />
+ <axis tag="wdth" stylevalue="100" />
+ <axis tag="wght" stylevalue="400" />
+ </font>
<font weight="500" style="normal">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="0" />
+ <axis tag="slnt" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="500" />
</font>
<font weight="600" style="normal">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="0" />
+ <axis tag="slnt" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="600" />
</font>
<font weight="700" style="normal">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="0" />
+ <axis tag="slnt" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="700" />
</font>
<font weight="800" style="normal">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="0" />
+ <axis tag="slnt" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="800" />
</font>
<font weight="900" style="normal">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="0" />
+ <axis tag="slnt" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="900" />
</font>
<font weight="100" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="100" />
</font>
<font weight="200" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="200" />
</font>
<font weight="300" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="300" />
</font>
<font weight="400" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="400" />
</font>
<font weight="500" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="500" />
</font>
<font weight="600" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="600" />
</font>
<font weight="700" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="700" />
</font>
<font weight="800" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="800" />
</font>
<font weight="900" style="italic">Roboto-Regular.ttf
- <axis tag="ital" stylevalue="1" />
+ <axis tag="slnt" stylevalue="-10" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="900" />
</font>
@@ -271,6 +275,98 @@
<alias name="source-sans-pro-semi-bold" to="source-sans-pro" weight="600"/>
<!-- fallback fonts -->
+ <family>
+ <font weight="100" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="100"/>
+ </font>
+ <font weight="100" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="100"/>
+ </font>
+ <font weight="200" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="200"/>
+ </font>
+ <font weight="200" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="200"/>
+ </font>
+ <font weight="300" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="300"/>
+ </font>
+ <font weight="300" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="300"/>
+ </font>
+ <font weight="400" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="400"/>
+ </font>
+ <font weight="400" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="400"/>
+ </font>
+ <font weight="500" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="500"/>
+ </font>
+ <font weight="500" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="500"/>
+ </font>
+ <font weight="600" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="600"/>
+ </font>
+ <font weight="600" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="600"/>
+ </font>
+ <font weight="700" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="700"/>
+ </font>
+ <font weight="700" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="700"/>
+ </font>
+ <font weight="800" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="800"/>
+ </font>
+ <font weight="800" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="800"/>
+ </font>
+ <font weight="900" style="normal">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="0"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="900"/>
+ </font>
+ <font weight="900" style="italic">RobotoFallback-VF.ttf
+ <axis tag="ital" stylevalue="1"/>
+ <axis tag="wdth" stylevalue="100"/>
+ <axis tag="wght" stylevalue="900"/>
+ </font>
+ </family>
<family lang="und-Arab" variant="elegant">
<font weight="400" style="normal" postScriptName="NotoNaskhArabic">
NotoNaskhArabic-Regular.ttf
diff --git a/data/keyboards/Generic.kcm b/data/keyboards/Generic.kcm
index fe6eeeb66e40..3c7178022261 100644
--- a/data/keyboards/Generic.kcm
+++ b/data/keyboards/Generic.kcm
@@ -498,7 +498,7 @@ key PLUS {
### Non-printing keys ###
key ESCAPE {
- base: none
+ base: fallback BACK
alt, meta: fallback HOME
ctrl: fallback MENU
}
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index f438a03b1434..6621d1f23166 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -260,7 +260,7 @@ public class Paint {
// These flags are always set on a new/reset paint, even if flags 0 is passed.
static final int HIDDEN_DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG | EMBEDDED_BITMAP_TEXT_FLAG
- | FILTER_BITMAP_FLAG;
+ | FILTER_BITMAP_FLAG | SUBPIXEL_TEXT_FLAG;
/**
* Font hinter option that disables font hinting.
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index a2f5301e353f..64ac679de31e 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -212,6 +212,8 @@ public class Typeface {
private @IntRange(from = 0, to = FontStyle.FONT_WEIGHT_MAX) final int mWeight;
+ private boolean mIsSystemDefault;
+
// Value for weight and italic. Indicates the value is resolved by font metadata.
// Must be the same as the C++ constant in core/jni/android/graphics/FontFamily.cpp
/** @hide */
@@ -237,6 +239,7 @@ public class Typeface {
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static void setDefault(Typeface t) {
+ t.mIsSystemDefault = true;
synchronized (SYSTEM_FONT_MAP_LOCK) {
sDefaultTypeface = t;
nativeSetDefault(t.native_instance);
@@ -933,7 +936,7 @@ public class Typeface {
}
}
- typeface = new Typeface(nativeCreateFromTypeface(ni, style));
+ typeface = new Typeface(nativeCreateFromTypeface(ni, style), family.mIsSystemDefault);
styles.put(style, typeface);
}
return typeface;
@@ -1001,7 +1004,8 @@ public class Typeface {
}
typeface = new Typeface(
- nativeCreateFromTypefaceWithExactStyle(base.native_instance, weight, italic));
+ nativeCreateFromTypefaceWithExactStyle(base.native_instance, weight, italic),
+ base.mIsSystemDefault);
innerCache.put(key, typeface);
}
return typeface;
@@ -1011,7 +1015,8 @@ public class Typeface {
public static Typeface createFromTypefaceWithVariation(@Nullable Typeface family,
@NonNull List<FontVariationAxis> axes) {
final Typeface base = family == null ? Typeface.DEFAULT : family;
- return new Typeface(nativeCreateFromTypefaceWithVariation(base.native_instance, axes));
+ return new Typeface(nativeCreateFromTypefaceWithVariation(base.native_instance, axes),
+ base.mIsSystemDefault);
}
/**
@@ -1174,6 +1179,12 @@ public class Typeface {
mCleaner = sRegistry.registerNativeAllocation(this, native_instance);
mStyle = nativeGetStyle(ni);
mWeight = nativeGetWeight(ni);
+ mIsSystemDefault = false;
+ }
+
+ private Typeface(long ni, boolean isSystemDefault) {
+ this(ni);
+ mIsSystemDefault = isSystemDefault;
}
private static Typeface getSystemDefaultTypeface(@NonNull String familyName) {
@@ -1189,6 +1200,7 @@ public class Typeface {
for (Map.Entry<String, FontFamily[]> entry : fallbacks.entrySet()) {
outSystemFontMap.put(entry.getKey(), createFromFamilies(entry.getValue()));
}
+ outSystemFontMap.get("sans-serif").mIsSystemDefault = true;
for (int i = 0; i < aliases.size(); ++i) {
final FontConfig.Alias alias = aliases.get(i);
@@ -1203,7 +1215,8 @@ public class Typeface {
}
final int weight = alias.getWeight();
final Typeface newFace = weight == 400 ? base :
- new Typeface(nativeCreateWeightAlias(base.native_instance, weight));
+ new Typeface(nativeCreateWeightAlias(base.native_instance, weight),
+ base.mIsSystemDefault);
outSystemFontMap.put(alias.getName(), newFace);
}
}
@@ -1230,6 +1243,7 @@ public class Typeface {
for (Map.Entry<String, Typeface> entry : fontMap.entrySet()) {
nativePtrs[i++] = entry.getValue().native_instance;
writeString(namesBytes, entry.getKey());
+ writeInt(namesBytes, entry.getValue().mIsSystemDefault ? 1 : 0);
}
int typefacesBytesCount = nativeWriteTypefaces(null, nativePtrs);
// int (typefacesBytesCount), typefaces, namesBytes
@@ -1271,7 +1285,8 @@ public class Typeface {
buffer.position(buffer.position() + typefacesBytesCount);
for (long nativePtr : nativePtrs) {
String name = readString(buffer);
- out.put(name, new Typeface(nativePtr));
+ boolean isSystemDefault = buffer.getInt() == 1;
+ out.put(name, new Typeface(nativePtr, isSystemDefault));
}
return nativePtrs;
}
@@ -1496,6 +1511,11 @@ public class Typeface {
return families;
}
+ /** @hide */
+ public boolean isSystemFont() {
+ return mIsSystemDefault;
+ }
+
private static native long nativeCreateFromTypeface(long native_instance, int style);
private static native long nativeCreateFromTypefaceWithExactStyle(
long native_instance, int weight, boolean italic);
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index ad9aa6cdd3d9..55dae30d41e0 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -169,6 +169,9 @@ cc_defaults {
},
},
},
+ cflags: [
+ "-O3",
+ ],
}
// ------------------------
diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml
index d0b6c4d54bb1..737d6ac69d40 100644
--- a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml
+++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml
@@ -19,10 +19,12 @@
<item name="android:fontFamily">@string/settingslib_config_headlineFontFamily</item>
<item name="android:textSize">20dp</item>
<item name="android:textColor">@color/settingslib_text_color_primary_device_default</item>
+ <item name="android:letterSpacing">-0.016657338648324763</item>
</style>
<style name="CollapsingToolbarTitle.Expanded" parent="CollapsingToolbarTitle.Collapsed">
<item name="android:textSize">36dp</item>
<item name="android:textColor">@color/settingslib_text_color_primary_device_default</item>
+ <item name="android:letterSpacing">-0.02195411335559237</item>
</style>
-</resources> \ No newline at end of file
+</resources>
diff --git a/packages/SettingsLib/res/drawable/ic_4g_plus_mobiledata.xml b/packages/SettingsLib/res/drawable/ic_4g_plus_mobiledata.xml
index 1d048ae44049..1272ea7a30e1 100644
--- a/packages/SettingsLib/res/drawable/ic_4g_plus_mobiledata.xml
+++ b/packages/SettingsLib/res/drawable/ic_4g_plus_mobiledata.xml
@@ -14,20 +14,17 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="19.41dp"
- android:height="15dp"
- android:viewportWidth="22"
- android:viewportHeight="17">
-
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M5.32,10.13h1.11v1.03H5.32v2.31H4.11v-2.31H0.35v-0.75l3.7-6.9h1.27V10.13z M1.69,10.13h2.42V5.4L1.69,10.13z" />
+ android:width="27dp"
+ android:height="16dp"
+ android:viewportWidth="27.0"
+ android:viewportHeight="16.0">
<path
- android:fillColor="#FFFFFFFF"
- android:pathData="M14.15,12.24l-0.22,0.27c-0.63,0.73-1.55,1.1-2.76,1.1c-1.08,0-1.92-0.36-2.53-1.07c-0.61-0.71-0.93-1.72-0.94-3.02V7.56 c0-1.39,0.28-2.44,0.84-3.13s1.39-1.04,2.51-1.04c0.95,0,1.69,0.26,2.23,0.79s0.83,1.28,0.89,2.26H12.9 c-0.05-0.62-0.22-1.1-0.52-1.45s-0.74-0.52-1.34-0.52c-0.72,0-1.24,0.23-1.57,0.7S8.97,6.37,8.96,7.4v2.03 c0,1,0.19,1.77,0.57,2.31c0.38,0.54,0.93,0.8,1.65,0.8c0.67,0,1.19-0.16,1.54-0.49l0.18-0.17V9.59h-1.82V8.52h3.07V12.24z" />
+ android:fillColor="#FF000000"
+ android:pathData="M2,10.98V9.81l4.28,-6.83h1.6v6.59h1.19v1.41H7.88V13H6.4v-2.02H2zM3.68,9.57H6.4V5.33H6.31L3.68,9.57z"/>
<path
- android:fillColor="#FFFFFFFF"
- android:pathData="M 19.3 5.74 L 19.3 3.39 L 18 3.39 L 18 5.74 L 15.65 5.74 L 15.65 7.04 L 18 7.04 L 18 9.39 L 19.3 9.39 L 19.3 7.04 L 21.65 7.04 L 21.65 5.74 Z" />
+ android:fillColor="#FF000000"
+ android:pathData="M15,13.22c-0.88,0 -1.66,-0.21 -2.34,-0.64c-0.67,-0.44 -1.2,-1.05 -1.6,-1.83c-0.38,-0.79 -0.57,-1.71 -0.57,-2.76c0,-1.05 0.21,-1.96 0.62,-2.74c0.41,-0.79 0.97,-1.4 1.67,-1.83c0.7,-0.44 1.5,-0.66 2.39,-0.66c1.09,0 2.01,0.25 2.74,0.76c0.75,0.5 1.22,1.21 1.41,2.11l-1.47,0.39c-0.17,-0.56 -0.48,-1 -0.94,-1.32c-0.45,-0.33 -1.03,-0.49 -1.75,-0.49c-0.57,0 -1.09,0.14 -1.57,0.43c-0.48,0.29 -0.85,0.71 -1.13,1.27c-0.28,0.56 -0.42,1.25 -0.42,2.07c0,0.81 0.14,1.5 0.41,2.07c0.28,0.56 0.65,0.98 1.11,1.27c0.47,0.29 0.98,0.43 1.54,0.43c0.57,0 1.06,-0.11 1.47,-0.34c0.42,-0.23 0.75,-0.55 0.99,-0.94c0.25,-0.4 0.41,-0.85 0.46,-1.36h-2.88V7.79h4.37c0,0.87 0,1.74 0,2.6c0,0.87 0,1.74 0,2.6h-1.41v-1.4h-0.08c-0.28,0.49 -0.67,0.88 -1.18,1.18C16.34,13.07 15.73,13.22 15,13.22z"/>
<path
- android:pathData="M 0 0 H 22 V 17 H 0 V 0 Z" />
+ android:fillColor="#FF000000"
+ android:pathData="M24.62 5.24 24.62 2.89 23.32 2.89 23.32 5.24 20.97 5.24 20.97 6.54 23.32 6.54 23.32 8.89 24.62 8.89 24.62 6.54 26.97 6.54 26.97 5.24Z"/>
</vector>
diff --git a/packages/SettingsLib/res/drawable/ic_lte_plus_mobiledata.xml b/packages/SettingsLib/res/drawable/ic_lte_plus_mobiledata.xml
index e5cdff33fe98..d1f4b6fd818b 100644
--- a/packages/SettingsLib/res/drawable/ic_lte_plus_mobiledata.xml
+++ b/packages/SettingsLib/res/drawable/ic_lte_plus_mobiledata.xml
@@ -14,23 +14,20 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="22.94dp"
- android:height="15dp"
- android:viewportWidth="26"
- android:viewportHeight="17">
-
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M1.59,12.4h3.9v1.07H0.33V3.52h1.26V12.4z" />
+ android:width="31dp"
+ android:height="16dp"
+ android:viewportWidth="31.0"
+ android:viewportHeight="16.0">
<path
- android:fillColor="#FFFFFFFF"
- android:pathData="M11.35,4.6H8.73v8.88H7.48V4.6H4.87V3.52h6.48V4.6z" />
+ android:fillColor="#FF000000"
+ android:pathData="M2,13V2.98h1.53v8.57H8.3V13H2z"/>
<path
- android:fillColor="#FFFFFFFF"
- android:pathData="M17.59,8.88h-3.52v3.53h4.1v1.07h-5.35V3.52h5.28V4.6h-4.03V7.8h3.52V8.88z" />
+ android:fillColor="#FF000000"
+ android:pathData="M11.24,13V4.43H8.19V2.98h7.63v1.46h-3.05V13H11.24z"/>
<path
- android:fillColor="#FFFFFFFF"
- android:pathData="M 23.32 5.74 L 23.32 3.39 L 22.02 3.39 L 22.02 5.74 L 19.67 5.74 L 19.67 7.04 L 22.02 7.04 L 22.02 9.39 L 23.32 9.39 L 23.32 7.04 L 25.67 7.04 L 25.67 5.74 Z" />
+ android:fillColor="#FF000000"
+ android:pathData="M17.41,13V2.98h6.36v1.46h-4.83v2.65h4.4v1.46h-4.4v3.01h4.83V13H17.41z"/>
<path
- android:pathData="M 0 0 H 26 V 17 H 0 V 0 Z" />
+ android:fillColor="#FF000000"
+ android:pathData="M28.72 5.24 28.72 2.89 27.42 2.89 27.42 5.24 25.07 5.24 25.07 6.54 27.42 6.54 27.42 8.89 28.72 8.89 28.72 6.54 31.07 6.54 31.07 5.24Z"/>
</vector>
diff --git a/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatteryStatus.java b/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatteryStatus.java
index 132a631e25cc..21fb26976c1b 100644
--- a/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatteryStatus.java
+++ b/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatteryStatus.java
@@ -27,6 +27,7 @@ import static android.os.BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE;
import static android.os.BatteryManager.EXTRA_PLUGGED;
import static android.os.BatteryManager.EXTRA_PRESENT;
import static android.os.BatteryManager.EXTRA_STATUS;
+import static android.os.BatteryManager.EXTRA_OEM_FAST_CHARGER;
import android.content.Context;
import android.content.Intent;
@@ -51,15 +52,17 @@ public class BatteryStatus {
public final int plugged;
public final int health;
public final int maxChargingWattage;
+ public final boolean oemFastChargeStatus;
public final boolean present;
public BatteryStatus(int status, int level, int plugged, int health,
- int maxChargingWattage, boolean present) {
+ int maxChargingWattage, boolean oemFastChargeStatus, boolean present) {
this.status = status;
this.level = level;
this.plugged = plugged;
this.health = health;
this.maxChargingWattage = maxChargingWattage;
+ this.oemFastChargeStatus = oemFastChargeStatus;
this.present = present;
}
@@ -68,6 +71,7 @@ public class BatteryStatus {
plugged = batteryChangedIntent.getIntExtra(EXTRA_PLUGGED, 0);
level = batteryChangedIntent.getIntExtra(EXTRA_LEVEL, 0);
health = batteryChangedIntent.getIntExtra(EXTRA_HEALTH, BATTERY_HEALTH_UNKNOWN);
+ oemFastChargeStatus = batteryChangedIntent.getBooleanExtra(EXTRA_OEM_FAST_CHARGER, false);
present = batteryChangedIntent.getBooleanExtra(EXTRA_PRESENT, true);
final int maxChargingMicroAmp = batteryChangedIntent.getIntExtra(EXTRA_MAX_CHARGING_CURRENT,
@@ -162,6 +166,9 @@ public class BatteryStatus {
* @return the charing speed
*/
public final int getChargingSpeed(Context context) {
+ if (oemFastChargeStatus) {
+ return CHARGING_FAST;
+ }
final int slowThreshold = context.getResources().getInteger(
R.integer.config_chargingSlowlyThreshold);
final int fastThreshold = context.getResources().getInteger(
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index fa455e775b3b..bb1d3d73e91d 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -180,6 +180,7 @@ android_library {
"motion_tool_lib",
],
manifest: "AndroidManifest.xml",
+ additional_manifests: ["IceManifest.xml"],
libs: [
"android.car",
"ims-common",
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 73e49c097b25..aa9764f874fd 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -436,7 +436,7 @@
<activity android:name=".tuner.TunerActivity"
android:enabled="false"
android:icon="@drawable/tuner"
- android:theme="@style/TunerSettings"
+ android:theme="@style/Theme.SubSettingsBase"
android:label="@string/system_ui_tuner"
android:process=":tuner"
android:exported="true">
@@ -453,7 +453,7 @@
<activity-alias android:name=".DemoMode"
android:targetActivity=".tuner.TunerActivity"
android:icon="@drawable/tuner"
- android:theme="@style/TunerSettings"
+ android:theme="@style/Theme.SubSettingsBase"
android:label="@string/demo_mode"
android:process=":tuner"
android:exported="true">
diff --git a/packages/SystemUI/IceManifest.xml b/packages/SystemUI/IceManifest.xml
new file mode 100644
index 000000000000..74638926a7e6
--- /dev/null
+++ b/packages/SystemUI/IceManifest.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (c) 2017 The LineageOS 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.systemui">
+
+ <!-- SystemUI Tuner -->
+ <application>
+ <activity-alias
+ android:name=".tuner.StatusBarTuner"
+ android:targetActivity=".tuner.TunerActivity"
+ android:icon="@drawable/tuner"
+ android:theme="@style/Theme.SubSettingsBase"
+ android:label="@string/status_bar_icons_title"
+ android:process=":tuner"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="com.android.settings.action.STATUS_BAR_TUNER" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity-alias>
+ </application>
+
+</manifest>
diff --git a/packages/SystemUI/customization/res/font/clock.xml b/packages/SystemUI/customization/res/font/clock.xml
new file mode 100644
index 000000000000..5122fe74719b
--- /dev/null
+++ b/packages/SystemUI/customization/res/font/clock.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** Copyright 2020, 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.
+*/
+-->
+
+<!--
+** AOD/LockScreen Clock font.
+** Should include all numeric glyphs in all supported locales.
+** Recommended: font with variable width to support AOD => LS animations
+-->
+<font-family xmlns:android="http://schemas.android.com/apk/res/android">
+ <font android:font="@font/google_sans_clock"/>
+</font-family> \ No newline at end of file
diff --git a/packages/SystemUI/customization/res/font/google_sans_clock.ttf b/packages/SystemUI/customization/res/font/google_sans_clock.ttf
new file mode 100644
index 000000000000..5e683a05088c
--- /dev/null
+++ b/packages/SystemUI/customization/res/font/google_sans_clock.ttf
Binary files differ
diff --git a/packages/SystemUI/customization/res/layout/clock_default_large.xml b/packages/SystemUI/customization/res/layout/clock_default_large.xml
index 0139d50dcfba..415f964a215f 100644
--- a/packages/SystemUI/customization/res/layout/clock_default_large.xml
+++ b/packages/SystemUI/customization/res/layout/clock_default_large.xml
@@ -23,7 +23,7 @@
android:layout_gravity="center"
android:gravity="center_horizontal"
android:textSize="@dimen/large_clock_text_size"
- android:fontFamily="@*android:string/config_clockFontFamily"
+ android:fontFamily="@font/clock"
android:typeface="monospace"
android:elegantTextHeight="false"
chargeAnimationDelay="200"
diff --git a/packages/SystemUI/customization/res/layout/clock_default_small.xml b/packages/SystemUI/customization/res/layout/clock_default_small.xml
index ff6d7f9e2240..eb86ae50cbc9 100644
--- a/packages/SystemUI/customization/res/layout/clock_default_small.xml
+++ b/packages/SystemUI/customization/res/layout/clock_default_small.xml
@@ -23,7 +23,7 @@
android:layout_gravity="start"
android:gravity="start"
android:textSize="@dimen/small_clock_text_size"
- android:fontFamily="@*android:string/config_clockFontFamily"
+ android:fontFamily="@font/clock"
android:elegantTextHeight="false"
android:ellipsize="none"
android:singleLine="true"
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml
index 7c5dbc247428..64657547621f 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml
@@ -38,7 +38,7 @@
android:id="@+id/row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
+ android:orientation="vertical"
android:gravity="start"
/>
</com.android.keyguard.KeyguardSliceView>
diff --git a/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png b/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png
new file mode 100644
index 000000000000..4102e28c1300
--- /dev/null
+++ b/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml b/packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml
new file mode 100644
index 000000000000..7dddc9d0e930
--- /dev/null
+++ b/packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 CypherOS
+
+ 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.
+-->
+<layer-list
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <shape>
+ <solid android:color="#ff1d1d1d" />
+ <corners
+ android:topLeftRadius="@dimen/tri_state_down_top_left_radius"
+ android:topRightRadius="@dimen/tri_state_down_top_right_radius"
+ android:bottomLeftRadius="@dimen/tri_state_down_bottom_left_radius"
+ android:bottomRightRadius="@dimen/tri_state_down_bottom_right_radius" />
+ </shape>
+ </item>
+</layer-list> \ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/dialog_tri_state_middle_bg.xml b/packages/SystemUI/res/drawable/dialog_tri_state_middle_bg.xml
new file mode 100644
index 000000000000..7cde6be2808c
--- /dev/null
+++ b/packages/SystemUI/res/drawable/dialog_tri_state_middle_bg.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 CypherOS
+
+ 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.
+-->
+<layer-list
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <shape>
+ <solid android:color="#ff1d1d1d" />
+ <corners
+ android:topLeftRadius="@dimen/tri_state_mid_top_left_radius"
+ android:topRightRadius="@dimen/tri_state_mid_top_right_radius"
+ android:bottomLeftRadius="@dimen/tri_state_mid_bottom_left_radius"
+ android:bottomRightRadius="@dimen/tri_state_mid_bottom_right_radius" />
+ </shape>
+ </item>
+</layer-list> \ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml b/packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml
new file mode 100644
index 000000000000..69757a77ee86
--- /dev/null
+++ b/packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 CypherOS
+
+ 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.
+-->
+<layer-list
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <shape>
+ <solid android:color="#ff1d1d1d" />
+ <corners
+ android:topLeftRadius="@dimen/tri_state_up_top_left_radius"
+ android:topRightRadius="@dimen/tri_state_up_top_right_radius"
+ android:bottomLeftRadius="@dimen/tri_state_up_bottom_left_radius"
+ android:bottomRightRadius="@dimen/tri_state_up_bottom_right_radius" />
+ </shape>
+ </item>
+</layer-list> \ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/ic_qs_aod.xml b/packages/SystemUI/res/drawable/ic_qs_aod.xml
new file mode 100644
index 000000000000..4bb2d4ac566b
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_aod.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M17,19 L17,5 L7,5 L7,19 L17,19 M17,1 C18.1046,1,19,1.89543,19,3 L19,21 C19,22.1046,18.1046,23,17,23 L7,23 C5.89,23,5,22.1,5,21 L5,3 C5,1.89,5.89,1,7,1 L17,1 M9,7 L15,7 L15,9 L9,9 L9,7" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_brightness_auto.xml b/packages/SystemUI/res/drawable/ic_qs_brightness_auto.xml
new file mode 100644
index 000000000000..1d7f1cdd328c
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_brightness_auto.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 Paranoid Android
+
+ 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.
+-->
+<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/checked"
+ android:drawable="@drawable/ic_qs_brightness_auto_on"
+ android:state_checked="true" />
+
+ <item
+ android:id="@+id/unchecked"
+ android:drawable="@drawable/ic_qs_brightness_auto_off" />
+
+ <transition
+ android:drawable="@drawable/ic_qs_brightness_auto_on_avd"
+ android:fromId="@id/unchecked"
+ android:toId="@id/checked" />
+
+ <transition
+ android:drawable="@drawable/ic_qs_brightness_auto_off_avd"
+ android:fromId="@id/checked"
+ android:toId="@id/unchecked" />
+</animated-selector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_brightness_auto_off.xml b/packages/SystemUI/res/drawable/ic_qs_brightness_auto_off.xml
new file mode 100644
index 000000000000..7ba6ddf5da33
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_brightness_auto_off.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 Paranoid Android
+
+ 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.
+-->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="@dimen/qs_icon_size"
+ android:height="@dimen/qs_icon_size"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:name="sun"
+ android:pathData="M 20 8.69 L 20 4 L 15.31 4 L 12 0.69 L 8.69 4 L 4 4 L 4 8.69 L 0.69 12 L 4 15.31 L 4 20 L 8.69 20 L 12 23.31 L 15.31 20 L 20 20 L 20 15.31 L 23.31 12 L 20 8.69 Z M 18 14.48 L 18 18 L 14.48 18 L 12 20.48 L 9.52 18 L 6 18 L 6 14.48 L 3.52 12 L 6 9.52 L 6 6 L 9.52 6 L 12 3.52 L 14.48 6 L 18 6 L 18 9.52 L 20.48 12 L 18 14.48 Z"
+ android:fillColor="#ffffff" />
+ <group android:name="mask_group">
+ <clip-path
+ android:name="mask"
+ android:pathData="M 18 14.48 L 18 18 L 14.48 18 L 12 20.48 L 9.52 18 L 6 18 L 6 14.48 L 3.52 12 L 6 9.52 L 6 6 L 9.52 6 L 12 3.52 L 14.48 6 L 18 6 L 18 9.52 L 20.48 12 L 18 14.48 Z"/>
+ <group
+ android:name="auto_transform"
+ android:pivotX="12"
+ android:pivotY="12"
+ android:translateX="-24"
+ android:scaleX="0.5"
+ android:scaleY="0.5">
+ <path
+ android:name="auto"
+ android:pathData="M 11 7 L 7.8 16 L 9.7 16 L 10.4 14 L 13.6 14 L 14.3 16 L 16.2 16 L 13 7 L 11 7 Z M 12 9 L 13.15 12.65 L 10.85 12.65 L 12 9 Z"
+ android:fillColor="#ffffff" />
+ </group>
+ <group
+ android:name="manual_transform"
+ android:pivotX="12"
+ android:pivotY="12"
+ android:translateX="0"
+ android:scaleX="1"
+ android:scaleY="1">
+ <path
+ android:name="manual"
+ android:pathData="M 11.994 13.159 L 10.159 7.007 L 7.929 7.007 L 7.929 16 L 9.678 16 L 9.678 12.936 L 9.56 9.809 L 11.314 16 L 12.667 16 L 14.427 9.809 L 14.31 12.936 L 14.31 16 L 16.052 16 L 16.052 7.007 L 13.822 7.007 L 11.994 13.159 Z"
+ android:fillColor="#ffffff" />
+ </group>
+ </group>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_brightness_auto_off_avd.xml b/packages/SystemUI/res/drawable/ic_qs_brightness_auto_off_avd.xml
new file mode 100644
index 000000000000..7b4ee87e8dfa
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_brightness_auto_off_avd.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 Paranoid Android
+
+ 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.
+-->
+<animated-vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:drawable="@drawable/ic_qs_brightness_auto_off">
+ <target android:name="auto_transform">
+ <aapt:attr name="android:animation">
+ <set>
+ <objectAnimator
+ android:propertyName="translateX"
+ android:duration="300"
+ android:valueFrom="0"
+ android:valueTo="24"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ <objectAnimator
+ android:propertyName="scaleX"
+ android:duration="300"
+ android:valueFrom="1"
+ android:valueTo="0.5"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ <objectAnimator
+ android:propertyName="scaleY"
+ android:duration="300"
+ android:valueFrom="1"
+ android:valueTo="0.5"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ </set>
+ </aapt:attr>
+ </target>
+ <target android:name="manual_transform">
+ <aapt:attr name="android:animation">
+ <set>
+ <objectAnimator
+ android:propertyName="translateX"
+ android:duration="300"
+ android:valueFrom="-24"
+ android:valueTo="0"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ <objectAnimator
+ android:propertyName="scaleX"
+ android:duration="300"
+ android:valueFrom="0.5"
+ android:valueTo="1"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ <objectAnimator
+ android:propertyName="scaleY"
+ android:duration="300"
+ android:valueFrom="0.5"
+ android:valueTo="1"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ </set>
+ </aapt:attr>
+ </target>
+</animated-vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_brightness_auto_on.xml b/packages/SystemUI/res/drawable/ic_qs_brightness_auto_on.xml
new file mode 100644
index 000000000000..b746b0aef3ae
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_brightness_auto_on.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 Paranoid Android
+
+ 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.
+-->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:width="@dimen/qs_icon_size"
+ android:height="@dimen/qs_icon_size"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:name="sun"
+ android:pathData="M 20 8.69 L 20 4 L 15.31 4 L 12 0.69 L 8.69 4 L 4 4 L 4 8.69 L 0.69 12 L 4 15.31 L 4 20 L 8.69 20 L 12 23.31 L 15.31 20 L 20 20 L 20 15.31 L 23.31 12 L 20 8.69 Z M 18 14.48 L 18 18 L 14.48 18 L 12 20.48 L 9.52 18 L 6 18 L 6 14.48 L 3.52 12 L 6 9.52 L 6 6 L 9.52 6 L 12 3.52 L 14.48 6 L 18 6 L 18 9.52 L 20.48 12 L 18 14.48 Z"
+ android:fillColor="#ffffff" />
+ <group android:name="mask_group">
+ <clip-path
+ android:name="mask"
+ android:pathData="M 18 14.48 L 18 18 L 14.48 18 L 12 20.48 L 9.52 18 L 6 18 L 6 14.48 L 3.52 12 L 6 9.52 L 6 6 L 9.52 6 L 12 3.52 L 14.48 6 L 18 6 L 18 9.52 L 20.48 12 L 18 14.48 Z"/>
+ <group
+ android:name="auto_transform"
+ android:pivotX="12"
+ android:pivotY="12"
+ android:translateX="0"
+ android:scaleX="1"
+ android:scaleY="1">
+ <path
+ android:name="auto"
+ android:pathData="M 11 7 L 7.8 16 L 9.7 16 L 10.4 14 L 13.6 14 L 14.3 16 L 16.2 16 L 13 7 L 11 7 Z M 12 9 L 13.15 12.65 L 10.85 12.65 L 12 9 Z"
+ android:fillColor="#ffffff" />
+ </group>
+ <group
+ android:name="manual_transform"
+ android:pivotX="12"
+ android:pivotY="12"
+ android:translateX="-24"
+ android:scaleX="0.5"
+ android:scaleY="0.5">
+ <path
+ android:name="manual"
+ android:pathData="M 11.994 13.159 L 10.159 7.007 L 7.929 7.007 L 7.929 16 L 9.678 16 L 9.678 12.936 L 9.56 9.809 L 11.314 16 L 12.667 16 L 14.427 9.809 L 14.31 12.936 L 14.31 16 L 16.052 16 L 16.052 7.007 L 13.822 7.007 L 11.994 13.159 Z"
+ android:fillColor="#ffffff" />
+ </group>
+ </group>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_brightness_auto_on_avd.xml b/packages/SystemUI/res/drawable/ic_qs_brightness_auto_on_avd.xml
new file mode 100644
index 000000000000..82a632d7fa46
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_brightness_auto_on_avd.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 Paranoid Android
+
+ 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.
+-->
+<animated-vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:drawable="@drawable/ic_qs_brightness_auto_on">
+ <target android:name="auto_transform">
+ <aapt:attr name="android:animation">
+ <set>
+ <objectAnimator
+ android:propertyName="translateX"
+ android:duration="300"
+ android:valueFrom="-24"
+ android:valueTo="0"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ <objectAnimator
+ android:propertyName="scaleX"
+ android:duration="300"
+ android:valueFrom="0.5"
+ android:valueTo="1"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ <objectAnimator
+ android:propertyName="scaleY"
+ android:duration="300"
+ android:valueFrom="0.5"
+ android:valueTo="1"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ </set>
+ </aapt:attr>
+ </target>
+ <target android:name="manual_transform">
+ <aapt:attr name="android:animation">
+ <set>
+ <objectAnimator
+ android:propertyName="translateX"
+ android:duration="300"
+ android:valueFrom="0"
+ android:valueTo="24"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ <objectAnimator
+ android:propertyName="scaleX"
+ android:duration="300"
+ android:valueFrom="1"
+ android:valueTo="0.5"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ <objectAnimator
+ android:propertyName="scaleY"
+ android:duration="300"
+ android:valueFrom="1"
+ android:valueTo="0.5"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+ </set>
+ </aapt:attr>
+ </target>
+</animated-vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_caffeine.xml b/packages/SystemUI/res/drawable/ic_qs_caffeine.xml
new file mode 100644
index 000000000000..2c3ba974a7e1
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_caffeine.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+ Copyright (c) 2017 The LineageOS 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M2,21H20V19H2M20,8H18V5H20M20,3H4V13A4,4 0 0,0 8,17H14A4,4 0 0,0 18,13V10H20A2,2 0 0,0 22,8V5C22,3.89 21.1,3 20,3Z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_heads_up.xml b/packages/SystemUI/res/drawable/ic_qs_heads_up.xml
new file mode 100644
index 000000000000..b107602787c1
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_heads_up.xml
@@ -0,0 +1,36 @@
+<!--
+Copyright (C) 2014 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="64dp"
+ android:height="64dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M18,16v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-0.83-0.68-1.5-1.51-1.5S10.5,3.17,10.5,4v0.68C7.63,5.36,6,7.92,6,11v5 l-1.3,1.29C4.07,17.92,4.51,19,5.4,19h13.17c0.89,0,1.34-1.08,0.71-1.71L18,16z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M11.99,22c1.1,0,2-0.9,2-2h-4C9.99,21.1,10.88,22,11.99,22z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M6.77,4.73C7.19,4.35,7.2,3.7,6.8,3.3l0,0c-0.38-0.38-1-0.39-1.39-0.02C3.7,4.84,2.52,6.96,2.14,9.34 C2.05,9.95,2.52,10.5,3.14,10.5h0c0.48,0,0.9-0.35,0.98-0.83C4.42,7.73,5.38,6,6.77,4.73z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M18.6,3.28c-0.4-0.37-1.02-0.36-1.4,0.02l0,0c-0.4,0.4-0.38,1.04,0.03,1.42c1.38,1.27,2.35,3,2.65,4.94 c0.07,0.48,0.49,0.83,0.98,0.83c0.61,0,1.09-0.55,0.99-1.16C21.47,6.96,20.3,4.85,18.6,3.28z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_speaker_group_24dp.xml b/packages/SystemUI/res/drawable/ic_speaker_group_24dp.xml
new file mode 100644
index 000000000000..37475e52010a
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_speaker_group_24dp.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright (C) 2020-2022 The Android Open Source Project
+
+ SPDX-License-Identifier: Apache-2.0
+-->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?android:attr/colorBackgroundFloating">
+ <path
+ android:pathData="M18.2,1L9.8,1C8.81,1 8,1.81 8,2.8v14.4c0,0.99 0.81,1.79 1.8,1.79l8.4,0.01c0.99,0 1.8,-0.81 1.8,-1.8L20,2.8c0,-0.99 -0.81,-1.8 -1.8,-1.8zM14,3c1.1,0 2,0.89 2,2s-0.9,2 -2,2 -2,-0.89 -2,-2 0.9,-2 2,-2zM14,16.5c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4 4,1.79 4,4 -1.79,4 -4,4z"
+ android:fillColor="@android:color/white"/>
+ <path
+ android:pathData="M14,12.5m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0"
+ android:fillColor="@android:color/white"/>
+ <path
+ android:pathData="M6,5H4v16c0,1.1 0.89,2 2,2h10v-2H6V5z"
+ android:fillColor="@android:color/white"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_airplanemode.xml b/packages/SystemUI/res/drawable/ic_statusbar_airplanemode.xml
new file mode 100644
index 000000000000..7ade8b215590
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_airplanemode.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2017 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:pathData="M21,16v-2l-8,-5V3.5C13,2.67 12.33,2 11.5,2S10,2.67 10,3.5V9l-8,5v2l8,-2.5V19l-2,1.5V22l3.5,-1l3.5,1v-1.5L13,19v-5.5L21,16z"
+ android:fillColor="#FFFFFFFF"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_alarm.xml b/packages/SystemUI/res/drawable/ic_statusbar_alarm.xml
new file mode 100644
index 000000000000..4d0a5f8c7346
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_alarm.xml
@@ -0,0 +1,25 @@
+<!--
+Copyright (C) 2014 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M44.0,11.44l-9.19,-7.71 -2.57,3.06 9.19,7.71 2.57,-3.06zm-28.24,-4.66l-2.57,-3.06 -9.19,7.71 2.57,3.06 9.19,-7.71zm9.24,9.22l-3.0,0.0l0.0,12.0l9.49,5.71 1.51,-2.47 -8.0,-4.74l0.0,-10.5zm-1.01,-8.0c-9.95,0.0 -17.99,8.06 -17.99,18.0s8.04,18.0 17.99,18.0 18.01,-8.06 18.01,-18.0 -8.06,-18.0 -18.01,-18.0zm0.01,32.0c-7.73,0.0 -14.0,-6.27 -14.0,-14.0s6.27,-14.0 14.0,-14.0 14.0,6.27 14.0,14.0 -6.26,14.0 -14.0,14.0z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_auto_rotate.xml b/packages/SystemUI/res/drawable/ic_statusbar_auto_rotate.xml
new file mode 100644
index 000000000000..9a2cb496d282
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_auto_rotate.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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.
+-->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M7.4,10.94H2.45V5.99l2,0.01v1.53l4.61,-4.61c0.64,-0.64 1.67,-0.66 2.29,-0.04l8.18,8.18h-2.83l-6.48,-6.48L5.86,8.95H7.4V10.94zM16.6,13.06l0.01,2h1.53l-4.36,4.36l-6.48,-6.48H4.46l8.19,8.19c0.62,0.62 1.65,0.6 2.29,-0.04l4.61,-4.61l0.01,0.01v1.53h1.99v-4.95H16.6z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_camera.xml b/packages/SystemUI/res/drawable/ic_statusbar_camera.xml
new file mode 100644
index 000000000000..32d6b5326ffc
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_camera.xml
@@ -0,0 +1,25 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M20,5h-3.17L15,3H9L7.17,5H4C2.9,5 2,5.9 2,7v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V7C22,5.9 21.1,5 20,5zM20,19H4V7h16V19zM12,9c-2.21,0 -4,1.79 -4,4c0,2.21 1.79,4 4,4s4,-1.79 4,-4C16,10.79 14.21,9 12,9z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_cast.xml b/packages/SystemUI/res/drawable/ic_statusbar_cast.xml
new file mode 100644
index 000000000000..5413c77215df
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_cast.xml
@@ -0,0 +1,25 @@
+<!--
+Copyright (C) 2017 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M21,3L3,3c-1.1,0 -2,0.9 -2,2v3h2L3,5h18v14h-7v2h7c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM1,18v3h3c0,-1.66 -1.34,-3 -3,-3zM1,14v2c2.76,0 5,2.24 5,5h2c0,-3.87 -3.13,-7 -7,-7zM1,10v2c4.97,0 9,4.03 9,9h2c0,-6.08 -4.93,-11 -11,-11z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_clock.xml b/packages/SystemUI/res/drawable/ic_statusbar_clock.xml
new file mode 100644
index 000000000000..4b91508d2eb1
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_clock.xml
@@ -0,0 +1,28 @@
+<!--
+ Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M11.99,2.0C6.47,2.0 2.0,6.48 2.0,12.0s4.47,10.0 9.99,10.0C17.52,22.0 22.0,17.52 22.0,12.0S17.52,2.0 11.99,2.0zM12.0,20.0c-4.42,0.0 -8.0,-3.58 -8.0,-8.0s3.58,-8.0 8.0,-8.0 8.0,3.58 8.0,8.0 -3.58,8.0 -8.0,8.0z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12.5,7.0L11.0,7.0l0.0,6.0l5.25,3.1 0.75,-1.23 -4.5,-2.67z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_do_not_disturb.xml b/packages/SystemUI/res/drawable/ic_statusbar_do_not_disturb.xml
new file mode 100644
index 000000000000..cace8d4433f5
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_do_not_disturb.xml
@@ -0,0 +1,28 @@
+<!--
+ 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10c5.52,0 10,-4.48 10,-10C22,6.48 17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8c0,-4.41 3.59,-8 8,-8c4.41,0 8,3.59 8,8C20,16.41 16.41,20 12,20z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M7,11h10v2h-10z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_ethernet.xml b/packages/SystemUI/res/drawable/ic_statusbar_ethernet.xml
new file mode 100644
index 000000000000..46e753fd7eb8
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_ethernet.xml
@@ -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.
+ -->
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M17,6l-1.41,1.41L20.17,12l-4.58,4.59L17,18l6,-6zM8.41,7.41L7,6l-6,6 6,6 1.41,-1.41L3.83,12z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M8,12m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,12m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M16,12m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"/>
+ </vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_headset.xml b/packages/SystemUI/res/drawable/ic_statusbar_headset.xml
new file mode 100644
index 000000000000..ad9a55fcc5e2
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_headset.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2016 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M19,15v3c0,0.55 -0.45,1 -1,1h-1v-4h2M7,15v4H6c-0.55,0 -1,-0.45 -1,-1v-3h2m5,-13c-4.97,0 -9,4.03 -9,9v7c0,1.66 1.34,3 3,3h3v-8H5v-2c0,-3.87 3.13,-7 7,-7s7,3.13 7,7v2h-4v8h3c1.66,0 3,-1.34 3,-3v-7c0,-4.97 -4.03,-9 -9,-9z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_hotspot.xml b/packages/SystemUI/res/drawable/ic_statusbar_hotspot.xml
new file mode 100644
index 000000000000..37f5ea9075ae
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_hotspot.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,7c-3.31,0-6,2.69-6,6c0,1.66,0.68,3.15,1.76,4.24l1.42-1.42C8.45,15.1,8,14.11,8,13c0-2.21,1.79-4,4-4s4,1.79,4,4 c0,1.11-0.45,2.1-1.18,2.82l1.42,1.42C17.32,16.15,18,14.66,18,13C18,9.69,15.31,7,12,7z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,3C6.48,3,2,7.48,2,13c0,2.76,1.12,5.26,2.93,7.07l1.41-1.41C4.9,17.21,4,15.21,4,13c0-4.42,3.58-8,8-8s8,3.58,8,8 c0,2.21-0.9,4.2-2.35,5.65l1.41,1.41C20.88,18.26,22,15.76,22,13C22,7.48,17.52,3,12,3z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,11c-1.1,0-2,0.9-2,2c0,0.55,0.23,1.05,0.59,1.41C10.95,14.77,11.45,15,12,15s1.05-0.23,1.41-0.59 C13.77,14.05,14,13.55,14,13C14,11.9,13.1,11,12,11z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_mobile_network.xml b/packages/SystemUI/res/drawable/ic_statusbar_mobile_network.xml
new file mode 100644
index 000000000000..1f24717a1512
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_mobile_network.xml
@@ -0,0 +1,26 @@
+<!--
+ Copyright (C) 2017 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:autoMirrored="true"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:pathData="m3.8,22l17.19,0c0.55,0 1.01,-0.45 1.01,-1.01l0,-17.19c0,-0.71 -0.87,-1.08 -1.38,-0.57l-17.38,17.39c-0.51,0.51 -0.15,1.38 0.56,1.38z"
+ android:fillColor="#FFFFFFFF"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_mute.xml b/packages/SystemUI/res/drawable/ic_statusbar_mute.xml
new file mode 100644
index 000000000000..c63aeea9489e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_mute.xml
@@ -0,0 +1,26 @@
+<!--
+Copyright (C) 2014 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M11.5,22.0c1.1,0.0 2.0,-0.9 2.0,-2.0l-4.0,0.0C9.5,21.1 10.4,22.0 11.5,22.0zM18.0,10.5c0.0,-3.1 -2.1,-5.6 -5.0,-6.3L13.0,3.5C13.0,2.7 12.3,2.0 11.5,2.0C10.7,2.0 10.0,2.7 10.0,3.5l0.0,0.7C9.5,4.3 9.0,4.5 8.6,4.7l9.4,9.4L18.0,10.5zM17.7,19.0l2.0,2.0l1.3,-1.3L4.3,3.0L3.0,4.3l2.9,2.9C5.3,8.2 5.0,9.3 5.0,10.5L5.0,16.0l-2.0,2.0l0.0,1.0L17.7,19.0z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_priority.xml b/packages/SystemUI/res/drawable/ic_statusbar_priority.xml
new file mode 100644
index 000000000000..adcbbe932ec6
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_priority.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 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.
+-->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M15,19L3,19l4.5,-7L3,5h12c0.65,0 1.26,0.31 1.63,0.84L21,12l-4.37,6.16c-0.37,0.52 -0.98,0.84 -1.63,0.84zM6.5,17L15,17l3.5,-5L15,7L6.5,7l3.5,5 -3.5,5z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_vibrate.xml b/packages/SystemUI/res/drawable/ic_statusbar_vibrate.xml
new file mode 100644
index 000000000000..dfa60992ba51
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_vibrate.xml
@@ -0,0 +1,26 @@
+<!--
+Copyright (C) 2014 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M0.0,15.0l2.0,0.0L2.0,9.0L0.0,9.0L0.0,15.0zM3.0,17.0l2.0,0.0L5.0,7.0L3.0,7.0L3.0,17.0zM22.0,9.0l0.0,6.0l2.0,0.0L24.0,9.0L22.0,9.0zM19.0,17.0l2.0,0.0L21.0,7.0l-2.0,0.0L19.0,17.0zM16.5,3.0l-9.0,0.0C6.7,3.0 6.0,3.7 6.0,4.5l0.0,15.0C6.0,20.3 6.7,21.0 7.5,21.0l9.0,0.0c0.8,0.0 1.5,-0.7 1.5,-1.5l0.0,-15.0C18.0,3.7 17.3,3.0 16.5,3.0zM16.0,19.0L8.0,19.0L8.0,5.0l8.0,0.0L16.0,19.0z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_wifi.xml b/packages/SystemUI/res/drawable/ic_statusbar_wifi.xml
new file mode 100644
index 000000000000..e56e9512c9b5
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_wifi.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M24,7.39L12,22L0,7.39C2.97,4.08,7.25,2,12,2S21.03,4.08,24,7.39z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_work.xml b/packages/SystemUI/res/drawable/ic_statusbar_work.xml
new file mode 100644
index 000000000000..ea8918b1ca12
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_work.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+~ Copyright (C) 2019 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:pathData="M20,6h-4L16,4c0,-1.11 -0.89,-2 -2,-2h-4c-1.11,0 -2,0.89 -2,2v2L4,6c-1.11,0 -1.99,0.89 -1.99,2L2,19c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2zM12,15c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM14,6h-4L10,4h4v2z"
+ android:fillColor="#FFFFFFFF"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_vpn_key.xml b/packages/SystemUI/res/drawable/ic_vpn_key.xml
new file mode 100644
index 000000000000..c2a7e342397e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_vpn_key.xml
@@ -0,0 +1,28 @@
+<!--
+ Copyright (C) 2017 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12.09,9C11.11,7.5 9.43,6.5 7.5,6.5C4.46,6.5 2,8.96 2,12c0,3.04 2.46,5.5 5.5,5.5c1.93,0 3.61,-1 4.59,-2.5H14v3h6v-3h2V9H12.09zM20,13h-2v3h-2v-3h-5.16c-0.43,1.44 -1.76,2.5 -3.34,2.5C5.57,15.5 4,13.93 4,12c0,-1.93 1.57,-3.5 3.5,-3.5c1.58,0 2.9,1.06 3.34,2.5H20V13z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M7.5,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_dnd.xml b/packages/SystemUI/res/drawable/stat_sys_dnd.xml
index aa352b42cf04..da861eb72845 100644
--- a/packages/SystemUI/res/drawable/stat_sys_dnd.xml
+++ b/packages/SystemUI/res/drawable/stat_sys_dnd.xml
@@ -17,6 +17,6 @@
*/
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:insetLeft="2.5dp"
- android:insetRight="2.5dp"
+ android:insetLeft="0dp"
+ android:insetRight="0dp"
android:drawable="@*android:drawable/ic_qs_dnd" /> \ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml b/packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml
index a8f0cc3a1d92..1a0599107f69 100644
--- a/packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml
+++ b/packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml
@@ -14,8 +14,8 @@ Copyright (C) 2015 The Android Open Source Project
limitations under the License.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:insetLeft="3dp"
- android:insetRight="3dp">
+ android:insetLeft="0.5dp"
+ android:insetRight="0.5dp">
<vector android:width="18dp"
android:height="18dp"
android:viewportWidth="24.0"
diff --git a/packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml b/packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml
index 21a4c1703d31..5d196846822a 100644
--- a/packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml
+++ b/packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml
@@ -14,6 +14,6 @@
limitations under the License.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:insetLeft="2.5dp"
- android:insetRight="2.5dp"
- android:drawable="@drawable/ic_volume_ringer_vibrate" /> \ No newline at end of file
+ android:insetLeft="0dp"
+ android:insetRight="0dp"
+ android:drawable="@drawable/ic_volume_ringer_vibrate" />
diff --git a/packages/SystemUI/res/drawable/volume_background.xml b/packages/SystemUI/res/drawable/volume_background.xml
new file mode 100644
index 000000000000..671d45ce9006
--- /dev/null
+++ b/packages/SystemUI/res/drawable/volume_background.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 The LineageOS Project
+
+ SPDX-License-Identifier: Apache-2.0
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <size android:width="@dimen/volume_dialog_panel_width" />
+ <solid android:color="?androidprv:attr/colorSurface" />
+</shape>
diff --git a/packages/SystemUI/res/layout-land/volume_dialog.xml b/packages/SystemUI/res/layout-land/volume_dialog.xml
index 3b70dc060e84..6242ac17b975 100644
--- a/packages/SystemUI/res/layout-land/volume_dialog.xml
+++ b/packages/SystemUI/res/layout-land/volume_dialog.xml
@@ -25,14 +25,14 @@
android:background="@android:color/transparent"
android:theme="@style/volume_dialog_theme">
- <!-- right-aligned to be physically near volume button -->
- <LinearLayout
+ <com.android.systemui.animation.view.LaunchableLinearLayout
android:id="@+id/volume_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_gravity="right"
- android:layout_marginRight="@dimen/volume_dialog_panel_transparent_padding_right"
+ android:paddingLeft="@dimen/volume_dialog_panel_transparent_padding_horizontal"
+ android:paddingRight="@dimen/volume_dialog_panel_transparent_padding_horizontal"
android:orientation="vertical"
android:clipToPadding="false"
android:clipChildren="false">
@@ -99,13 +99,12 @@
android:id="@+id/settings_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="@drawable/volume_background_bottom"
+ android:background="@drawable/volume_background"
android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding"
- android:paddingBottom="@dimen/volume_dialog_ringer_rows_padding"
android:paddingRight="@dimen/volume_dialog_ringer_rows_padding">
<com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/settings"
- android:src="@drawable/horizontal_ellipsis"
+ android:src="@drawable/ic_speaker_group_24dp"
android:layout_width="@dimen/volume_dialog_tap_target_size"
android:layout_height="@dimen/volume_dialog_tap_target_size"
android:layout_gravity="center"
@@ -114,6 +113,38 @@
android:tint="?androidprv:attr/colorAccent"
android:soundEffectsEnabled="false" />
</FrameLayout>
+ <FrameLayout
+ android:id="@+id/expandable_indicator_container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/volume_background_bottom"
+ android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding"
+ android:paddingBottom="@dimen/volume_dialog_ringer_rows_padding"
+ android:paddingRight="@dimen/volume_dialog_ringer_rows_padding">
+ <com.android.systemui.statusbar.phone.ExpandableIndicator
+ android:id="@+id/expandable_indicator"
+ android:layout_width="@dimen/volume_dialog_tap_target_size"
+ android:layout_height="@dimen/volume_dialog_tap_target_size"
+ android:layout_gravity="center"
+ android:contentDescription="@string/accessibility_volume_settings"
+ android:background="@drawable/ripple_drawable_20dp"
+ android:tint="?androidprv:attr/colorAccent"
+ android:soundEffectsEnabled="false"
+ android:padding="10dp"
+ android:rotation="90" />
+ </FrameLayout>
+ <FrameLayout
+ android:id="@+id/rounded_border_bottom"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/volume_background_bottom"
+ android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding"
+ android:paddingRight="@dimen/volume_dialog_ringer_rows_padding">
+ <View
+ android:layout_width="0dp"
+ android:layout_height="32dp"
+ android:background="@drawable/ripple_drawable_20dp"/>
+ </FrameLayout>
</LinearLayout>
</LinearLayout>
@@ -138,7 +169,7 @@
android:layout_gravity="center"
android:soundEffectsEnabled="false" />
</FrameLayout>
- </LinearLayout>
+ </com.android.systemui.animation.view.LaunchableLinearLayout>
<ViewStub
android:id="@+id/odi_captions_tooltip_stub"
@@ -147,6 +178,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom | right"
- android:layout_marginRight="@dimen/volume_tool_tip_right_margin"/>
+ android:layout_marginLeft="@dimen/volume_tool_tip_horizontal_margin"
+ android:layout_marginRight="@dimen/volume_tool_tip_horizontal_margin"/>
</FrameLayout> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/quick_settings_auto_brightness.xml b/packages/SystemUI/res/layout/quick_settings_auto_brightness.xml
new file mode 100644
index 000000000000..83a221eb7a86
--- /dev/null
+++ b/packages/SystemUI/res/layout/quick_settings_auto_brightness.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 Paranoid Android
+
+ 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.
+-->
+<com.android.systemui.settings.brightness.ToggleIconView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/toggle"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_marginStart="8dp"
+ android:button="@null"
+ android:foreground="@drawable/ic_qs_brightness_auto"
+ android:foregroundGravity="center"
+ android:background="@drawable/qs_tile_background"
+ android:clipToOutline="true" />
diff --git a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml
index e95c6a79733c..df8a56fa0845 100644
--- a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml
+++ b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml
@@ -19,14 +19,16 @@
android:layout_width="match_parent"
android:layout_height="@dimen/brightness_mirror_height"
android:layout_gravity="center"
+ android:orientation="horizontal"
android:contentDescription="@string/accessibility_brightness"
android:importantForAccessibility="no" >
<com.android.systemui.settings.brightness.ToggleSeekBar
android:id="@+id/slider"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
+ android:layout_weight="1"
android:minHeight="48dp"
android:thumb="@null"
android:background="@null"
diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
index 1749ed403c09..0c43573ddc3e 100644
--- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
+++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
@@ -43,6 +43,11 @@
android:focusable="true"
android:paddingBottom="@dimen/qqs_layout_padding_bottom"
android:importantForAccessibility="no">
+
+ <FrameLayout
+ android:id="@+id/qs_brightness_dialog"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
</com.android.systemui.qs.QuickQSPanel>
</com.android.systemui.qs.QuickStatusBarHeader>
diff --git a/packages/SystemUI/res/layout/super_notification_shade.xml b/packages/SystemUI/res/layout/super_notification_shade.xml
index 4abc1769ab54..47a32dab873e 100644
--- a/packages/SystemUI/res/layout/super_notification_shade.xml
+++ b/packages/SystemUI/res/layout/super_notification_shade.xml
@@ -30,6 +30,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
+ sysui:ignoreLeftInset="true"
sysui:ignoreRightInset="true"
>
<ImageView android:id="@+id/backdrop_back"
@@ -48,6 +49,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAccessibility="no"
+ sysui:ignoreLeftInset="true"
sysui:ignoreRightInset="true"
/>
diff --git a/packages/SystemUI/res/layout/tri_state_dialog.xml b/packages/SystemUI/res/layout/tri_state_dialog.xml
new file mode 100644
index 000000000000..cf3890d59a88
--- /dev/null
+++ b/packages/SystemUI/res/layout/tri_state_dialog.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 CypherOS
+
+ 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.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:paddingLeft="@dimen/tri_state_dialog_padding"
+ android:paddingTop="@dimen/tri_state_dialog_padding"
+ android:paddingRight="@dimen/tri_state_dialog_padding"
+ android:paddingBottom="@dimen/tri_state_dialog_padding"
+ android:clipToPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true">
+
+ <LinearLayout
+ android:layout_gravity="center|right"
+ android:orientation="horizontal"
+ android:id="@+id/tri_state_layout"
+ android:background="@drawable/dialog_tri_state_middle_bg"
+ android:layout_width="wrap_content"
+ android:layout_height="48.0dip"
+ android:translationZ="@dimen/tri_state_dialog_elevation">
+
+ <FrameLayout
+ android:layout_width="54.0dip"
+ android:layout_height="fill_parent">
+
+ <ImageView
+ android:layout_gravity="center"
+ android:id="@+id/tri_state_icon"
+ android:layout_marginLeft="2.0dip"
+ android:layout_width="@dimen/tri_state_dialog_icon_size"
+ android:layout_height="@dimen/tri_state_dialog_icon_size" />
+ </FrameLayout>
+
+ <TextView
+ android:gravity="center_vertical"
+ android:id="@+id/tri_state_text"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ style="@style/TriStateUiText" />
+
+ <FrameLayout
+ android:layout_width="18.0dip"
+ android:layout_height="fill_parent" />
+ </LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/tuner_activity.xml b/packages/SystemUI/res/layout/tuner_activity.xml
index 83cbf14edd39..7e91267d7ae6 100644
--- a/packages/SystemUI/res/layout/tuner_activity.xml
+++ b/packages/SystemUI/res/layout/tuner_activity.xml
@@ -20,13 +20,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
- <Toolbar
- android:id="@+id/action_bar"
- style="?android:attr/actionBarStyle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:theme="?android:attr/actionBarTheme"
- android:navigationContentDescription="@*android:string/action_bar_up_description" />
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout/udfps_view.xml b/packages/SystemUI/res/layout/udfps_view.xml
index 257d238f5c54..0fcbfa161ddf 100644
--- a/packages/SystemUI/res/layout/udfps_view.xml
+++ b/packages/SystemUI/res/layout/udfps_view.xml
@@ -28,4 +28,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
+ <com.android.systemui.biometrics.UdfpsSurfaceView
+ android:id="@+id/hbm_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="invisible"/>
+
</com.android.systemui.biometrics.UdfpsView>
diff --git a/packages/SystemUI/res/layout/volume_dialog.xml b/packages/SystemUI/res/layout/volume_dialog.xml
index 6a192d4b7e05..42988b6bc73e 100644
--- a/packages/SystemUI/res/layout/volume_dialog.xml
+++ b/packages/SystemUI/res/layout/volume_dialog.xml
@@ -25,14 +25,14 @@
android:clipToPadding="false"
android:theme="@style/volume_dialog_theme">
- <!-- right-aligned to be physically near volume button -->
- <LinearLayout
+ <com.android.systemui.animation.view.LaunchableLinearLayout
android:id="@+id/volume_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_gravity="right"
- android:layout_marginRight="@dimen/volume_dialog_panel_transparent_padding_right"
+ android:paddingLeft="@dimen/volume_dialog_panel_transparent_padding_horizontal"
+ android:paddingRight="@dimen/volume_dialog_panel_transparent_padding_horizontal"
android:orientation="vertical"
android:clipToPadding="false"
android:clipChildren="false">
@@ -98,13 +98,12 @@
android:id="@+id/settings_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="@drawable/volume_background_bottom"
+ android:background="@drawable/volume_background"
android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding"
- android:paddingBottom="@dimen/volume_dialog_ringer_rows_padding"
android:paddingRight="@dimen/volume_dialog_ringer_rows_padding">
<com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/settings"
- android:src="@drawable/horizontal_ellipsis"
+ android:src="@drawable/ic_speaker_group_24dp"
android:layout_width="@dimen/volume_dialog_tap_target_size"
android:layout_height="@dimen/volume_dialog_tap_target_size"
android:layout_gravity="center"
@@ -113,6 +112,38 @@
android:tint="?androidprv:attr/colorAccent"
android:soundEffectsEnabled="false" />
</FrameLayout>
+ <FrameLayout
+ android:id="@+id/expandable_indicator_container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/volume_background_bottom"
+ android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding"
+ android:paddingBottom="@dimen/volume_dialog_ringer_rows_padding"
+ android:paddingRight="@dimen/volume_dialog_ringer_rows_padding">
+ <com.android.systemui.statusbar.phone.ExpandableIndicator
+ android:id="@+id/expandable_indicator"
+ android:layout_width="@dimen/volume_dialog_tap_target_size"
+ android:layout_height="@dimen/volume_dialog_tap_target_size"
+ android:layout_gravity="center"
+ android:contentDescription="@string/accessibility_volume_settings"
+ android:background="@drawable/ripple_drawable_20dp"
+ android:tint="?androidprv:attr/colorAccent"
+ android:soundEffectsEnabled="false"
+ android:padding="10dp"
+ android:rotation="90" />
+ </FrameLayout>
+ <FrameLayout
+ android:id="@+id/rounded_border_bottom"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/volume_background_bottom"
+ android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding"
+ android:paddingRight="@dimen/volume_dialog_ringer_rows_padding">
+ <View
+ android:layout_width="0dp"
+ android:layout_height="32dp"
+ android:background="@drawable/ripple_drawable_20dp"/>
+ </FrameLayout>
</LinearLayout>
</LinearLayout>
@@ -137,7 +168,7 @@
android:layout_gravity="center"
android:soundEffectsEnabled="false"/>
</FrameLayout>
- </LinearLayout>
+ </com.android.systemui.animation.view.LaunchableLinearLayout>
<ViewStub
android:id="@+id/odi_captions_tooltip_stub"
@@ -146,6 +177,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom | right"
- android:layout_marginRight="@dimen/volume_tool_tip_right_margin"/>
+ android:layout_marginLeft="@dimen/volume_tool_tip_horizontal_margin"
+ android:layout_marginRight="@dimen/volume_tool_tip_horizontal_margin"/>
</FrameLayout> \ No newline at end of file
diff --git a/packages/SystemUI/res/values-land/config.xml b/packages/SystemUI/res/values-land/config.xml
index d800d49634d2..c5b4de0b65e9 100644
--- a/packages/SystemUI/res/values-land/config.xml
+++ b/packages/SystemUI/res/values-land/config.xml
@@ -23,7 +23,7 @@
<!-- The maximum number of rows in the QuickSettings -->
<integer name="quick_settings_max_rows">2</integer>
- <integer name="quick_settings_num_columns">4</integer>
+ <integer name="quick_settings_num_columns">2</integer>
<!-- The number of columns that the top level tiles span in the QuickSettings -->
<integer name="quick_settings_user_time_settings_tile_span">2</integer>
@@ -42,4 +42,10 @@
<!-- Whether we use large screen shade header which takes only one row compared to QS header -->
<bool name="config_use_large_screen_shade_header">true</bool>
+ <!-- Whether to use the split 2-column notification shade -->
+ <bool name="config_use_split_notification_shade">true</bool>
+
+ <!-- Notifications are sized to match the width of two (of 4) qs tiles in landscape. -->
+ <bool name="config_skinnyNotifsInLandscape">false</bool>
+
</resources>
diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml
index 908aac4a7b7f..a067d510b7af 100644
--- a/packages/SystemUI/res/values-land/dimens.xml
+++ b/packages/SystemUI/res/values-land/dimens.xml
@@ -63,6 +63,13 @@
<dimen name="large_dialog_width">348dp</dimen>
<dimen name="qs_panel_padding_top">@dimen/qqs_layout_margin_top</dimen>
+ <dimen name="qs_content_horizontal_padding">24dp</dimen>
+ <dimen name="qs_horizontal_margin">24dp</dimen>
+ <!-- in split shade qs_tiles_page_horizontal_margin should be equal of qs_horizontal_margin/2,
+ otherwise full space between two pages is qs_horizontal_margin*2, and that makes tiles page
+ not appear immediately after user swipes to the side -->
+ <dimen name="qs_tiles_page_horizontal_margin">12dp</dimen>
+ <dimen name="qs_header_system_icons_area_height">0dp</dimen>
<dimen name="controls_header_horizontal_padding">12dp</dimen>
<dimen name="controls_content_margin_horizontal">16dp</dimen>
diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml
index e346fe4ab3ef..54c81bc7b10d 100644
--- a/packages/SystemUI/res/values/attrs.xml
+++ b/packages/SystemUI/res/values/attrs.xml
@@ -92,6 +92,7 @@
</declare-styleable>
<declare-styleable name="StatusBarWindowView_Layout">
+ <attr name="ignoreLeftInset" format="boolean" />
<attr name="ignoreRightInset" format="boolean" />
</declare-styleable>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 7aa1a67cef84..1140129c37bc 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -81,7 +81,7 @@
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
<string name="quick_settings_tiles_stock" translatable="false">
- internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling
+ internet,bt,flashlight,dnd,alarm,airplane,nfc,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,aod,caffeine,heads_up
</string>
<!-- The tiles to display in QuickSettings -->
@@ -787,14 +787,12 @@
<!-- Icons that don't show in a collapsed non-keyguard statusbar -->
<string-array name="config_collapsed_statusbar_icon_blocklist" translatable="false">
<item>@*android:string/status_bar_volume</item>
- <item>@*android:string/status_bar_alarm_clock</item>
<item>@*android:string/status_bar_call_strength</item>
</string-array>
<!-- Icons that don't show in a collapsed statusbar on keyguard -->
<string-array name="config_keyguard_statusbar_icon_blocklist" translatable="false">
<item>@*android:string/status_bar_volume</item>
- <item>@*android:string/status_bar_alarm_clock</item>
<item>@*android:string/status_bar_call_strength</item>
</string-array>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index adc4c555dfac..67ef241ac2b4 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -490,7 +490,7 @@
<dimen name="brightness_mirror_height">48dp</dimen>
- <dimen name="volume_dialog_panel_transparent_padding_right">8dp</dimen>
+ <dimen name="volume_dialog_panel_transparent_padding_horizontal">8dp</dimen>
<dimen name="volume_dialog_panel_transparent_padding">20dp</dimen>
@@ -529,7 +529,7 @@
<dimen name="volume_dialog_background_blur_radius">0dp</dimen>
- <dimen name="volume_tool_tip_right_margin">76dp</dimen>
+ <dimen name="volume_tool_tip_horizontal_margin">76dp</dimen>
<dimen name="volume_tool_tip_arrow_corner_radius">2dp</dimen>
diff --git a/packages/SystemUI/res/values/ice_config.xml b/packages/SystemUI/res/values/ice_config.xml
new file mode 100644
index 000000000000..563d63f7ac2a
--- /dev/null
+++ b/packages/SystemUI/res/values/ice_config.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright (C) 2022 Project ICE
+
+ 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.
+-->
+<resources>
+ <!-- Color of the UDFPS pressed view -->
+ <color name="config_udfpsColor">#ffffffff</color>
+
+ <!-- Allow devices override audio panel location to the left side -->
+ <bool name="config_audioPanelOnLeftSide">false</bool>
+</resources>
diff --git a/packages/SystemUI/res/values/ice_dimens.xml b/packages/SystemUI/res/values/ice_dimens.xml
new file mode 100644
index 000000000000..f81dc4ae7797
--- /dev/null
+++ b/packages/SystemUI/res/values/ice_dimens.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Project ICE
+
+ 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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Alert Slider -->
+ <dimen name="tri_state_down_dialog_position">0px</dimen>
+ <dimen name="tri_state_down_dialog_position_l">0px</dimen>
+ <dimen name="tri_state_middle_dialog_position">0px</dimen>
+ <dimen name="tri_state_middle_dialog_position_l">0px</dimen>
+ <dimen name="tri_state_up_dialog_position">0px</dimen>
+ <dimen name="tri_state_up_dialog_position_l">0px</dimen>
+ <dimen name="tri_state_up_dialog_position_deep">0px</dimen>
+ <dimen name="tri_state_up_dialog_position_deep_land">0px</dimen>
+ <dimen name="tri_state_dialog_elevation">4.0dip</dimen>
+ <dimen name="tri_state_dialog_icon_size">24.0dip</dimen>
+ <dimen name="tri_state_dialog_padding">8.0dip</dimen>
+ <dimen name="tri_state_down_bottom_left_radius">24.0dip</dimen>
+ <dimen name="tri_state_down_bottom_right_radius">24.0dip</dimen>
+ <dimen name="tri_state_down_top_left_radius">24.0dip</dimen>
+ <dimen name="tri_state_down_top_right_radius">0.0dip</dimen>
+ <dimen name="tri_state_mid_bottom_left_radius">24.0dip</dimen>
+ <dimen name="tri_state_mid_bottom_right_radius">24.0dip</dimen>
+ <dimen name="tri_state_mid_top_left_radius">24.0dip</dimen>
+ <dimen name="tri_state_mid_top_right_radius">24.0dip</dimen>
+ <dimen name="tri_state_up_bottom_left_radius">24.0dip</dimen>
+ <dimen name="tri_state_up_bottom_right_radius">0.0dip</dimen>
+ <dimen name="tri_state_up_top_left_radius">24.0dip</dimen>
+ <dimen name="tri_state_up_top_right_radius">24.0dip</dimen>
+</resources>
diff --git a/packages/SystemUI/res/values/ice_strings.xml b/packages/SystemUI/res/values/ice_strings.xml
new file mode 100644
index 000000000000..8d463eb58f98
--- /dev/null
+++ b/packages/SystemUI/res/values/ice_strings.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+ Copyright (C) 2022 Project ICE
+
+ 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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Status bar - icons -->
+ <string name="status_bar_icons_title">Status bar icons</string>
+ <string name="status_bar_vpn">VPN</string>
+
+ <!-- Custom QS tiles -->
+ <!-- AOD QS tile -->
+ <string name="quick_settings_aod_label">AOD</string>
+ <string name="quick_settings_aod_off_powersave_label">AOD off\nBattery saver</string>
+
+ <!-- Caffeine QS tile -->
+ <string name="quick_settings_caffeine_label">Caffeine</string>
+ <string name="accessibility_quick_settings_caffeine_off">Caffeine off.</string>
+ <string name="accessibility_quick_settings_caffeine_on">Caffeine on.</string>
+
+ <!-- Heads up QS tile -->
+ <string name="quick_settings_heads_up_label">Heads up</string>
+ <string name="accessibility_quick_settings_heads_up_off">Heads up off.</string>
+ <string name="accessibility_quick_settings_heads_up_on">Heads up on.</string>
+</resources>
diff --git a/packages/SystemUI/res/values/ice_styles.xml b/packages/SystemUI/res/values/ice_styles.xml
new file mode 100644
index 000000000000..652258a68746
--- /dev/null
+++ b/packages/SystemUI/res/values/ice_styles.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 Project ICE
+
+ 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.
+-->
+<resources>
+ <!-- Alert Slider -->
+ <style name="TriStateUiText">
+ <item name="android:textSize">11.0sp</item>
+ <item name="android:fontFamily">sans-serif-medium</item>
+ </style>
+</resources>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 31ad28bee300..a94f8174f028 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -117,7 +117,6 @@
<style name="TextAppearance.QS.TileLabel">
<item name="android:textSize">@dimen/qs_tile_text_size</item>
- <item name="android:letterSpacing">0.01</item>
<item name="android:lineHeight">20sp</item>
<item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item>
</style>
@@ -137,7 +136,6 @@
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">14sp</item>
- <item name="android:letterSpacing">0.01</item>
</style>
<style name="TextAppearance.QS.SecurityFooter" parent="@style/TextAppearance.QS.Status">
@@ -593,7 +591,6 @@
<style name="TextAppearance.QSEdit" >
<item name="android:textSize">14sp</item>
- <item name="android:letterSpacing">0.01</item>
<item name="android:lineHeight">20sp</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
diff --git a/packages/SystemUI/res/xml/status_bar_prefs.xml b/packages/SystemUI/res/xml/status_bar_prefs.xml
new file mode 100644
index 000000000000..6f4c5bcf10b7
--- /dev/null
+++ b/packages/SystemUI/res/xml/status_bar_prefs.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:sysui="http://schemas.android.com/apk/res-auto"
+ android:key="status_bar"
+ android:title="@string/status_bar">
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_auto_rotate"
+ android:key="rotate"
+ android:title="@string/status_bar_settings_auto_rotation" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_headset"
+ android:key="headset"
+ android:title="@string/headset" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_work"
+ android:key="managed_profile"
+ android:title="@string/status_bar_work" />
+
+ <!-- ime -->
+ <!-- sync_failing -->
+ <!-- sync_active -->
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_cast"
+ android:key="cast"
+ android:title="@string/quick_settings_cast_title" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_hotspot"
+ android:key="hotspot"
+ android:title="@string/quick_settings_hotspot_label" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@*android:drawable/ic_qs_bluetooth"
+ android:key="bluetooth"
+ android:title="@string/quick_settings_bluetooth_label" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_camera"
+ android:key="cameratoggle"
+ android:title="@string/quick_settings_camera_label" />
+
+ <!-- nfc -->
+ <!-- tty -->
+ <!-- speakerphone -->
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_do_not_disturb"
+ android:key="zen"
+ android:title="@string/quick_settings_dnd_label" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_mute"
+ android:key="mute"
+ android:title="@string/volume_ringer_status_silent" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_vibrate"
+ android:key="volume"
+ android:title="@string/volume_ringer_status_vibrate" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_wifi"
+ android:key="wifi"
+ android:title="@string/quick_settings_wifi_label" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_ethernet"
+ android:key="ethernet"
+ android:title="@string/status_bar_ethernet" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_mobile_network"
+ android:key="mobile"
+ android:title="@string/quick_settings_cellular_detail_title" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_airplanemode"
+ android:key="airplane"
+ android:title="@string/status_bar_airplane" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_vpn_key"
+ android:key="vpn"
+ android:title="@string/status_bar_vpn" />
+
+ <!-- other weird signal stuff -->
+
+ <com.android.systemui.tuner.BatteryPreference
+ android:icon="@*android:drawable/ic_battery"
+ android:title="@string/battery"
+ android:summary="%s"
+ android:entries="@array/battery_options" />
+
+ <com.android.systemui.tuner.StatusBarSwitch
+ android:icon="@drawable/ic_statusbar_alarm"
+ android:key="alarm_clock"
+ android:title="@string/status_bar_alarm" />
+
+ <!-- secure -->
+
+ <com.android.systemui.tuner.ClockPreference
+ android:icon="@drawable/ic_statusbar_clock"
+ android:title="@string/tuner_time"
+ android:summary="%s"
+ android:entries="@array/clock_options" />
+
+ <com.android.systemui.tuner.TunerSwitch
+ android:icon="@drawable/ic_statusbar_priority"
+ android:key="low_priority"
+ android:title="@string/tuner_low_priority"
+ sysui:defValue="false" />
+
+</PreferenceScreen>
diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml
index 902de23a9e2a..aab0b1e8ab51 100644
--- a/packages/SystemUI/res/xml/tuner_prefs.xml
+++ b/packages/SystemUI/res/xml/tuner_prefs.xml
@@ -20,94 +20,8 @@
<PreferenceScreen
android:key="status_bar"
- android:title="@string/status_bar" >
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="rotate"
- android:title="@string/status_bar_settings_auto_rotation" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="headset"
- android:title="@string/headset" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="managed_profile"
- android:title="@string/status_bar_work" />
-
- <!-- ime -->
- <!-- sync_failing -->
- <!-- sync_active -->
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="cast"
- android:title="@string/quick_settings_cast_title" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="hotspot"
- android:title="@string/quick_settings_hotspot_label" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="bluetooth"
- android:title="@string/quick_settings_bluetooth_label" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="cameratoggle"
- android:title="@string/quick_settings_camera_label" />
-
- <!-- nfc -->
- <!-- tty -->
- <!-- speakerphone -->
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="zen"
- android:title="@string/quick_settings_dnd_label" />
-
- <!-- mute -->
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="volume"
- android:title="@*android:string/volume_unknown" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="wifi"
- android:title="@string/quick_settings_wifi_label" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="ethernet"
- android:title="@string/status_bar_ethernet" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="mobile"
- android:title="@string/quick_settings_cellular_detail_title" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="airplane"
- android:title="@string/status_bar_airplane" />
-
- <!-- other weird signal stuff -->
-
- <com.android.systemui.tuner.BatteryPreference
- android:title="@string/battery"
- android:summary="%s"
- android:entries="@array/battery_options" />
-
- <com.android.systemui.tuner.StatusBarSwitch
- android:key="alarm_clock"
- android:title="@string/status_bar_alarm" />
-
- <!-- secure -->
-
- <com.android.systemui.tuner.ClockPreference
- android:title="@string/tuner_time"
- android:summary="%s"
- android:entries="@array/clock_options" />
-
- <com.android.systemui.tuner.TunerSwitch
- android:key="low_priority"
- android:title="@string/tuner_low_priority"
- sysui:defValue="false" />
-
- </PreferenceScreen>
+ android:title="@string/status_bar"
+ android:fragment="com.android.systemui.tuner.StatusBarTuner" />
<PreferenceScreen
android:key="volume_and_do_not_disturb"
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
index 0326b6d3edca..2bd589d3c982 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
@@ -1,10 +1,13 @@
package com.android.keyguard;
+import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
+
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
+import android.content.res.Configuration;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
@@ -96,6 +99,18 @@ public class KeyguardClockSwitch extends RelativeLayout {
super(context, attrs);
}
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+
+ if (mDisplayedClockSize != null) {
+ boolean landscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
+ boolean useLargeClock = mDisplayedClockSize == LARGE &&
+ (!landscape || isLargeScreen(mContext));
+ updateClockViews(useLargeClock, /* animate */ true);
+ }
+ }
+
/**
* Apply dp changes on font/scale change
*/
@@ -266,11 +281,14 @@ public class KeyguardClockSwitch extends RelativeLayout {
if (mDisplayedClockSize != null && clockSize == mDisplayedClockSize) {
return false;
}
+ boolean landscape = getResources().getConfiguration().orientation
+ == Configuration.ORIENTATION_LANDSCAPE;
+ boolean useLargeClock = clockSize == LARGE && (!landscape || isLargeScreen(mContext));
// let's make sure clock is changed only after all views were laid out so we can
// translate them properly
if (mChildrenAreLaidOut) {
- updateClockViews(clockSize == LARGE, animate);
+ updateClockViews(useLargeClock, animate);
}
mDisplayedClockSize = clockSize;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
index 65a71664e245..31d22eb38a24 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
@@ -49,6 +49,7 @@ import com.android.internal.graphics.ColorUtils;
import com.android.settingslib.Utils;
import com.android.systemui.R;
import com.android.systemui.animation.Interpolators;
+import com.android.systemui.keyguard.KeyguardSliceProvider;
import com.android.systemui.util.wakelock.KeepAwakeAnimationListener;
import java.io.PrintWriter;
@@ -445,13 +446,15 @@ public class KeyguardSliceView extends LinearLayout {
private void updatePadding() {
boolean hasText = !TextUtils.isEmpty(getText());
+ boolean isDate = Uri.parse(KeyguardSliceProvider.KEYGUARD_DATE_URI).equals(getTag());
int padding = (int) getContext().getResources()
.getDimension(R.dimen.widget_horizontal_padding) / 2;
+ int iconPadding = (int) mContext.getResources()
+ .getDimension(R.dimen.widget_icon_padding);
// orientation is vertical, so add padding to top & bottom
- setPadding(0, padding, 0, hasText ? padding : 0);
+ setPadding(!isDate ? iconPadding : 0, padding, 0, hasText ? padding : 0);
- setCompoundDrawablePadding((int) mContext.getResources()
- .getDimension(R.dimen.widget_icon_padding));
+ setCompoundDrawablePadding(iconPadding);
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index d95c542b9631..575bbbe338fb 100755
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -2288,7 +2288,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
}
// Take a guess at initial SIM state, battery status and PLMN until we get an update
- mBatteryStatus = new BatteryStatus(BATTERY_STATUS_UNKNOWN, 100, 0, 0, 0, true);
+ mBatteryStatus = new BatteryStatus(BATTERY_STATUS_UNKNOWN, 100, 0, 0, 0, false, true);
// Watch for interesting updates
final IntentFilter filter = new IntentFilter();
@@ -3649,6 +3649,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
return true;
}
+ // change in oem fast charging while plugged in
+ if (nowPluggedIn && current.oemFastChargeStatus != old.oemFastChargeStatus) {
+ return true;
+ }
+
// Battery either showed up or disappeared
if (wasPresent != nowPresent) {
return true;
diff --git a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
index 4881c9144269..33c46be4f3ed 100644
--- a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
+++ b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
@@ -30,6 +30,7 @@ import android.graphics.Rect;
import android.graphics.Typeface;
import android.os.PowerManager;
import android.os.SystemClock;
+import android.provider.Settings;
import android.text.InputType;
import android.text.TextUtils;
import android.util.AttributeSet;
@@ -386,7 +387,9 @@ public class PasswordTextView extends View {
* Controls whether the last entered digit is briefly shown after being entered
*/
public void setShowPassword(boolean enabled) {
- mShowPassword = enabled;
+ mShowPassword = enabled &&
+ Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
}
private class CharState {
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java
index 50e03992df49..9f131446217d 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java
@@ -83,7 +83,7 @@ public class SystemUIService extends Service {
throw new RuntimeException();
}
- if (Build.IS_DEBUGGABLE) {
+ if (Build.IS_ENG) {
// b/71353150 - looking for leaked binder proxies
BinderInternal.nSetBinderProxyCountEnabled(true);
BinderInternal.nSetBinderProxyCountWatermarks(1000,900);
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt
index b0071340cf1a..5c7060cfe95f 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt
@@ -28,6 +28,7 @@ import android.util.AttributeSet
import android.view.View
import android.view.animation.PathInterpolator
import com.android.internal.graphics.ColorUtils
+import com.android.settingslib.Utils
import com.android.systemui.animation.Interpolators
import com.android.systemui.surfaceeffects.ripple.RippleShader
@@ -84,6 +85,7 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
}
init {
+ rippleShader.color = Utils.getColorAttr(context, android.R.attr.colorAccent).defaultColor
rippleShader.rawProgress = 0f
rippleShader.pixelDensity = resources.displayMetrics.density
rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
new file mode 100644
index 000000000000..2488132b508b
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
@@ -0,0 +1,159 @@
+/*
+ * 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.systemui.biometrics;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.PixelFormat;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+
+import com.android.systemui.R;
+
+/**
+ * Surface View for providing the Global High-Brightness Mode (GHBM) illumination for UDFPS.
+ */
+public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
+ private static final String TAG = "UdfpsSurfaceView";
+
+ /**
+ * Notifies {@link UdfpsView} when to enable GHBM illumination.
+ */
+ interface GhbmIlluminationListener {
+ /**
+ * @param surface the surface for which GHBM should be enabled.
+ * @param onDisplayConfigured a runnable that should be run after GHBM is enabled.
+ */
+ void enableGhbm(@NonNull Surface surface, @Nullable Runnable onDisplayConfigured);
+ }
+
+ @NonNull private final SurfaceHolder mHolder;
+ @NonNull private final Paint mSensorPaint;
+
+ @Nullable private GhbmIlluminationListener mGhbmIlluminationListener;
+ @Nullable private Runnable mOnDisplayConfigured;
+ boolean mAwaitingSurfaceToStartIllumination;
+ boolean mHasValidSurface;
+
+ private Drawable mUdfpsIconPressed;
+
+ public UdfpsSurfaceView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ // Make this SurfaceView draw on top of everything else in this window. This allows us to
+ // 1) Always show the HBM circle on top of everything else, and
+ // 2) Properly composite this view with any other animations in the same window no matter
+ // what contents are added in which order to this view hierarchy.
+ setZOrderOnTop(true);
+
+ mHolder = getHolder();
+ mHolder.addCallback(this);
+ mHolder.setFormat(PixelFormat.RGBA_8888);
+
+ mSensorPaint = new Paint(0 /* flags */);
+ mSensorPaint.setAntiAlias(true);
+ mSensorPaint.setColor(context.getColor(R.color.config_udfpsColor));
+ mSensorPaint.setStyle(Paint.Style.FILL);
+
+ mUdfpsIconPressed = context.getDrawable(R.drawable.udfps_icon_pressed);
+ }
+
+ @Override public void surfaceCreated(SurfaceHolder holder) {
+ mHasValidSurface = true;
+ if (mAwaitingSurfaceToStartIllumination) {
+ doIlluminate(mOnDisplayConfigured);
+ mOnDisplayConfigured = null;
+ mAwaitingSurfaceToStartIllumination = false;
+ }
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ // Unused.
+ }
+
+ @Override public void surfaceDestroyed(SurfaceHolder holder) {
+ mHasValidSurface = false;
+ }
+
+ void setGhbmIlluminationListener(@Nullable GhbmIlluminationListener listener) {
+ mGhbmIlluminationListener = listener;
+ }
+
+ /**
+ * Note: there is no corresponding method to stop GHBM illumination. It is expected that
+ * {@link UdfpsView} will hide this view, which would destroy the surface and remove the
+ * illumination dot.
+ */
+ void startGhbmIllumination(@Nullable Runnable onDisplayConfigured) {
+ if (mGhbmIlluminationListener == null) {
+ Log.e(TAG, "startIllumination | mGhbmIlluminationListener is null");
+ return;
+ }
+
+ if (mHasValidSurface) {
+ doIlluminate(onDisplayConfigured);
+ } else {
+ mAwaitingSurfaceToStartIllumination = true;
+ mOnDisplayConfigured = onDisplayConfigured;
+ }
+ }
+
+ private void doIlluminate(@Nullable Runnable onDisplayConfigured) {
+ if (mGhbmIlluminationListener == null) {
+ Log.e(TAG, "doIlluminate | mGhbmIlluminationListener is null");
+ return;
+ }
+
+ mGhbmIlluminationListener.enableGhbm(mHolder.getSurface(), onDisplayConfigured);
+ }
+
+ /**
+ * Immediately draws the illumination dot on this SurfaceView's surface.
+ */
+ void drawIlluminationDot(@NonNull RectF sensorRect) {
+ if (!mHasValidSurface) {
+ Log.e(TAG, "drawIlluminationDot | the surface is destroyed or was never created.");
+ return;
+ }
+ Canvas canvas = null;
+ try {
+ canvas = mHolder.lockCanvas();
+ mUdfpsIconPressed.setBounds(
+ Math.round(sensorRect.left),
+ Math.round(sensorRect.top),
+ Math.round(sensorRect.right),
+ Math.round(sensorRect.bottom)
+ );
+ mUdfpsIconPressed.draw(canvas);
+ canvas.drawOval(sensorRect, mSensorPaint);
+ } finally {
+ // Make sure the surface is never left in a bad state.
+ if (canvas != null) {
+ mHolder.unlockCanvasAndPost(canvas);
+ }
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
index e61c614f0292..1e2e6c8bb253 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
@@ -25,6 +25,7 @@ import android.graphics.RectF
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
+import android.view.Surface
import android.widget.FrameLayout
import com.android.systemui.R
import com.android.systemui.doze.DozeReceiver
@@ -60,6 +61,8 @@ class UdfpsView(
a.getFloat(R.styleable.UdfpsView_sensorTouchAreaCoefficient, 0f)
}
+ private var ghbmView: UdfpsSurfaceView? = null
+
/** View controller (can be different for enrollment, BiometricPrompt, Keyguard, etc.). */
var animationViewController: UdfpsAnimationViewController<*>? = null
@@ -86,6 +89,10 @@ class UdfpsView(
return (animationViewController == null || !animationViewController!!.shouldPauseAuth())
}
+ override fun onFinishInflate() {
+ ghbmView = findViewById(R.id.hbm_view)
+ }
+
override fun dozeTimeTick() {
animationViewController?.dozeTimeTick()
}
@@ -149,12 +156,34 @@ class UdfpsView(
fun configureDisplay(onDisplayConfigured: Runnable) {
isDisplayConfigured = true
animationViewController?.onDisplayConfiguring()
- mUdfpsDisplayMode?.enable(onDisplayConfigured)
+ val gView = ghbmView
+ if (gView != null) {
+ gView.setGhbmIlluminationListener(this::doIlluminate)
+ gView.visibility = VISIBLE
+ gView.startGhbmIllumination(onDisplayConfigured)
+ } else {
+ doIlluminate(null /* surface */, onDisplayConfigured)
+ }
+ }
+
+ private fun doIlluminate(surface: Surface?, onDisplayConfigured: Runnable?) {
+ if (ghbmView != null && surface == null) {
+ Log.e(TAG, "doIlluminate | surface must be non-null for GHBM")
+ }
+
+ mUdfpsDisplayMode?.enable {
+ onDisplayConfigured?.run()
+ ghbmView?.drawIlluminationDot(RectF(sensorRect))
+ }
}
fun unconfigureDisplay() {
isDisplayConfigured = false
animationViewController?.onDisplayUnconfigured()
+ ghbmView?.let { view ->
+ view.setGhbmIlluminationListener(null)
+ view.visibility = INVISIBLE
+ }
mUdfpsDisplayMode?.disable(null /* onDisabled */)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt
index 8029ba844850..c4c23124b39e 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt
@@ -68,12 +68,6 @@ interface ControlActionCoordinator {
fun setValue(cvh: ControlViewHolder, templateId: String, newValue: Float)
/**
- * Actions may have been put on hold while the device is unlocked. Invoke this action if
- * present.
- */
- fun runPendingAction(controlId: String)
-
- /**
* User interaction with a control may be blocked for a period of time while actions are being
* executed by the application. When the response returns, run this method to enable further
* user interaction.
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt
index 99a10a33ab0f..d167eecb137d 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt
@@ -64,7 +64,6 @@ class ControlActionCoordinatorImpl @Inject constructor(
private val featureFlags: FeatureFlags,
) : ControlActionCoordinator {
private var dialog: Dialog? = null
- private var pendingAction: Action? = null
private var actionsInProgress = mutableSetOf<String>()
private val isLocked: Boolean
get() = !keyguardStateController.isUnlocked()
@@ -166,15 +165,6 @@ class ControlActionCoordinatorImpl @Inject constructor(
)
}
- override fun runPendingAction(controlId: String) {
- if (isLocked) return
- if (pendingAction?.controlId == controlId) {
- showSettingsDialogIfNeeded(pendingAction!!)
- pendingAction?.invoke()
- pendingAction = null
- }
- }
-
@MainThread
override fun enableActionOnTouch(controlId: String) {
actionsInProgress.remove(controlId)
@@ -196,17 +186,11 @@ class ControlActionCoordinatorImpl @Inject constructor(
val authRequired = action.authIsRequired || !allowTrivialControls
if (keyguardStateController.isShowing() && authRequired) {
- if (isLocked) {
- broadcastSender.closeSystemDialogs()
-
- // pending actions will only run after the control state has been refreshed
- pendingAction = action
- }
activityStarter.dismissKeyguardThenExecute({
Log.d(ControlsUiController.TAG, "Device unlocked, invoking controls action")
action.invoke()
true
- }, { pendingAction = null }, true /* afterKeyguardGone */)
+ }, null, true /* afterKeyguardGone */)
} else {
showSettingsDialogIfNeeded(action)
action.invoke()
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt
index 931062865c64..ed4be7e26e2a 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt
@@ -176,8 +176,6 @@ class ControlViewHolder(
controlActionCoordinator.longPress(this@ControlViewHolder)
true
})
-
- controlActionCoordinator.runPendingAction(cws.ci.controlId)
}
val wasLoading = isLoading
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
index 05527bd2c843..cc3ad9dd8b6e 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
@@ -49,6 +49,7 @@ import com.android.systemui.flags.FlagsModule;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.keyboard.KeyboardModule;
import com.android.systemui.keyguard.data.BouncerViewModule;
+import com.android.systemui.lineage.LineageModule;
import com.android.systemui.log.dagger.LogModule;
import com.android.systemui.mediaprojection.appselector.MediaProjectionModule;
import com.android.systemui.model.SysUiState;
@@ -155,6 +156,7 @@ import dagger.Provides;
FooterActionsModule.class,
GarbageMonitorModule.class,
KeyboardModule.class,
+ LineageModule.class,
LogModule.class,
MediaProjectionModule.class,
MotionToolModule.class,
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
index e3c568a98cc6..60a744c01d72 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
@@ -246,7 +246,7 @@ public class DozeSensors {
false /* ignoresSetting */,
dozeParameters.longPressUsesProx(),
false /* immediatelyReRegister */,
- true /* requiresAod */
+ !mScreenOffUdfpsEnabled /* requiresAod */
),
new PluginSensor(
new SensorManagerPlugin.Sensor(TYPE_WAKE_DISPLAY),
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
index b70960832d32..8c91df9742fa 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
@@ -328,11 +328,16 @@ public class DozeTriggers implements DozeMachine.Part {
}
gentleWakeUp(pulseReason);
} else if (isPickup) {
+ final State state = mMachine.getState();
if (shouldDropPickupEvent()) {
mDozeLog.traceSensorEventDropped(pulseReason, "keyguard occluded");
return;
}
- gentleWakeUp(pulseReason);
+ if (state == State.DOZE_AOD) {
+ gentleWakeUp(pulseReason);
+ } else {
+ requestPulse(pulseReason, true, null);
+ }
} else if (isUdfpsLongPress) {
if (canPulse(mMachine.getState(), true)) {
mDozeLog.d("updfsLongPress - setting aodInterruptRunnable to run when "
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
index b4a30583f492..d9f3ea39dfd9 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
+++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
@@ -166,7 +166,7 @@ object Flags {
// TODO(b/255618149): Tracking Bug
@JvmField
val CUSTOMIZABLE_LOCK_SCREEN_QUICK_AFFORDANCES =
- unreleasedFlag(216, "customizable_lock_screen_quick_affordances", teamfood = true)
+ releasedFlag(216, "customizable_lock_screen_quick_affordances", teamfood = true)
/**
* Migrates control of the LightRevealScrim's reveal effect and amount from legacy code to the
@@ -363,7 +363,7 @@ object Flags {
val MEDIA_TAP_TO_TRANSFER = releasedFlag(900, "media_tap_to_transfer")
// TODO(b/254512502): Tracking Bug
- val MEDIA_SESSION_ACTIONS = unreleasedFlag(901, "media_session_actions")
+ val MEDIA_SESSION_ACTIONS = releasedFlag(901, "media_session_actions")
// TODO(b/254512726): Tracking Bug
val MEDIA_NEARBY_DEVICES = releasedFlag(903, "media_nearby_devices")
@@ -577,7 +577,8 @@ object Flags {
// 1300 - screenshots
// TODO(b/254513155): Tracking Bug
@JvmField
- val SCREENSHOT_WORK_PROFILE_POLICY = releasedFlag(1301, "screenshot_work_profile_policy")
+ val SCREENSHOT_WORK_PROFILE_POLICY =
+ unreleasedFlag(1301, "screenshot_work_profile_policy", teamfood = true)
// TODO(b/264916608): Tracking Bug
@JvmField val SCREENSHOT_METADATA = unreleasedFlag(1302, "screenshot_metadata", teamfood = true)
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index a7fba6580e0d..aa6178fff2a7 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -2002,6 +2002,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
if (mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser())
&& !lockedOrMissing && !forceShow) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
+ setShowingLocked(false, mAodShowing);
+ hideLocked();
return;
}
}
@@ -2783,7 +2785,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
// only play "unlock" noises if not on a call (since the incall UI
// disables the keyguard)
if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) {
- playSounds(false);
+ if (mShowing && mDeviceInteractive) {
+ playSounds(false);
+ }
}
setShowingLocked(false);
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt
index 6d26bb00f0de..c607c03ead13 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt
@@ -338,7 +338,7 @@ object KeyguardBottomAreaViewBinder {
Utils.getColorAttr(
view.context,
if (viewModel.isActivated) {
- com.android.internal.R.attr.colorAccentPrimary
+ com.android.internal.R.attr.colorAccent
} else {
com.android.internal.R.attr.colorSurface
}
@@ -397,6 +397,12 @@ object KeyguardBottomAreaViewBinder {
private val longPressDurationMs = ViewConfiguration.getLongPressTimeout().toLong()
private var longPressAnimator: ViewPropertyAnimator? = null
+ private val areAllPrimitivesSupported = vibratorHelper?.areAllPrimitivesSupported(
+ VibrationEffect.Composition.PRIMITIVE_TICK,
+ VibrationEffect.Composition.PRIMITIVE_QUICK_RISE,
+ VibrationEffect.Composition.PRIMITIVE_QUICK_FALL
+ ) ?: false
+
@SuppressLint("ClickableViewAccessibility")
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
return when (event?.actionMasked) {
@@ -484,7 +490,12 @@ object KeyguardBottomAreaViewBinder {
CycleInterpolator(ShakeAnimationCycles)
shakeAnimator.start()
- vibratorHelper?.vibrate(Vibrations.Shake)
+ vibratorHelper?.vibrate(
+ if (areAllPrimitivesSupported) {
+ Vibrations.Shake
+ } else {
+ Vibrations.ShakeAlt
+ })
}
} else {
null
@@ -507,9 +518,17 @@ object KeyguardBottomAreaViewBinder {
view.setOnClickListener {
vibratorHelper?.vibrate(
if (viewModel.isActivated) {
- Vibrations.Activated
+ if (areAllPrimitivesSupported) {
+ Vibrations.Activated
+ } else {
+ Vibrations.ActivatedAlt
+ }
} else {
- Vibrations.Deactivated
+ if (areAllPrimitivesSupported) {
+ Vibrations.Deactivated
+ } else {
+ Vibrations.DeactivatedAlt
+ }
}
)
viewModel.onClicked(
@@ -637,6 +656,7 @@ object KeyguardBottomAreaViewBinder {
}
}
.compose()
+ val ShakeAlt = VibrationEffect.createPredefined(VibrationEffect.EFFECT_DOUBLE_CLICK)
val Activated =
VibrationEffect.startComposition()
@@ -651,6 +671,7 @@ object KeyguardBottomAreaViewBinder {
0,
)
.compose()
+ val ActivatedAlt = VibrationEffect.createPredefined(VibrationEffect.EFFECT_HEAVY_CLICK)
val Deactivated =
VibrationEffect.startComposition()
@@ -665,5 +686,6 @@ object KeyguardBottomAreaViewBinder {
0,
)
.compose()
+ val DeactivatedAlt = VibrationEffect.createPredefined(VibrationEffect.EFFECT_HEAVY_CLICK)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt b/packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt
new file mode 100644
index 000000000000..3e9aec36d8f3
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2023 The LineageOS 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.systemui.lineage
+
+import com.android.systemui.qs.tileimpl.QSTileImpl
+import com.android.systemui.qs.tiles.AODTile
+import com.android.systemui.qs.tiles.CaffeineTile
+import com.android.systemui.qs.tiles.HeadsUpTile
+
+import dagger.Binds
+import dagger.Module
+import dagger.multibindings.IntoMap
+import dagger.multibindings.StringKey
+
+@Module
+interface LineageModule {
+ /** Inject AODTile into tileMap in QSModule */
+ @Binds
+ @IntoMap
+ @StringKey(AODTile.TILE_SPEC)
+ fun bindAODTile(aodTile: AODTile): QSTileImpl<*>
+
+ /** Inject CaffeineTile into tileMap in QSModule */
+ @Binds
+ @IntoMap
+ @StringKey(CaffeineTile.TILE_SPEC)
+ fun bindCaffeineTile(caffeineTile: CaffeineTile): QSTileImpl<*>
+
+ /** Inject HeadsUpTile into tileMap in QSModule */
+ @Binds
+ @IntoMap
+ @StringKey(HeadsUpTile.TILE_SPEC)
+ fun bindHeadsUpTile(headsUpTile: HeadsUpTile): QSTileImpl<*>
+}
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
index 59bb2278edfe..84ac3eab9673 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
@@ -18,11 +18,17 @@ package com.android.systemui.navigationbar;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import android.annotation.Nullable;
+import android.app.ActivityManager;
import android.content.Context;
+import android.content.om.IOverlayManager;
import android.content.res.Configuration;
import android.graphics.drawable.Icon;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
@@ -43,12 +49,13 @@ import com.android.systemui.navigationbar.buttons.ReverseLinearLayout;
import com.android.systemui.navigationbar.buttons.ReverseLinearLayout.ReverseRelativeLayout;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.shared.system.QuickStepContract;
+import com.android.systemui.tuner.TunerService;
import java.io.PrintWriter;
import java.util.Objects;
public class NavigationBarInflaterView extends FrameLayout
- implements NavigationModeController.ModeChangedListener {
+ implements NavigationModeController.ModeChangedListener, TunerService.Tunable {
private static final String TAG = "NavBarInflater";
@@ -83,6 +90,11 @@ public class NavigationBarInflaterView extends FrameLayout
private static final String ABSOLUTE_SUFFIX = "A";
private static final String ABSOLUTE_VERTICAL_CENTERED_SUFFIX = "C";
+ private static final String KEY_NAVIGATION_HINT =
+ Settings.Secure.NAVIGATION_BAR_HINT;
+ private static final String OVERLAY_NAVIGATION_HIDE_HINT =
+ "android.ice.overlay.hidenav";
+
protected LayoutInflater mLayoutInflater;
protected LayoutInflater mLandscapeInflater;
@@ -102,6 +114,8 @@ public class NavigationBarInflaterView extends FrameLayout
private OverviewProxyService mOverviewProxyService;
private int mNavBarMode = NAV_BAR_MODE_3BUTTON;
+ private boolean mIsHintEnabled;
+
public NavigationBarInflaterView(Context context, AttributeSet attrs) {
super(context, attrs);
createInflaters();
@@ -143,12 +157,22 @@ public class NavigationBarInflaterView extends FrameLayout
: mOverviewProxyService.shouldShowSwipeUpUI()
? R.string.config_navBarLayoutQuickstep
: R.string.config_navBarLayout;
+ if (!mIsHintEnabled && defaultResource == R.string.config_navBarLayoutHandle) {
+ return getContext().getString(defaultResource).replace(HOME_HANDLE, "");
+ }
return getContext().getString(defaultResource);
}
@Override
public void onNavigationModeChanged(int mode) {
mNavBarMode = mode;
+ updateHint();
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ Dependency.get(TunerService.class).addTunable(this, KEY_NAVIGATION_HINT);
}
@Override
@@ -157,6 +181,15 @@ public class NavigationBarInflaterView extends FrameLayout
super.onDetachedFromWindow();
}
+ @Override
+ public void onTuningChanged(String key, String newValue) {
+ if (KEY_NAVIGATION_HINT.equals(key)) {
+ mIsHintEnabled = TunerService.parseIntegerSwitch(newValue, true);
+ updateHint();
+ onLikelyDefaultLayoutChange();
+ }
+ }
+
public void onLikelyDefaultLayoutChange() {
// Reevaluate new layout
final String newValue = getDefaultLayout();
@@ -210,6 +243,24 @@ public class NavigationBarInflaterView extends FrameLayout
}
}
+ private void updateHint() {
+ final IOverlayManager iom = IOverlayManager.Stub.asInterface(
+ ServiceManager.getService(Context.OVERLAY_SERVICE));
+ final boolean state = mNavBarMode == NAV_BAR_MODE_GESTURAL && !mIsHintEnabled;
+ final int userId = ActivityManager.getCurrentUser();
+ try {
+ iom.setEnabled(OVERLAY_NAVIGATION_HIDE_HINT, state, userId);
+ if (state) {
+ // As overlays are also used to apply navigation mode, it is needed to set
+ // our customization overlay to highest priority to ensure it is applied.
+ iom.setHighestPriority(OVERLAY_NAVIGATION_HIDE_HINT, userId);
+ }
+ } catch (IllegalArgumentException | RemoteException e) {
+ Log.e(TAG, "Failed to " + (state ? "enable" : "disable")
+ + " overlay " + OVERLAY_NAVIGATION_HIDE_HINT + " for user " + userId);
+ }
+ }
+
private void initiallyFill(ButtonDispatcher buttonDispatcher) {
addAll(buttonDispatcher, mHorizontal.findViewById(R.id.ends_group));
addAll(buttonDispatcher, mHorizontal.findViewById(R.id.center_group));
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
index a8022bc4e116..8ee8c2160b5d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
@@ -501,6 +501,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
public void setBrightnessMirrorController(
BrightnessMirrorController brightnessMirrorController) {
+ mQuickQSPanelController.setBrightnessMirror(brightnessMirrorController);
mQSPanelController.setBrightnessMirror(brightnessMirrorController);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index b476521f1975..32b33bd9b6b9 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -322,14 +322,10 @@ public class QSPanel extends LinearLayout implements Tunable {
@Override
public void onTuningChanged(String key, String newValue) {
if (QS_SHOW_BRIGHTNESS.equals(key) && mBrightnessView != null) {
- updateViewVisibilityForTuningValue(mBrightnessView, newValue);
+ mBrightnessView.setVisibility(VISIBLE);
}
}
- private void updateViewVisibilityForTuningValue(View view, @Nullable String newValue) {
- view.setVisibility(TunerService.parseIntegerSwitch(newValue, true) ? VISIBLE : GONE);
- }
-
@Nullable
View getBrightnessView() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java
index 83b373d5e626..05bc6a2785e8 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java
@@ -161,11 +161,7 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
// Set the listening as soon as the QS fragment starts listening regardless of the
//expansion, so it will update the current brightness before the slider is visible.
- if (listening) {
- mBrightnessController.registerCallbacks();
- } else {
- mBrightnessController.unregisterCallbacks();
- }
+ mBrightnessController.registerCallbacks();
}
public void setBrightnessMirror(BrightnessMirrorController brightnessMirrorController) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
index 46724adee848..1df24603be14 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
@@ -16,6 +16,7 @@
package com.android.systemui.qs;
+import android.annotation.NonNull;
import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
@@ -28,12 +29,15 @@ import com.android.systemui.R;
import com.android.systemui.plugins.qs.QSTile;
import com.android.systemui.plugins.qs.QSTile.SignalState;
import com.android.systemui.plugins.qs.QSTile.State;
+import com.android.systemui.tuner.TunerService;
/**
* Version of QSPanel that only shows N Quick Tiles in the QS Header.
*/
public class QuickQSPanel extends QSPanel {
+ public static final String QS_SHOW_BRIGHTNESS = "qs_show_brightness";
+
private static final String TAG = "QuickQSPanel";
// A fallback value for max tiles number when setting via Tuner (parseNumTiles)
public static final int TUNER_MAX_TILES_FALLBACK = 6;
@@ -109,9 +113,8 @@ public class QuickQSPanel extends QSPanel {
@Override
public void onTuningChanged(String key, String newValue) {
- if (QS_SHOW_BRIGHTNESS.equals(key)) {
- // No Brightness or Tooltip for you!
- super.onTuningChanged(key, "0");
+ if (QS_SHOW_BRIGHTNESS.equals(key) && mBrightnessView != null) {
+ mBrightnessView.setVisibility(VISIBLE);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java
index 2d543139a1b4..a53577024a24 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java
@@ -17,6 +17,7 @@
package com.android.systemui.qs;
import static com.android.systemui.media.dagger.MediaModule.QUICK_QS_PANEL;
+import static com.android.systemui.qs.QuickQSPanel.QS_SHOW_BRIGHTNESS;
import static com.android.systemui.qs.dagger.QSFragmentModule.QS_USING_COLLAPSED_LANDSCAPE_MEDIA;
import static com.android.systemui.qs.dagger.QSFragmentModule.QS_USING_MEDIA_PLAYER;
@@ -32,6 +33,11 @@ import com.android.systemui.plugins.qs.QSTile;
import com.android.systemui.qs.customize.QSCustomizerController;
import com.android.systemui.qs.dagger.QSScope;
import com.android.systemui.qs.logging.QSLogger;
+import com.android.systemui.settings.brightness.BrightnessController;
+import com.android.systemui.settings.brightness.BrightnessMirrorHandler;
+import com.android.systemui.settings.brightness.BrightnessSliderController;
+import com.android.systemui.statusbar.policy.BrightnessMirrorController;
+import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.leak.RotationUtils;
import java.util.ArrayList;
@@ -47,6 +53,12 @@ public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel>
private final Provider<Boolean> mUsingCollapsedLandscapeMediaProvider;
+ private final BrightnessController mBrightnessController;
+ private final BrightnessSliderController mBrightnessSliderController;
+ private final BrightnessMirrorHandler mBrightnessMirrorHandler;
+ private final TunerService mTunerService;
+ private BrightnessMirrorController mBrightnessMirrorController;
+
@Inject
QuickQSPanelController(QuickQSPanel view, QSHost qsHost,
QSCustomizerController qsCustomizerController,
@@ -55,11 +67,19 @@ public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel>
@Named(QS_USING_COLLAPSED_LANDSCAPE_MEDIA)
Provider<Boolean> usingCollapsedLandscapeMediaProvider,
MetricsLogger metricsLogger, UiEventLogger uiEventLogger, QSLogger qsLogger,
- DumpManager dumpManager
+ DumpManager dumpManager,
+ TunerService tunerService,
+ BrightnessController.Factory brightnessControllerFactory,
+ BrightnessSliderController.Factory brightnessSliderFactory
) {
super(view, qsHost, qsCustomizerController, usingMediaPlayer, mediaHost, metricsLogger,
uiEventLogger, qsLogger, dumpManager);
mUsingCollapsedLandscapeMediaProvider = usingCollapsedLandscapeMediaProvider;
+ mTunerService = tunerService;
+ mBrightnessSliderController = brightnessSliderFactory.create(getContext(), mView);
+ mView.setBrightnessView(mBrightnessSliderController.getRootView());
+ mBrightnessController = brightnessControllerFactory.create(mBrightnessSliderController);
+ mBrightnessMirrorHandler = new BrightnessMirrorHandler(mBrightnessController);
}
@Override
@@ -68,6 +88,7 @@ public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel>
updateMediaExpansion();
mMediaHost.setShowsOnlyActiveMedia(true);
mMediaHost.init(MediaHierarchyManager.LOCATION_QQS);
+ mBrightnessSliderController.init();
}
private void updateMediaExpansion() {
@@ -90,11 +111,25 @@ public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel>
@Override
protected void onViewAttached() {
super.onViewAttached();
+ mTunerService.addTunable(mView, QS_SHOW_BRIGHTNESS);
+ mBrightnessMirrorHandler.onQsPanelAttached();
}
@Override
protected void onViewDetached() {
super.onViewDetached();
+ mTunerService.removeTunable(mView);
+ mBrightnessMirrorHandler.onQsPanelDettached();
+ }
+
+ @Override
+ void setListening(boolean listening) {
+ super.setListening(listening);
+ mBrightnessController.registerCallbacks();
+ }
+
+ public void setBrightnessMirror(BrightnessMirrorController brightnessMirrorController) {
+ mBrightnessMirrorHandler.setController(brightnessMirrorController);
}
private void setMaxTiles(int parseNumTiles) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
index d9f448493591..82f9f921af42 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
@@ -114,7 +114,7 @@ public class TileQueryHelper {
possibleTiles.add(spec);
}
}
- if (Build.IS_DEBUGGABLE && !current.contains(GarbageMonitor.MemoryTile.TILE_SPEC)) {
+ if (Build.IS_ENG && !current.contains(GarbageMonitor.MemoryTile.TILE_SPEC)) {
possibleTiles.add(GarbageMonitor.MemoryTile.TILE_SPEC);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
index 6b23f5d77145..97f481325e58 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
@@ -81,8 +81,8 @@ public class QSFactoryImpl implements QSFactory {
protected QSTileImpl createTileInternal(String tileSpec) {
// Stock tiles.
if (mTileMap.containsKey(tileSpec)
- // We should not return a Garbage Monitory Tile if the build is not Debuggable
- && (!tileSpec.equals(GarbageMonitor.MemoryTile.TILE_SPEC) || Build.IS_DEBUGGABLE)) {
+ // We should not return a Garbage Monitory Tile if the build is not Eng
+ && (!tileSpec.equals(GarbageMonitor.MemoryTile.TILE_SPEC) || Build.IS_ENG)) {
return mTileMap.get(tileSpec).get();
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java
new file mode 100644
index 000000000000..721122ffa404
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2018 The OmniROM Project
+ * 2020-2021 The LineageOS 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.systemui.qs.tiles;
+
+import android.content.Intent;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.Settings;
+import android.service.quicksettings.Tile;
+import android.view.View;
+
+import androidx.annotation.Nullable;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.Background;
+import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.plugins.ActivityStarter;
+import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.plugins.qs.QSTile.BooleanState;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.qs.QSHost;
+import com.android.systemui.qs.SettingObserver;
+import com.android.systemui.qs.logging.QSLogger;
+import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.settings.UserTracker;
+import com.android.systemui.statusbar.policy.BatteryController;
+import com.android.systemui.util.settings.SecureSettings;
+
+import javax.inject.Inject;
+
+public class AODTile extends QSTileImpl<BooleanState> implements
+ BatteryController.BatteryStateChangeCallback {
+
+ public static final String TILE_SPEC = "aod";
+
+ private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_aod);
+ private final BatteryController mBatteryController;
+
+ private final SettingObserver mSetting;
+
+ @Inject
+ public AODTile(
+ QSHost host,
+ @Background Looper backgroundLooper,
+ @Main Handler mainHandler,
+ FalsingManager falsingManager,
+ MetricsLogger metricsLogger,
+ StatusBarStateController statusBarStateController,
+ ActivityStarter activityStarter,
+ QSLogger qsLogger,
+ SecureSettings secureSettings,
+ BatteryController batteryController,
+ UserTracker userTracker
+ ) {
+ super(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,
+ statusBarStateController, activityStarter, qsLogger);
+
+ mSetting = new SettingObserver(secureSettings, mHandler, Settings.Secure.DOZE_ALWAYS_ON,
+ userTracker.getUserId()) {
+ @Override
+ protected void handleValueChanged(int value, boolean observedChange) {
+ handleRefreshState(value);
+ }
+ };
+
+ mBatteryController = batteryController;
+ batteryController.observe(getLifecycle(), this);
+ }
+
+ @Override
+ public void onPowerSaveChanged(boolean isPowerSave) {
+ refreshState();
+ }
+
+ @Override
+ protected void handleDestroy() {
+ super.handleDestroy();
+ mSetting.setListening(false);
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_dozeAlwaysOnDisplayAvailable);
+ }
+
+ @Override
+ public BooleanState newTileState() {
+ BooleanState state = new BooleanState();
+ state.handlesLongClick = false;
+ return state;
+ }
+
+ @Override
+ public void handleSetListening(boolean listening) {
+ super.handleSetListening(listening);
+ mSetting.setListening(listening);
+ }
+
+ @Override
+ protected void handleUserSwitch(int newUserId) {
+ mSetting.setUserId(newUserId);
+ handleRefreshState(mSetting.getValue());
+ }
+
+ @Override
+ protected void handleClick(@Nullable View view) {
+ mSetting.setValue(mState.value ? 0 : 1);
+ }
+
+ @Override
+ public Intent getLongClickIntent() {
+ return null;
+ }
+
+ @Override
+ public CharSequence getTileLabel() {
+ if (mBatteryController.isAodPowerSave()) {
+ return mContext.getString(R.string.quick_settings_aod_off_powersave_label);
+ }
+ return mContext.getString(R.string.quick_settings_aod_label);
+ }
+
+ @Override
+ protected void handleUpdateState(BooleanState state, Object arg) {
+ final int value = arg instanceof Integer ? (Integer) arg : mSetting.getValue();
+ final boolean enable = value != 0;
+ if (state.slash == null) {
+ state.slash = new SlashState();
+ }
+ state.icon = mIcon;
+ state.value = enable;
+ state.slash.isSlashed = state.value;
+ state.label = mContext.getString(R.string.quick_settings_aod_label);
+ if (mBatteryController.isAodPowerSave()) {
+ state.state = Tile.STATE_UNAVAILABLE;
+ } else {
+ state.state = enable ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
+ }
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsEvent.ICE;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CaffeineTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CaffeineTile.java
new file mode 100644
index 000000000000..c292fc729461
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CaffeineTile.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod Project
+ * Copyright (c) 2017 The LineageOS 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.systemui.qs.tiles;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.CountDownTimer;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.PowerManager;
+import android.os.SystemClock;
+import android.service.quicksettings.Tile;
+import android.view.View;
+
+import androidx.annotation.Nullable;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.Background;
+import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.plugins.ActivityStarter;
+import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.plugins.qs.QSTile.BooleanState;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.qs.QSHost;
+import com.android.systemui.qs.logging.QSLogger;
+import com.android.systemui.qs.tileimpl.QSTileImpl;
+
+import javax.inject.Inject;
+
+/** Quick settings tile: Caffeine **/
+public class CaffeineTile extends QSTileImpl<BooleanState> {
+
+ public static final String TILE_SPEC = "caffeine";
+
+ private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_caffeine);
+
+ private final PowerManager.WakeLock mWakeLock;
+ private int mSecondsRemaining;
+ private int mDuration;
+ private static int[] DURATIONS = new int[] {
+ 5 * 60, // 5 min
+ 10 * 60, // 10 min
+ 30 * 60, // 30 min
+ -1, // infinity
+ };
+ private static final int INFINITE_DURATION_INDEX = DURATIONS.length - 1;
+ private CountDownTimer mCountdownTimer = null;
+ public long mLastClickTime = -1;
+ private final Receiver mReceiver = new Receiver();
+
+ @Inject
+ public CaffeineTile(
+ QSHost host,
+ @Background Looper backgroundLooper,
+ @Main Handler mainHandler,
+ FalsingManager falsingManager,
+ MetricsLogger metricsLogger,
+ StatusBarStateController statusBarStateController,
+ ActivityStarter activityStarter,
+ QSLogger qsLogger
+ ) {
+ super(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,
+ statusBarStateController, activityStarter, qsLogger);
+ mWakeLock = mContext.getSystemService(PowerManager.class).newWakeLock(
+ PowerManager.FULL_WAKE_LOCK, "CaffeineTile");
+ mReceiver.init();
+ }
+
+ @Override
+ public BooleanState newTileState() {
+ return new BooleanState();
+ }
+
+ @Override
+ protected void handleDestroy() {
+ super.handleDestroy();
+ stopCountDown();
+ mReceiver.destroy();
+ if (mWakeLock.isHeld()) {
+ mWakeLock.release();
+ }
+ }
+
+ @Override
+ public void handleSetListening(boolean listening) {
+ }
+
+ @Override
+ protected void handleClick(@Nullable View view) {
+ // If last user clicks < 5 seconds
+ // we cycle different duration
+ // otherwise toggle on/off
+ if (mWakeLock.isHeld() && (mLastClickTime != -1) &&
+ (SystemClock.elapsedRealtime() - mLastClickTime < 5000)) {
+ // cycle duration
+ mDuration++;
+ if (mDuration >= DURATIONS.length) {
+ // all durations cycled, turn if off
+ mDuration = -1;
+ stopCountDown();
+ if (mWakeLock.isHeld()) {
+ mWakeLock.release();
+ }
+ } else {
+ // change duration
+ startCountDown(DURATIONS[mDuration]);
+ if (!mWakeLock.isHeld()) {
+ mWakeLock.acquire();
+ }
+ }
+ } else {
+ // toggle
+ if (mWakeLock.isHeld()) {
+ mWakeLock.release();
+ stopCountDown();
+ } else {
+ mWakeLock.acquire();
+ mDuration = 0;
+ startCountDown(DURATIONS[mDuration]);
+ }
+ }
+ mLastClickTime = SystemClock.elapsedRealtime();
+ refreshState();
+ }
+
+ @Override
+ protected void handleLongClick(@Nullable View view) {
+ if (mWakeLock.isHeld()) {
+ if (mDuration == INFINITE_DURATION_INDEX) {
+ return;
+ }
+ } else {
+ mWakeLock.acquire();
+ }
+ mDuration = INFINITE_DURATION_INDEX;
+ startCountDown(DURATIONS[INFINITE_DURATION_INDEX]);
+ refreshState();
+ }
+
+ @Override
+ public Intent getLongClickIntent() {
+ return null;
+ }
+
+ @Override
+ public CharSequence getTileLabel() {
+ return mContext.getString(R.string.quick_settings_caffeine_label);
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsEvent.ICE;
+ }
+
+ private void startCountDown(long duration) {
+ stopCountDown();
+ mSecondsRemaining = (int)duration;
+ if (duration == -1) {
+ // infinity timing, no need to start timer
+ return;
+ }
+ mCountdownTimer = new CountDownTimer(duration * 1000, 1000) {
+ @Override
+ public void onTick(long millisUntilFinished) {
+ mSecondsRemaining = (int) (millisUntilFinished / 1000);
+ refreshState();
+ }
+
+ @Override
+ public void onFinish() {
+ if (mWakeLock.isHeld())
+ mWakeLock.release();
+ refreshState();
+ }
+
+ }.start();
+ }
+
+ private void stopCountDown() {
+ if (mCountdownTimer != null) {
+ mCountdownTimer.cancel();
+ mCountdownTimer = null;
+ }
+ }
+
+ private String formatValueWithRemainingTime() {
+ if (mSecondsRemaining == -1) {
+ return "\u221E"; // infinity
+ }
+ return String.format("%02d:%02d",
+ mSecondsRemaining / 60 % 60, mSecondsRemaining % 60);
+ }
+
+ @Override
+ protected void handleUpdateState(BooleanState state, Object arg) {
+ state.value = mWakeLock.isHeld();
+ state.icon = mIcon;
+ state.label = mContext.getString(R.string.quick_settings_caffeine_label);
+ if (state.value) {
+ state.secondaryLabel = formatValueWithRemainingTime();
+ state.contentDescription = mContext.getString(
+ R.string.accessibility_quick_settings_caffeine_on);
+ state.state = Tile.STATE_ACTIVE;
+ } else {
+ state.secondaryLabel = null;
+ state.contentDescription = mContext.getString(
+ R.string.accessibility_quick_settings_caffeine_off);
+ state.state = Tile.STATE_INACTIVE;
+ }
+ }
+
+ private final class Receiver extends BroadcastReceiver {
+ public void init() {
+ // Register for Intent broadcasts for...
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_SCREEN_OFF);
+ mContext.registerReceiver(this, filter, null, mHandler);
+ }
+
+ public void destroy() {
+ mContext.unregisterReceiver(this);
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (Intent.ACTION_SCREEN_OFF.equals(action)) {
+ // disable caffeine if user force off (power button)
+ stopCountDown();
+ if (mWakeLock.isHeld())
+ mWakeLock.release();
+ refreshState();
+ }
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
index 58585e09d85b..aede72b65860 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
@@ -303,7 +303,8 @@ public class CastTile extends QSTileImpl<BooleanState> {
refreshState();
}
} else {
- boolean enabledAndConnected = indicators.enabled && indicators.qsIcon.visible;
+ boolean enabledAndConnected = indicators.enabled &&
+ (indicators.qsIcon != null) && indicators.qsIcon.visible;
if (enabledAndConnected != mWifiConnected) {
mWifiConnected = enabledAndConnected;
// Hotspot is not connected, so changes here should update
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java
new file mode 100644
index 000000000000..d9fe618367ca
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod Project
+ * Copyright (C) 2017 The LineageOS 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.systemui.qs.tiles;
+
+import android.content.Intent;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.Settings;
+import android.provider.Settings.Global;
+import android.service.quicksettings.Tile;
+import android.view.View;
+
+import androidx.annotation.Nullable;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.Background;
+import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.plugins.ActivityStarter;
+import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.plugins.qs.QSTile.BooleanState;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.qs.QSHost;
+import com.android.systemui.qs.SettingObserver;
+import com.android.systemui.qs.logging.QSLogger;
+import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.settings.UserTracker;
+import com.android.systemui.util.settings.GlobalSettings;
+
+import javax.inject.Inject;
+
+/** Quick settings tile: Heads up **/
+public class HeadsUpTile extends QSTileImpl<BooleanState> {
+
+ public static final String TILE_SPEC = "heads_up";
+
+ private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_heads_up);
+
+ private static final Intent NOTIFICATION_SETTINGS =
+ new Intent("android.settings.NOTIFICATION_SETTINGS");
+
+ private final SettingObserver mSetting;
+
+ @Inject
+ public HeadsUpTile(
+ QSHost host,
+ @Background Looper backgroundLooper,
+ @Main Handler mainHandler,
+ FalsingManager falsingManager,
+ MetricsLogger metricsLogger,
+ StatusBarStateController statusBarStateController,
+ ActivityStarter activityStarter,
+ QSLogger qsLogger,
+ GlobalSettings globalSettings,
+ UserTracker userTracker
+ ) {
+ super(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,
+ statusBarStateController, activityStarter, qsLogger);
+
+ mSetting = new SettingObserver(globalSettings, mHandler,
+ Global.HEADS_UP_NOTIFICATIONS_ENABLED, userTracker.getUserId()) {
+ @Override
+ protected void handleValueChanged(int value, boolean observedChange) {
+ handleRefreshState(value);
+ }
+ };
+ }
+
+ @Override
+ public BooleanState newTileState() {
+ return new BooleanState();
+ }
+
+ @Override
+ protected void handleClick(@Nullable View view) {
+ setEnabled(!mState.value);
+ refreshState();
+ }
+
+ @Override
+ public Intent getLongClickIntent() {
+ return NOTIFICATION_SETTINGS;
+ }
+
+ private void setEnabled(boolean enabled) {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED,
+ enabled ? 1 : 0);
+ }
+
+ @Override
+ protected void handleUpdateState(BooleanState state, Object arg) {
+ final int value = arg instanceof Integer ? (Integer) arg : mSetting.getValue();
+ final boolean headsUp = value != 0;
+ state.value = headsUp;
+ state.label = mContext.getString(R.string.quick_settings_heads_up_label);
+ state.icon = mIcon;
+ if (headsUp) {
+ state.contentDescription = mContext.getString(
+ R.string.accessibility_quick_settings_heads_up_on);
+ state.state = Tile.STATE_ACTIVE;
+ } else {
+ state.contentDescription = mContext.getString(
+ R.string.accessibility_quick_settings_heads_up_off);
+ state.state = Tile.STATE_INACTIVE;
+ }
+ }
+
+ @Override
+ public CharSequence getTileLabel() {
+ return mContext.getString(R.string.quick_settings_heads_up_label);
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsEvent.ICE;
+ }
+
+ @Override
+ public void handleSetListening(boolean listening) {
+ // Do nothing
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
index e189f80a7c23..92d3956ea303 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
@@ -87,6 +87,7 @@ public class NfcTile extends QSTileImpl<BooleanState> {
@Override
public void handleSetListening(boolean listening) {
super.handleSetListening(listening);
+ if (mListening == listening) return;
mListening = listening;
if (mListening) {
mBroadcastDispatcher.registerReceiver(mNfcReceiver,
@@ -153,7 +154,7 @@ public class NfcTile extends QSTileImpl<BooleanState> {
private NfcAdapter getAdapter() {
if (mAdapter == null) {
try {
- mAdapter = NfcAdapter.getDefaultAdapter(mContext);
+ mAdapter = NfcAdapter.getNfcAdapter(mContext.getApplicationContext());
} catch (UnsupportedOperationException e) {
mAdapter = null;
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
index c291f87566c0..afb78ca62954 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
@@ -56,6 +56,7 @@ import android.graphics.Insets;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.media.AudioAttributes;
+import android.media.AudioManager;
import android.media.AudioSystem;
import android.media.MediaPlayer;
import android.net.Uri;
@@ -64,6 +65,8 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
+import android.os.VibrationEffect;
+import android.os.Vibrator;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -255,7 +258,7 @@ public class ScreenshotController {
// From WizardManagerHelper.java
private static final String SETTINGS_SECURE_USER_SETUP_COMPLETE = "user_setup_complete";
- private static final int SCREENSHOT_CORNER_DEFAULT_TIMEOUT_MILLIS = 6000;
+ private static final int SCREENSHOT_CORNER_DEFAULT_TIMEOUT_MILLIS = 3000;
private final WindowContext mContext;
private final FeatureFlags mFlags;
@@ -271,6 +274,7 @@ public class ScreenshotController {
private final WindowManager mWindowManager;
private final WindowManager.LayoutParams mWindowLayoutParams;
private final AccessibilityManager mAccessibilityManager;
+ private final AudioManager mAudioManager;
private final ListenableFuture<MediaPlayer> mCameraSound;
private final ScrollCaptureClient mScrollCaptureClient;
private final PhoneWindow mWindow;
@@ -278,6 +282,7 @@ public class ScreenshotController {
private final DisplayTracker mDisplayTracker;
private final ScrollCaptureController mScrollCaptureController;
private final LongScreenshotData mLongScreenshotHolder;
+ private final Vibrator mVibrator;
private final boolean mIsLowRamDevice;
private final ScreenshotNotificationSmartActionsProvider
mScreenshotNotificationSmartActionsProvider;
@@ -386,6 +391,10 @@ public class ScreenshotController {
// Setup the Camera shutter sound
mCameraSound = loadCameraSound();
+ // Grab system services needed for screenshot sound
+ mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+ mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
+
mCopyBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -1051,12 +1060,24 @@ public class ScreenshotController {
private void playCameraSound() {
mCameraSound.addListener(() -> {
- try {
- MediaPlayer player = mCameraSound.get();
- if (player != null) {
- player.start();
- }
- } catch (InterruptedException | ExecutionException e) {
+ switch (mAudioManager.getRingerMode()) {
+ case AudioManager.RINGER_MODE_NORMAL:
+ if (Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.SCREENSHOT_SHUTTER_SOUND, 1, UserHandle.USER_CURRENT) == 1) {
+ // Play the shutter sound to notify that we've taken a screenshot
+ try {
+ MediaPlayer player = mCameraSound.get();
+ if (player != null) {
+ player.start();
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ }
+ }
+ case AudioManager.RINGER_MODE_VIBRATE:
+ if (mVibrator != null && mVibrator.hasVibrator()) {
+ mVibrator.vibrate(VibrationEffect.createOneShot(50,
+ VibrationEffect.DEFAULT_AMPLITUDE));
+ }
}
}, mBgExecutor);
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
index afba7ad24692..2c8b8f36bdcf 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
@@ -120,8 +120,8 @@ public class ScreenshotView extends FrameLayout implements
private static final long SCREENSHOT_TO_CORNER_X_DURATION_MS = 234;
private static final long SCREENSHOT_TO_CORNER_Y_DURATION_MS = 500;
private static final long SCREENSHOT_TO_CORNER_SCALE_DURATION_MS = 234;
- public static final long SCREENSHOT_ACTIONS_EXPANSION_DURATION_MS = 400;
- private static final long SCREENSHOT_ACTIONS_ALPHA_DURATION_MS = 100;
+ public static final long SCREENSHOT_ACTIONS_EXPANSION_DURATION_MS = 300;
+ private static final long SCREENSHOT_ACTIONS_ALPHA_DURATION_MS = 75;
private static final float SCREENSHOT_ACTIONS_START_SCALE_X = .7f;
private static final int SWIPE_PADDING_DP = 12; // extra padding around views to allow swipe
diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
index 8089d01e7343..1c9252000b65 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
@@ -61,6 +61,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
private static final String TAG = "CentralSurfaces.BrightnessController";
private static final int SLIDER_ANIMATION_DURATION = 3000;
+ private static final int MSG_UPDATE_TOGGLE = 0;
private static final int MSG_UPDATE_SLIDER = 1;
private static final int MSG_ATTACH_LISTENER = 2;
private static final int MSG_DETACH_LISTENER = 3;
@@ -216,6 +217,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL,
mUserTracker.getUserId());
mAutomatic = automatic != Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
+ mHandler.obtainMessage(MSG_UPDATE_TOGGLE, automatic).sendToTarget();
}
};
@@ -254,6 +256,10 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
mExternalChange = true;
try {
switch (msg.what) {
+ case MSG_UPDATE_TOGGLE:
+ mControl.setToggleValue(
+ (int) msg.obj != Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
+ break;
case MSG_UPDATE_SLIDER:
updateSlider(Float.intBitsToFloat(msg.arg1), msg.arg2 != 0);
break;
@@ -364,6 +370,15 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
}
}
+ @Override
+ public void onCheckedChanged(boolean isChecked) {
+ final int mode = mAutomatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL
+ : Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
+ Settings.System.putIntForUser(mContext.getContentResolver(),
+ Settings.System.SCREEN_BRIGHTNESS_MODE, mode,
+ mUserTracker.getUserId());
+ }
+
public void checkRestrictionAndSetEnabled() {
mBackgroundHandler.post(new Runnable() {
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java
index 6c8190af27f7..e84e5a933ce0 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java
@@ -21,6 +21,7 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.CompoundButton;
import android.widget.SeekBar;
import androidx.annotation.Nullable;
@@ -88,12 +89,16 @@ public class BrightnessSliderController extends ViewController<BrightnessSliderV
@Override
protected void onViewAttached() {
mView.setOnSeekBarChangeListener(mSeekListener);
+ if (!mView.setOnCheckedChangeListener(mToggleChangeListener)) {
+ mToggleChangeListener = null;
+ }
mView.setOnInterceptListener(mOnInterceptListener);
}
@Override
protected void onViewDetached() {
mView.setOnSeekBarChangeListener(null);
+ mView.setOnCheckedChangeListener(null);
mView.setOnDispatchTouchEventListener(null);
mView.setOnInterceptListener(null);
}
@@ -125,6 +130,7 @@ public class BrightnessSliderController extends ViewController<BrightnessSliderV
if (mMirror != null) {
mMirror.setMax(mView.getMax());
mMirror.setValue(mView.getValue());
+ mMirror.setToggleValue(mView.getToggleValue());
mView.setOnDispatchTouchEventListener(this::mirrorTouchEvent);
} else {
// If there's no mirror, we may be the ones dispatching, events but we should not mirror
@@ -176,6 +182,19 @@ public class BrightnessSliderController extends ViewController<BrightnessSliderV
}
@Override
+ public void setToggleValue(boolean value) {
+ mView.setToggleValue(value);
+ if (mMirror != null) {
+ mMirror.setToggleValue(value);
+ }
+ }
+
+ @Override
+ public boolean getToggleValue() {
+ return mView.getToggleValue();
+ }
+
+ @Override
public void hideView() {
mView.setVisibility(View.GONE);
}
@@ -231,6 +250,13 @@ public class BrightnessSliderController extends ViewController<BrightnessSliderV
}
};
+ private CompoundButton.OnCheckedChangeListener mToggleChangeListener =
+ (buttonView, isChecked) -> {
+ if (mListener != null) {
+ mListener.onCheckedChanged(isChecked);
+ }
+ };
+
/**
* Creates a {@link BrightnessSliderController} with its associated view.
*/
@@ -252,8 +278,15 @@ public class BrightnessSliderController extends ViewController<BrightnessSliderV
*/
public BrightnessSliderController create(Context context, @Nullable ViewGroup viewRoot) {
int layout = getLayout();
- BrightnessSliderView root = (BrightnessSliderView) LayoutInflater.from(context)
+ boolean hasAutoBrightness = context.getResources().getBoolean(
+ com.android.internal.R.bool.config_automatic_brightness_available);
+ LayoutInflater inflater = LayoutInflater.from(context);
+
+ BrightnessSliderView root = (BrightnessSliderView) inflater
.inflate(layout, viewRoot, false);
+ if (hasAutoBrightness) {
+ inflater.inflate(R.layout.quick_settings_auto_brightness, root, true);
+ }
return new BrightnessSliderController(root, mFalsingManager);
}
diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java
index 38cb441a4f8c..b0f967bad876 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java
@@ -24,7 +24,8 @@ import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
-import android.widget.FrameLayout;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
import android.widget.SeekBar.OnSeekBarChangeListener;
import androidx.annotation.Keep;
@@ -39,14 +40,19 @@ import com.android.systemui.R;
* {@code FrameLayout} used to show and manipulate a {@link ToggleSeekBar}.
*
*/
-public class BrightnessSliderView extends FrameLayout {
+public class BrightnessSliderView extends LinearLayout {
@NonNull
private ToggleSeekBar mSlider;
+ @Nullable
+ private ToggleIconView mToggle;
+ private CompoundButton.OnCheckedChangeListener mToggleListener;
private DispatchTouchEventListener mListener;
private Gefingerpoken mOnInterceptListener;
@Nullable
private Drawable mProgressDrawable;
+ @Nullable
+ private Drawable mToggleBgDrawable;
private float mScale = 1f;
public BrightnessSliderView(Context context) {
@@ -78,6 +84,15 @@ public class BrightnessSliderView extends FrameLayout {
}
}
+ @Override
+ public void onViewAdded(View child) {
+ super.onViewAdded(child);
+ if (mToggle == null) {
+ mToggle = findViewById(R.id.toggle);
+ mToggleBgDrawable = mToggle != null ? mToggle.getBackground() : null;
+ }
+ }
+
/**
* Attaches a listener to relay touch events.
* @param listener use {@code null} to remove listener
@@ -113,13 +128,32 @@ public class BrightnessSliderView extends FrameLayout {
}
/**
+ * Attaches a listener to the toggle
+ * @param checkedListener use {@code null} to remove listener
+ * @return whether the listener was set
+ */
+ public boolean setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener checkedListener) {
+ if (mToggle != null) {
+ mToggleListener = checkedListener;
+ mToggle.setOnCheckedChangeListener(checkedListener);
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Enforces admin rules for toggling auto-brightness and changing value of brightness
* @param admin
* @see ToggleSeekBar#setEnforcedAdmin
+ * @see ToggleIconView#setEnforcedAdmin
*/
public void setEnforcedAdmin(RestrictedLockUtils.EnforcedAdmin admin) {
mSlider.setEnabled(admin == null);
mSlider.setEnforcedAdmin(admin);
+ if (mToggle != null) {
+ mToggle.setEnabled(admin == null);
+ mToggle.setEnforcedAdmin(admin);
+ }
}
/**
@@ -160,6 +194,29 @@ public class BrightnessSliderView extends FrameLayout {
return mSlider.getProgress();
}
+ /**
+ * Sets the current value of the toggle
+ * @param checked
+ */
+ public void setToggleValue(boolean checked) {
+ if (mToggle != null) {
+ // Avoid endless loops
+ mToggle.setOnCheckedChangeListener(null);
+ mToggle.setChecked(checked);
+ mToggle.setOnCheckedChangeListener(mToggleListener);
+ }
+ }
+
+ /**
+ * @return the current value of the toggle
+ */
+ public boolean getToggleValue() {
+ if (mToggle != null) {
+ return mToggle.isChecked();
+ }
+ return false;
+ }
+
public void setOnInterceptListener(Gefingerpoken onInterceptListener) {
mOnInterceptListener = onInterceptListener;
}
@@ -199,6 +256,11 @@ public class BrightnessSliderView extends FrameLayout {
int height = (int) (mProgressDrawable.getIntrinsicHeight() * mScale);
int inset = (mProgressDrawable.getIntrinsicHeight() - height) / 2;
mProgressDrawable.setBounds(r.left, inset, r.right, inset + height);
+ if (mToggleBgDrawable != null) {
+ final Rect rToggle = mToggleBgDrawable.getBounds();
+ // The slider & toggle share the same height
+ mToggleBgDrawable.setBounds(rToggle.left, inset, rToggle.right, inset + height);
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleIconView.kt b/packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleIconView.kt
new file mode 100644
index 000000000000..6f8c42d07be4
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleIconView.kt
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2022 Paranoid Android
+ *
+ * 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.systemui.settings.brightness
+
+import android.animation.ArgbEvaluator
+import android.animation.PropertyValuesHolder
+import android.animation.ValueAnimator
+import android.content.Context
+import android.content.res.ColorStateList
+import android.graphics.drawable.Drawable
+import android.graphics.drawable.LayerDrawable
+import android.util.AttributeSet
+import android.view.MotionEvent
+import android.widget.CheckBox
+import com.android.settingslib.RestrictedLockUtils
+import com.android.settingslib.Utils
+import com.android.systemui.Dependency
+import com.android.systemui.R
+import com.android.systemui.plugins.ActivityStarter
+import com.android.systemui.qs.tileimpl.QSIconViewImpl
+
+class ToggleIconView constructor(
+ context: Context,
+ attrs: AttributeSet?
+) : CheckBox(context, attrs) {
+
+ companion object {
+ private const val ICON_NAME = "icon"
+ private const val BACKGROUND_NAME = "background"
+ }
+
+ private val colorActive = Utils.getColorAttrDefaultColor(context, android.R.attr.colorAccent)
+ private val colorInactive = Utils.getColorAttrDefaultColor(context, R.attr.offStateColor)
+ private val colorSecondaryActive = Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.textColorPrimaryInverse)
+ private val colorSecondaryInactive = Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
+
+ private var currentBackgroundColor = colorInactive
+ private val singleAnimator: ValueAnimator = ValueAnimator().apply {
+ duration = QSIconViewImpl.QS_ANIM_LENGTH
+ addUpdateListener { animation ->
+ setColors(
+ animation.getAnimatedValue(ICON_NAME) as Int,
+ animation.getAnimatedValue(BACKGROUND_NAME) as Int
+ )
+ }
+ }
+
+ private var colorBackgroundDrawable: Drawable? = if (background is LayerDrawable) {
+ (background as LayerDrawable).findDrawableByLayerId(R.id.background) ?: background
+ } else {
+ background
+ }
+
+ private var mEnforcedAdmin: RestrictedLockUtils.EnforcedAdmin? = null
+
+ init {
+ setColors(getIconColor(isChecked), getBackgroundColor(isChecked))
+ jumpDrawablesToCurrentState()
+ }
+
+ private fun getIconColor(checked: Boolean): Int = if (checked) {
+ colorSecondaryActive
+ } else {
+ colorSecondaryInactive
+ }
+
+ private fun getBackgroundColor(checked: Boolean): Int = if (checked) {
+ colorActive
+ } else {
+ colorInactive
+ }
+
+ private fun setColors(iconColor: Int, backgroundColor: Int) {
+ foregroundTintList = ColorStateList.valueOf(iconColor)
+ colorBackgroundDrawable?.mutate()?.setTint(backgroundColor)
+ currentBackgroundColor = backgroundColor
+ }
+
+ override fun setChecked(checked: Boolean) {
+ if (checked != isChecked) {
+ singleAnimator.cancel()
+ val backgroundColor = getBackgroundColor(checked)
+ val iconColor = getIconColor(checked)
+ singleAnimator.setValues(
+ PropertyValuesHolder.ofInt(
+ ICON_NAME,
+ foregroundTintList?.defaultColor
+ ?: 0,
+ iconColor
+ ).apply { setEvaluator(ArgbEvaluator.getInstance()) },
+ PropertyValuesHolder.ofInt(
+ BACKGROUND_NAME,
+ currentBackgroundColor,
+ backgroundColor
+ ).apply { setEvaluator(ArgbEvaluator.getInstance()) }
+ )
+ singleAnimator.start()
+ }
+
+ super.setChecked(checked)
+ }
+
+ override fun jumpDrawablesToCurrentState() {
+ super.jumpDrawablesToCurrentState()
+ if (singleAnimator.isStarted) {
+ singleAnimator.end()
+ }
+ }
+
+ override fun onFilterTouchEventForSecurity(event: MotionEvent?): Boolean {
+ if (mEnforcedAdmin != null) {
+ val intent = RestrictedLockUtils.getShowAdminSupportDetailsIntent(
+ mContext, mEnforcedAdmin)
+ Dependency.get(ActivityStarter::class.java).postStartActivityDismissingKeyguard(intent, 0)
+ return true
+ }
+ return super.onFilterTouchEventForSecurity(event)
+ }
+
+ fun setEnforcedAdmin(admin: RestrictedLockUtils.EnforcedAdmin?) {
+ mEnforcedAdmin = admin
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleSlider.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleSlider.java
index 648e33b1d228..dc1d83107b0d 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleSlider.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/ToggleSlider.java
@@ -24,6 +24,7 @@ import com.android.systemui.statusbar.policy.BrightnessMirrorController;
public interface ToggleSlider {
interface Listener {
void onChanged(boolean tracking, int value, boolean stopTracking);
+ void onCheckedChanged(boolean isChecked);
}
void setEnforcedAdmin(RestrictedLockUtils.EnforcedAdmin admin);
@@ -35,6 +36,8 @@ public interface ToggleSlider {
int getMax();
void setValue(int value);
int getValue();
+ void setToggleValue(boolean value);
+ boolean getToggleValue();
void showView();
void hideView();
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index 8019a8398550..15327c577561 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -80,6 +80,7 @@ import android.transition.TransitionValues;
import android.util.IndentingPrintWriter;
import android.util.Log;
import android.util.MathUtils;
+import android.view.GestureDetector;
import android.view.InputDevice;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -228,6 +229,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherController;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcherView;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
+import com.android.systemui.tuner.TunerService;
import com.android.systemui.unfold.SysUIUnfoldComponent;
import com.android.systemui.util.Compile;
import com.android.systemui.util.LargeScreenUtils;
@@ -294,6 +296,10 @@ public final class NotificationPanelViewController implements Dumpable {
private static final String COUNTER_PANEL_OPEN = "panel_open";
public static final String COUNTER_PANEL_OPEN_QS = "panel_open_qs";
private static final String COUNTER_PANEL_OPEN_PEEK = "panel_open_peek";
+
+ private static final String DOUBLE_TAP_SLEEP_GESTURE =
+ Settings.Secure.DOUBLE_TAP_SLEEP_GESTURE;
+
private static final Rect M_DUMMY_DIRTY_RECT = new Rect(0, 0, 1, 1);
private static final Rect EMPTY_RECT = new Rect();
/**
@@ -363,6 +369,7 @@ public final class NotificationPanelViewController implements Dumpable {
private final QuickSettingsController mQsController;
private final InteractionJankMonitor mInteractionJankMonitor;
private final TouchHandler mTouchHandler = new TouchHandler();
+ private final TunerService mTunerService;
private long mDownTime;
private boolean mTouchSlopExceededBeforeDown;
@@ -505,6 +512,8 @@ public final class NotificationPanelViewController implements Dumpable {
private final NotificationShadeDepthController mDepthController;
private final NavigationBarController mNavigationBarController;
private final int mDisplayId;
+ private boolean mDoubleTapToSleepEnabled;
+ private GestureDetector mDoubleTapGesture;
private final KeyguardIndicationController mKeyguardIndicationController;
private int mHeadsUpInset;
@@ -752,7 +761,8 @@ public final class NotificationPanelViewController implements Dumpable {
KeyguardTransitionInteractor keyguardTransitionInteractor,
DumpManager dumpManager,
KeyguardLongPressViewModel keyguardLongPressViewModel,
- KeyguardInteractor keyguardInteractor) {
+ KeyguardInteractor keyguardInteractor,
+ TunerService tunerService) {
mInteractionJankMonitor = interactionJankMonitor;
keyguardStateController.addCallback(new KeyguardStateController.Callback() {
@Override
@@ -848,6 +858,7 @@ public final class NotificationPanelViewController implements Dumpable {
LargeScreenUtils.shouldUseSplitNotificationShade(mResources);
mView.setWillNotDraw(!DEBUG_DRAWABLE);
mShadeHeaderController = shadeHeaderController;
+ mTunerService = tunerService;
mLayoutInflater = layoutInflater;
mFeatureFlags = featureFlags;
mFalsingCollector = falsingCollector;
@@ -888,6 +899,16 @@ public final class NotificationPanelViewController implements Dumpable {
});
mBottomAreaShadeAlphaAnimator.setDuration(160);
mBottomAreaShadeAlphaAnimator.setInterpolator(Interpolators.ALPHA_OUT);
+ mDoubleTapGesture = new GestureDetector(mView.getContext(),
+ new GestureDetector.SimpleOnGestureListener() {
+ @Override
+ public boolean onDoubleTap(MotionEvent e) {
+ if (mPowerManager != null) {
+ mPowerManager.goToSleep(e.getEventTime());
+ }
+ return true;
+ }
+ });
mConversationNotificationManager = conversationNotificationManager;
mAuthController = authController;
mLockIconViewController = lockIconViewController;
@@ -4476,7 +4497,8 @@ public final class NotificationPanelViewController implements Dumpable {
positionClockAndNotifications(true /* forceUpdate */);
}
- private final class ShadeAttachStateChangeListener implements View.OnAttachStateChangeListener {
+ private final class ShadeAttachStateChangeListener implements View.OnAttachStateChangeListener,
+ TunerService.Tunable {
@Override
public void onViewAttachedToWindow(View v) {
mFragmentService.getFragmentHostManager(mView)
@@ -4484,6 +4506,7 @@ public final class NotificationPanelViewController implements Dumpable {
mStatusBarStateController.addCallback(mStatusBarStateListener);
mStatusBarStateListener.onStateChanged(mStatusBarStateController.getState());
mConfigurationController.addCallback(mConfigurationListener);
+ mTunerService.addTunable(this, DOUBLE_TAP_SLEEP_GESTURE);
// Theme might have changed between inflating this view and attaching it to the
// window, so
// force a call to onThemeChanged
@@ -4501,6 +4524,14 @@ public final class NotificationPanelViewController implements Dumpable {
mStatusBarStateController.removeCallback(mStatusBarStateListener);
mConfigurationController.removeCallback(mConfigurationListener);
mFalsingManager.removeTapListener(mFalsingTapListener);
+ mTunerService.removeTunable(this);
+ }
+
+ @Override
+ public void onTuningChanged(String key, String newValue) {
+ if (DOUBLE_TAP_SLEEP_GESTURE.equals(key)) {
+ mDoubleTapToSleepEnabled = TunerService.parseIntegerSwitch(newValue, true);
+ }
}
}
@@ -4821,6 +4852,10 @@ public final class NotificationPanelViewController implements Dumpable {
return false;
}
+ if (mDoubleTapToSleepEnabled && !mPulsing && !mDozing && mBarState == StatusBarState.KEYGUARD) {
+ mDoubleTapGesture.onTouchEvent(event);
+ }
+
// Make sure the next touch won't the blocked after the current ends.
if (event.getAction() == MotionEvent.ACTION_UP
|| event.getAction() == MotionEvent.ACTION_CANCEL) {
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java
index 74a61a3efebe..e9a9f31e91c0 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowView.java
@@ -114,8 +114,15 @@ public class NotificationShadeWindowView extends FrameLayout {
DisplayCutout displayCutout = getRootWindowInsets().getDisplayCutout();
Pair<Integer, Integer> pairInsets = mLayoutInsetProvider
.getinsets(windowInsets, displayCutout);
- mLeftInset = pairInsets.first;
- mRightInset = pairInsets.second;
+ final int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View child = getChildAt(i);
+ if (child.getLayoutParams() instanceof LayoutParams) {
+ LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ mLeftInset = lp.ignoreLeftInset ? 0 : pairInsets.first;
+ mRightInset = lp.ignoreRightInset ? 0 : pairInsets.second;
+ }
+ }
applyMargins();
return windowInsets;
}
@@ -126,10 +133,11 @@ public class NotificationShadeWindowView extends FrameLayout {
View child = getChildAt(i);
if (child.getLayoutParams() instanceof LayoutParams) {
LayoutParams lp = (LayoutParams) child.getLayoutParams();
- if (!lp.ignoreRightInset
- && (lp.rightMargin != mRightInset || lp.leftMargin != mLeftInset)) {
- lp.rightMargin = mRightInset;
- lp.leftMargin = mLeftInset;
+ boolean marginChanged =
+ lp.rightMargin != mRightInset || lp.leftMargin != mLeftInset;
+ if (marginChanged) {
+ lp.leftMargin = lp.ignoreLeftInset ? 0 : mLeftInset;
+ lp.rightMargin = lp.ignoreRightInset ? 0 : mRightInset;
child.requestLayout();
}
}
@@ -243,6 +251,7 @@ public class NotificationShadeWindowView extends FrameLayout {
private static class LayoutParams extends FrameLayout.LayoutParams {
+ public boolean ignoreLeftInset;
public boolean ignoreRightInset;
LayoutParams(int width, int height) {
@@ -253,6 +262,8 @@ public class NotificationShadeWindowView extends FrameLayout {
super(c, attrs);
TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.StatusBarWindowView_Layout);
+ ignoreLeftInset = a.getBoolean(
+ R.styleable.StatusBarWindowView_Layout_ignoreLeftInset, false);
ignoreRightInset = a.getBoolean(
R.styleable.StatusBarWindowView_Layout_ignoreRightInset, false);
a.recycle();
diff --git a/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt b/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt
index b42bdaac9cdb..c8245e0528d2 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt
@@ -60,10 +60,13 @@ class PulsingGestureListener @Inject constructor(
) : GestureDetector.SimpleOnGestureListener(), Dumpable {
private var doubleTapEnabled = false
private var singleTapEnabled = false
+ private var doubleTapEnabledNative = false
init {
- val tunable = Tunable { key: String?, _: String? ->
+ val tunable = Tunable { key: String?, value: String? ->
when (key) {
+ Settings.Secure.DOUBLE_TAP_TO_WAKE ->
+ doubleTapEnabledNative = TunerService.parseIntegerSwitch(value, false)
Settings.Secure.DOZE_DOUBLE_TAP_GESTURE ->
doubleTapEnabled = ambientDisplayConfiguration.doubleTapGestureEnabled(
userTracker.userId)
@@ -73,6 +76,7 @@ class PulsingGestureListener @Inject constructor(
}
}
tunerService.addTunable(tunable,
+ Settings.Secure.DOUBLE_TAP_TO_WAKE,
Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
Settings.Secure.DOZE_TAP_SCREEN_GESTURE)
@@ -110,7 +114,7 @@ class PulsingGestureListener @Inject constructor(
// checks MUST be on the ACTION_UP event.
if (e.actionMasked == MotionEvent.ACTION_UP &&
statusBarStateController.isDozing &&
- (doubleTapEnabled || singleTapEnabled) &&
+ (doubleTapEnabled || singleTapEnabled || doubleTapEnabledNative) &&
!falsingManager.isProximityNear &&
!falsingManager.isFalseDoubleTap
) {
@@ -128,6 +132,7 @@ class PulsingGestureListener @Inject constructor(
override fun dump(pw: PrintWriter, args: Array<out String>) {
pw.println("singleTapEnabled=$singleTapEnabled")
pw.println("doubleTapEnabled=$doubleTapEnabled")
+ pw.println("doubleTapEnabledNative=$doubleTapEnabledNative")
pw.println("isDocked=${dockManager.isDocked}")
pw.println("isProxCovered=${falsingManager.isProximityNear}")
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index d5751f4a349f..2b3444e64acb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -330,12 +330,14 @@ public class KeyguardIndicationController {
R.id.keyguard_indication_text_bottom);
mInitialTextColorState = mTopIndicationView != null
? mTopIndicationView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
- mRotateTextViewController = new KeyguardIndicationRotateTextViewController(
- mLockScreenIndicationView,
- mExecutor,
- mStatusBarStateController,
- mKeyguardLogger
- );
+ if (mRotateTextViewController == null || !mRotateTextViewController.isAttachedToWindow()) {
+ mRotateTextViewController = new KeyguardIndicationRotateTextViewController(
+ mLockScreenIndicationView,
+ mExecutor,
+ mStatusBarStateController,
+ mKeyguardLogger
+ );
+ }
updateDeviceEntryIndication(false /* animate */);
updateOrganizedOwnedDevice();
if (mBroadcastReceiver == null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java
index 324e97294f4e..2bbaa1ee6494 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java
@@ -124,6 +124,15 @@ public class VibratorHelper {
}
/**
+ * @see areAllPrimitivesSupported#hasVibrator()
+ */
+ public boolean areAllPrimitivesSupported(
+ @NonNull @VibrationEffect.Composition.PrimitiveType int... primitiveIds) {
+ return mVibrator != null &&
+ mVibrator.areAllPrimitivesSupported(primitiveIds);
+ }
+
+ /**
* @see Vibrator#cancel()
*/
public void cancel() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
index df850ae42712..88fe056ffbea 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
@@ -368,7 +368,10 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_CAMERA_LAUNCH,
"com.android.systemui:CAMERA_GESTURE");
}
- vibrateForCameraGesture();
+
+ if (source != StatusBarManager.CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE) {
+ vibrateForCameraGesture();
+ }
if (source == StatusBarManager.CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP) {
Log.v(CentralSurfaces.TAG, "Camera launch");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index ad2f4278a908..701e75be6534 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -1496,6 +1496,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
filter.addAction(Intent.ACTION_SCREEN_OFF);
+ filter.addAction(Intent.ACTION_SCREEN_CAMERA_GESTURE);
mBroadcastDispatcher.registerReceiver(mBroadcastReceiver, filter, null, UserHandle.ALL);
}
@@ -2591,6 +2592,21 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
finishBarAnimations();
resetUserExpandedStates();
}
+ else if (Intent.ACTION_SCREEN_CAMERA_GESTURE.equals(action)) {
+ boolean userSetupComplete = Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.USER_SETUP_COMPLETE, 0) != 0;
+ if (!userSetupComplete) {
+ if (DEBUG) Log.d(TAG, String.format(
+ "userSetupComplete = %s, ignoring camera launch gesture.",
+ userSetupComplete));
+ return;
+ }
+
+ // This gets executed before we will show Keyguard, so post it in order that the
+ // state is correct.
+ mMainExecutor.execute(() -> mCommandQueueCallbacks.onCameraLaunchGestureDetected(
+ StatusBarManager.CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE));
+ }
Trace.endSection();
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index f56b6cf03413..e8935765b8aa 100755
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -341,6 +341,9 @@ public class PhoneStatusBarPolicy
mRecordingController.addCallback(this);
mCommandQueue.addCallback(this);
+
+ // Get initial user setup state
+ onUserSetupChanged();
}
private String getManagedProfileAccessibilityString() {
diff --git a/packages/SystemUI/src/com/android/systemui/toast/SystemUIToast.java b/packages/SystemUI/src/com/android/systemui/toast/SystemUIToast.java
index 05e566690f57..29f16c7b924a 100644
--- a/packages/SystemUI/src/com/android/systemui/toast/SystemUIToast.java
+++ b/packages/SystemUI/src/com/android/systemui/toast/SystemUIToast.java
@@ -272,10 +272,10 @@ public class SystemUIToast implements ToastPlugin.Toast {
private static boolean showApplicationIcon(ApplicationInfo appInfo,
PackageManager packageManager) {
- if (hasFlag(appInfo.flags, FLAG_UPDATED_SYSTEM_APP)) {
+ if (hasFlag(appInfo.flags, FLAG_UPDATED_SYSTEM_APP | FLAG_SYSTEM)) {
return packageManager.getLaunchIntentForPackage(appInfo.packageName) != null;
}
- return !hasFlag(appInfo.flags, FLAG_SYSTEM);
+ return true;
}
private static boolean hasFlag(int flags, int flag) {
diff --git a/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiController.java b/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiController.java
new file mode 100644
index 000000000000..5fed8858c34d
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiController.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2019 Paranoid Android
+ *
+ * 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.systemui.tristate;
+
+import com.android.systemui.plugins.Plugin;
+import com.android.systemui.plugins.VolumeDialog.Callback;
+import com.android.systemui.plugins.annotations.DependsOn;
+import com.android.systemui.plugins.annotations.ProvidesInterface;
+
+@DependsOn(target = Callback.class)
+@ProvidesInterface(action = "com.android.systemui.action.PLUGIN_TRI_STATE_UI", version = 1)
+public interface TriStateUiController extends Plugin {
+
+ public interface UserActivityListener {
+ void onTriStateUserActivity();
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiControllerImpl.java b/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiControllerImpl.java
new file mode 100644
index 000000000000..5779cbceba41
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiControllerImpl.java
@@ -0,0 +1,503 @@
+/*
+ * Copyright 2019 Paranoid Android
+ *
+ * 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.systemui.tristate;
+
+import static android.view.Surface.ROTATION_90;
+import static android.view.Surface.ROTATION_180;
+import static android.view.Surface.ROTATION_270;
+
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.ColorStateList;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.drawable.ColorDrawable;
+import android.hardware.display.DisplayManagerGlobal;
+import android.media.AudioManager;
+import android.os.Build;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.provider.Settings;
+import android.util.Log;
+import android.view.Display;
+import android.view.OrientationEventListener;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager.LayoutParams;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.android.internal.policy.SystemBarUtils;
+import com.android.systemui.Dependency;
+import com.android.systemui.R;
+import com.android.systemui.tristate.TriStateUiController;
+import com.android.systemui.tristate.TriStateUiController.UserActivityListener;
+import com.android.systemui.plugins.VolumeDialogController;
+import com.android.systemui.plugins.VolumeDialogController.Callbacks;
+import com.android.systemui.plugins.VolumeDialogController.State;
+import com.android.systemui.statusbar.policy.ConfigurationController;
+import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
+
+public class TriStateUiControllerImpl implements ConfigurationListener, TriStateUiController {
+
+ private static String TAG = "TriStateUiControllerImpl";
+
+ private static final int MSG_DIALOG_SHOW = 1;
+ private static final int MSG_DIALOG_DISMISS = 2;
+ private static final int MSG_RESET_SCHEDULE = 3;
+ private static final int MSG_STATE_CHANGE = 4;
+
+ private static final int MODE_NORMAL = AudioManager.RINGER_MODE_NORMAL;
+ private static final int MODE_SILENT = AudioManager.RINGER_MODE_SILENT;
+ private static final int MODE_VIBRATE = AudioManager.RINGER_MODE_VIBRATE;
+
+ private static final int TRI_STATE_UI_POSITION_LEFT = 0;
+ private static final int TRI_STATE_UI_POSITION_RIGHT = 1;
+
+ private static final int DIALOG_TIMEOUT = 2000;
+
+ private Context mContext;
+ private final VolumeDialogController mVolumeDialogController;
+ private final Callbacks mVolumeDialogCallback = new Callbacks() {
+ @Override
+ public void onShowRequested(int reason, boolean keyguardLocked, int lockTaskModeState) { }
+
+ @Override
+ public void onDismissRequested(int reason) { }
+
+ @Override
+ public void onScreenOff() { }
+
+ @Override
+ public void onStateChanged(State state) { }
+
+ @Override
+ public void onLayoutDirectionChanged(int layoutDirection) { }
+
+ @Override
+ public void onShowVibrateHint() { }
+
+ @Override
+ public void onShowSilentHint() { }
+
+ @Override
+ public void onShowSafetyWarning(int flags) { }
+
+ @Override
+ public void onAccessibilityModeChanged(Boolean showA11yStream) { }
+
+ @Override
+ public void onCaptionComponentStateChanged(
+ Boolean isComponentEnabled, Boolean fromTooltip) {}
+
+ @Override
+ public void onConfigurationChanged() {
+ updateTheme();
+ updateTriStateLayout();
+ }
+ };
+
+ private int mDensity;
+ private Dialog mDialog;
+ private int mDialogPosition;
+ private ViewGroup mDialogView;
+ private final H mHandler;
+ private UserActivityListener mListener;
+ OrientationEventListener mOrientationListener;
+ private int mOrientationType = 0;
+ private boolean mShowing = false;
+ private int mBackgroundColor = 0;
+ private int mThemeMode = 0;
+ private int mIconColor = 0;
+ private int mTextColor = 0;
+ private ImageView mTriStateIcon;
+ private TextView mTriStateText;
+ private int mTriStateMode = -1;
+ private Window mWindow;
+ private LayoutParams mWindowLayoutParams;
+ private int mWindowType;
+
+ private final BroadcastReceiver mRingerStateReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ updateRingerModeChanged();
+ }
+ };
+
+ private final class H extends Handler {
+ private TriStateUiControllerImpl mUiController;
+
+ public H(TriStateUiControllerImpl uiController) {
+ super(Looper.getMainLooper());
+ mUiController = uiController;
+ }
+
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_DIALOG_SHOW:
+ mUiController.handleShow();
+ return;
+ case MSG_DIALOG_DISMISS:
+ mUiController.handleDismiss();
+ return;
+ case MSG_RESET_SCHEDULE:
+ mUiController.handleResetTimeout();
+ return;
+ case MSG_STATE_CHANGE:
+ mUiController.handleStateChanged();
+ return;
+ default:
+ return;
+ }
+ }
+ }
+
+ public TriStateUiControllerImpl(Context context) {
+ mContext = context;
+ mHandler = new H(this);
+ mOrientationListener = new OrientationEventListener(mContext, 3) {
+ @Override
+ public void onOrientationChanged(int orientation) {
+ checkOrientationType();
+ }
+ };
+ mVolumeDialogController =
+ (VolumeDialogController) Dependency.get(VolumeDialogController.class);
+ IntentFilter ringerChanged = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
+ mContext.registerReceiver(mRingerStateReceiver, ringerChanged);
+ }
+
+ private void checkOrientationType() {
+ Display display = DisplayManagerGlobal.getInstance().getRealDisplay(0);
+ if (display != null) {
+ int rotation = display.getRotation();
+ if (rotation != mOrientationType) {
+ mOrientationType = rotation;
+ updateTriStateLayout();
+ }
+ }
+ }
+
+ public void init(int windowType, UserActivityListener listener) {
+ mWindowType = windowType;
+ mDensity = mContext.getResources().getConfiguration().densityDpi;
+ mListener = listener;
+ ((ConfigurationController) Dependency.get(
+ ConfigurationController.class)).addCallback(this);
+ mVolumeDialogController.addCallback(mVolumeDialogCallback, mHandler);
+ initDialog();
+ }
+
+ public void destroy() {
+ ((ConfigurationController) Dependency.get(
+ ConfigurationController.class)).removeCallback(this);
+ mVolumeDialogController.removeCallback(mVolumeDialogCallback);
+ mContext.unregisterReceiver(mRingerStateReceiver);
+ }
+
+ private void initDialog() {
+ if (mDialog != null) {
+ mDialog.dismiss();
+ mDialog = null;
+ }
+ mDialog = new Dialog(mContext);
+ mShowing = false;
+ mWindow = mDialog.getWindow();
+ mWindow.requestFeature(Window.FEATURE_NO_TITLE);
+ mWindow.setBackgroundDrawable(new ColorDrawable(0));
+ mWindow.clearFlags(LayoutParams.FLAG_DIM_BEHIND);
+ mWindow.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE
+ | LayoutParams.FLAG_LAYOUT_IN_SCREEN
+ | LayoutParams.FLAG_NOT_TOUCH_MODAL
+ | LayoutParams.FLAG_SHOW_WHEN_LOCKED
+ | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
+ | LayoutParams.FLAG_HARDWARE_ACCELERATED);
+ mDialog.setCanceledOnTouchOutside(false);
+ mWindowLayoutParams = mWindow.getAttributes();
+ mWindowLayoutParams.type = mWindowType;
+ mWindowLayoutParams.format = -3;
+ mWindowLayoutParams.setTitle(TriStateUiControllerImpl.class.getSimpleName());
+ mWindowLayoutParams.gravity = 53;
+ mWindowLayoutParams.y = mDialogPosition;
+ mWindow.setAttributes(mWindowLayoutParams);
+ mWindow.setSoftInputMode(LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
+ mDialog.setContentView(R.layout.tri_state_dialog);
+ mDialogView = (ViewGroup) mDialog.findViewById(R.id.tri_state_layout);
+ mTriStateIcon = (ImageView) mDialog.findViewById(R.id.tri_state_icon);
+ mTriStateText = (TextView) mDialog.findViewById(R.id.tri_state_text);
+ updateTheme();
+ }
+
+ public void show() {
+ mHandler.obtainMessage(MSG_DIALOG_SHOW, 0, 0).sendToTarget();
+ }
+
+ private void registerOrientationListener(boolean enable) {
+ if (mOrientationListener.canDetectOrientation() && enable) {
+ Log.v(TAG, "Can detect orientation");
+ mOrientationListener.enable();
+ return;
+ }
+ Log.v(TAG, "Cannot detect orientation");
+ mOrientationListener.disable();
+ }
+
+ private void updateTriStateLayout() {
+ if (mContext != null) {
+ int iconId = 0;
+ int textId = 0;
+ int bg = 0;
+ Resources res = mContext.getResources();
+ if (res != null) {
+ int positionY;
+ int positionY2 = mWindowLayoutParams.y;
+ int positionX = mWindowLayoutParams.x;
+ int gravity = mWindowLayoutParams.gravity;
+ switch (mTriStateMode) {
+ case MODE_SILENT:
+ iconId = R.drawable.ic_volume_ringer_mute;
+ textId = R.string.volume_ringer_status_silent;
+ break;
+ case MODE_VIBRATE:
+ iconId = R.drawable.ic_volume_ringer_vibrate;
+ textId = R.string.volume_ringer_status_vibrate;
+ break;
+ case MODE_NORMAL:
+ iconId = R.drawable.ic_volume_ringer;
+ textId = R.string.volume_ringer_status_normal;
+ break;
+ }
+ int triStatePos = res.getInteger(
+ com.android.internal.R.integer.config_alertSliderLocation);
+ boolean isTsKeyRight = true;
+ if (triStatePos == TRI_STATE_UI_POSITION_LEFT) {
+ isTsKeyRight = false;
+ } else if (triStatePos == TRI_STATE_UI_POSITION_RIGHT) {
+ isTsKeyRight = true;
+ }
+ switch (mOrientationType) {
+ case ROTATION_90:
+ if (isTsKeyRight) {
+ gravity = 51;
+ } else {
+ gravity = 83;
+ }
+ positionY2 = res.getDimensionPixelSize(
+ R.dimen.tri_state_up_dialog_position_deep_land);
+ if (isTsKeyRight) {
+ positionY2 += SystemBarUtils.getStatusBarHeight(mContext);
+ }
+ if (mTriStateMode == MODE_SILENT) {
+ positionX = res.getDimensionPixelSize(
+ R.dimen.tri_state_up_dialog_position_l);
+ } else if (mTriStateMode == MODE_VIBRATE) {
+ positionX = res.getDimensionPixelSize(
+ R.dimen.tri_state_middle_dialog_position_l);
+ } else if (mTriStateMode == MODE_NORMAL) {
+ positionX = res.getDimensionPixelSize(
+ R.dimen.tri_state_down_dialog_position_l);
+ }
+ bg = R.drawable.dialog_tri_state_middle_bg;
+ break;
+ case ROTATION_180:
+ if (isTsKeyRight) {
+ gravity = 83;
+ } else {
+ gravity = 85;
+ }
+ positionX = res.getDimensionPixelSize(
+ R.dimen.tri_state_up_dialog_position_deep);
+ positionY2 = SystemBarUtils.getStatusBarHeight(mContext);
+ bg = R.drawable.dialog_tri_state_middle_bg;
+ if (mTriStateMode != MODE_SILENT) {
+ if (mTriStateMode != MODE_VIBRATE) {
+ if (mTriStateMode == MODE_NORMAL) {
+ positionY2 += res.getDimensionPixelSize(
+ R.dimen.tri_state_down_dialog_position);
+ break;
+ }
+ }
+ positionY2 += res.getDimensionPixelSize(
+ R.dimen.tri_state_middle_dialog_position);
+ break;
+ }
+ positionY2 += res.getDimensionPixelSize(R.dimen.tri_state_up_dialog_position);
+ break;
+ case ROTATION_270:
+ if (isTsKeyRight) {
+ gravity = 85;
+ } else {
+ gravity = 53;
+ }
+ positionY2 = res.getDimensionPixelSize(
+ R.dimen.tri_state_up_dialog_position_deep_land);
+ if (!isTsKeyRight) {
+ positionY2 += SystemBarUtils.getStatusBarHeight(mContext);
+ }
+ if (mTriStateMode == MODE_SILENT) {
+ positionX = res.getDimensionPixelSize(
+ R.dimen.tri_state_up_dialog_position_l);
+ } else if (mTriStateMode == MODE_VIBRATE) {
+ positionX = res.getDimensionPixelSize(
+ R.dimen.tri_state_middle_dialog_position_l);
+ } else if (mTriStateMode == MODE_NORMAL) {
+ positionX = res.getDimensionPixelSize(
+ R.dimen.tri_state_down_dialog_position_l);
+ }
+ bg = R.drawable.dialog_tri_state_middle_bg;
+ break;
+ default:
+ if (isTsKeyRight) {
+ gravity = 53;
+ } else {
+ gravity = 51;
+ }
+ positionX = res.getDimensionPixelSize(
+ R.dimen.tri_state_up_dialog_position_deep);
+ if (mTriStateMode != MODE_SILENT) {
+ if (mTriStateMode != MODE_VIBRATE) {
+ if (mTriStateMode == MODE_NORMAL) {
+ positionY2 = res.getDimensionPixelSize(
+ R.dimen.tri_state_down_dialog_position)
+ + SystemBarUtils.getStatusBarHeight(mContext);
+ bg = R.drawable.dialog_tri_state_down_bg;
+ break;
+ }
+ }
+ positionY2 = res.getDimensionPixelSize(
+ R.dimen.tri_state_middle_dialog_position)
+ + SystemBarUtils.getStatusBarHeight(mContext);
+ bg = R.drawable.dialog_tri_state_middle_bg;
+ break;
+ }
+ positionY2 = res.getDimensionPixelSize(
+ R.dimen.tri_state_up_dialog_position)
+ + SystemBarUtils.getStatusBarHeight(mContext);
+ bg = R.drawable.dialog_tri_state_up_bg;
+ break;
+ }
+ if (mTriStateMode != -1) {
+ if (mTriStateIcon != null && iconId != 0) {
+ mTriStateIcon.setImageResource(iconId);
+ }
+ if (mTriStateText != null && textId != 0) {
+ String inputText = res.getString(textId);
+ if (inputText != null && mTriStateText.length() == inputText.length()) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(inputText);
+ sb.append(" ");
+ inputText = sb.toString();
+ }
+ mTriStateText.setText(inputText);
+ }
+ if (mDialogView != null && bg != 0) {
+ mDialogView.setBackgroundDrawable(res.getDrawable(bg));
+ }
+ mDialogPosition = positionY2;
+ }
+ positionY = res.getDimensionPixelSize(R.dimen.tri_state_dialog_padding);
+ mWindowLayoutParams.gravity = gravity;
+ mWindowLayoutParams.y = positionY2 - positionY;
+ mWindowLayoutParams.x = positionX - positionY;
+ mWindow.setAttributes(mWindowLayoutParams);
+ handleResetTimeout();
+ }
+ }
+ }
+
+ private void updateRingerModeChanged() {
+ mHandler.obtainMessage(MSG_STATE_CHANGE, 0, 0).sendToTarget();
+ if (mTriStateMode != -1) {
+ show();
+ }
+ }
+
+ private void handleShow() {
+ mHandler.removeMessages(MSG_DIALOG_SHOW);
+ mHandler.removeMessages(MSG_DIALOG_DISMISS);
+ handleResetTimeout();
+ if (!mShowing) {
+ updateTheme();
+ registerOrientationListener(true);
+ checkOrientationType();
+ mShowing = true;
+ mDialog.show();
+ if (mListener != null) {
+ mListener.onTriStateUserActivity();
+ }
+ }
+ }
+
+ private void handleDismiss() {
+ mHandler.removeMessages(MSG_DIALOG_SHOW);
+ mHandler.removeMessages(MSG_DIALOG_DISMISS);
+ if (mShowing) {
+ registerOrientationListener(false);
+ mShowing = false;
+ mDialog.dismiss();
+ }
+ }
+
+ private void handleStateChanged() {
+ AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+ int ringerMode = am.getRingerModeInternal();
+ if (ringerMode != mTriStateMode) {
+ mTriStateMode = ringerMode;
+ updateTriStateLayout();
+ if (mListener != null) {
+ mListener.onTriStateUserActivity();
+ }
+ }
+ }
+
+ public void handleResetTimeout() {
+ mHandler.removeMessages(MSG_DIALOG_DISMISS);
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(
+ MSG_DIALOG_DISMISS, MSG_RESET_SCHEDULE, 0), (long) DIALOG_TIMEOUT);
+ if (mListener != null) {
+ mListener.onTriStateUserActivity();
+ }
+ }
+
+ @Override
+ public void onDensityOrFontScaleChanged() {
+ handleDismiss();
+ initDialog();
+ updateTriStateLayout();
+ }
+
+ private void updateTheme() {
+ // Todo: Add some logic to update the theme only when a new theme is applied
+ mIconColor = getAttrColor(android.R.attr.colorAccent);
+ mTextColor = getAttrColor(android.R.attr.textColorPrimary);
+ mBackgroundColor = getAttrColor(android.R.attr.colorPrimary);
+ mDialogView.setBackgroundTintList(ColorStateList.valueOf(mBackgroundColor));
+ mTriStateIcon.setColorFilter(mIconColor);
+ mTriStateText.setTextColor(mTextColor);
+ }
+
+ public int getAttrColor(int attr) {
+ TypedArray ta = mContext.obtainStyledAttributes(new int[]{attr});
+ int colorAccent = ta.getColor(0, 0);
+ ta.recycle();
+ return colorAccent;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
index 246488600eef..fc05d9b5ef02 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
@@ -19,7 +19,6 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.view.MenuItem;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
@@ -87,18 +86,6 @@ public class DemoModeFragment extends PreferenceFragment implements OnPreference
mDemoModeTracker.startTracking();
updateDemoModeEnabled();
updateDemoModeOn();
-
- setHasOptionsMenu(true);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- getFragmentManager().popBackStack();
- break;
- }
- return super.onOptionsItemSelected(item);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/StatusBarTuner.java b/packages/SystemUI/src/com/android/systemui/tuner/StatusBarTuner.java
new file mode 100644
index 000000000000..c1447e6c7ab4
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/tuner/StatusBarTuner.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 The LineageOS 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.systemui.tuner;
+
+import android.os.Bundle;
+
+import androidx.preference.PreferenceFragment;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.systemui.R;
+
+public class StatusBarTuner extends PreferenceFragment {
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ addPreferencesFromResource(R.xml.status_bar_prefs);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ MetricsLogger.visibility(getContext(), MetricsEvent.TUNER, true);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ MetricsLogger.visibility(getContext(), MetricsEvent.TUNER, false);
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java
index 32ecb6786a51..fc91ff129c06 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java
@@ -15,20 +15,17 @@
*/
package com.android.systemui.tuner;
-import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
-import android.view.MenuItem;
-import android.view.Window;
-import android.view.WindowManager;
-import android.widget.Toolbar;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
import androidx.preference.PreferenceScreen;
+import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
+
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.demomode.DemoModeController;
@@ -37,7 +34,7 @@ import com.android.systemui.util.settings.GlobalSettings;
import javax.inject.Inject;
-public class TunerActivity extends Activity implements
+public class TunerActivity extends CollapsingToolbarBaseActivity implements
PreferenceFragment.OnPreferenceStartFragmentCallback,
PreferenceFragment.OnPreferenceStartScreenCallback {
@@ -61,23 +58,19 @@ public class TunerActivity extends Activity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setTheme(R.style.Theme_AppCompat_DayNight);
-
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.tuner_activity);
- Toolbar toolbar = findViewById(R.id.action_bar);
- if (toolbar != null) {
- setActionBar(toolbar);
- }
if (getFragmentManager().findFragmentByTag(TAG_TUNER) == null) {
final String action = getIntent().getAction();
- boolean showDemoMode = action != null && action.equals(
- "com.android.settings.action.DEMO_MODE");
- final PreferenceFragment fragment = showDemoMode
- ? new DemoModeFragment(mDemoModeController, mGlobalSettings)
- : new TunerFragment(mTunerService);
+ final Fragment fragment;
+ if ("com.android.settings.action.DEMO_MODE".equals(action)) {
+ fragment = new DemoModeFragment(mDemoModeController, mGlobalSettings);
+ } else if ("com.android.settings.action.STATUS_BAR_TUNER".equals(action)) {
+ fragment = new StatusBarTuner();
+ } else {
+ fragment = new TunerFragment(mTunerService);
+ }
+
getFragmentManager().beginTransaction().replace(R.id.content_frame,
fragment, TAG_TUNER).commit();
}
@@ -90,15 +83,6 @@ public class TunerActivity extends Activity implements
}
@Override
- public boolean onMenuItemSelected(int featureId, MenuItem item) {
- if (item.getItemId() == android.R.id.home) {
- onBackPressed();
- return true;
- }
- return super.onMenuItemSelected(featureId, item);
- }
-
- @Override
public void onBackPressed() {
if (!getFragmentManager().popBackStackImmediate()) {
super.onBackPressed();
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
index 989462a9fd34..c1bb0ea68ec7 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
@@ -16,17 +16,9 @@
package com.android.systemui.tuner;
import android.annotation.SuppressLint;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.content.DialogInterface;
import android.hardware.display.AmbientDisplayConfiguration;
import android.os.Build;
import android.os.Bundle;
-import android.provider.Settings;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
@@ -53,8 +45,6 @@ public class TunerFragment extends PreferenceFragment {
"picture_in_picture",
};
- private static final int MENU_REMOVE = Menu.FIRST + 1;
-
private final TunerService mTunerService;
// We are the only ones who ever call this constructor, so don't worry about the warning
@@ -67,14 +57,6 @@ public class TunerFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- setHasOptionsMenu(true);
- }
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
- getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
@@ -92,13 +74,6 @@ public class TunerFragment extends PreferenceFragment {
if (preference != null) getPreferenceScreen().removePreference(preference);
}
}
-
- if (Settings.Secure.getInt(getContext().getContentResolver(), SETTING_SEEN_TUNER_WARNING,
- 0) == 0) {
- if (getFragmentManager().findFragmentByTag(WARNING_TAG) == null) {
- new TunerWarningFragment().show(getFragmentManager(), WARNING_TAG);
- }
- }
}
private boolean alwaysOnAvailable() {
@@ -119,42 +94,4 @@ public class TunerFragment extends PreferenceFragment {
MetricsLogger.visibility(getContext(), MetricsEvent.TUNER, false);
}
-
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- menu.add(Menu.NONE, MENU_REMOVE, Menu.NONE, R.string.remove_from_settings);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- getActivity().finish();
- return true;
- case MENU_REMOVE:
- mTunerService.showResetRequest(() -> {
- if (getActivity() != null) {
- getActivity().finish();
- }
- });
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
- public static class TunerWarningFragment extends DialogFragment {
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- return new AlertDialog.Builder(getContext())
- .setTitle(R.string.tuner_warning_title)
- .setMessage(R.string.tuner_warning)
- .setPositiveButton(R.string.got_it, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Settings.Secure.putInt(getContext().getContentResolver(),
- SETTING_SEEN_TUNER_WARNING, 1);
- }
- }).show();
- }
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index e8a22ec4fbe7..a56bcacfb3bb 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -394,9 +394,8 @@ public class StorageNotification implements CoreStartable {
final VolumeRecord rec = mStorageManager.findRecordByUuid(vol.getFsUuid());
final DiskInfo disk = vol.getDisk();
- // Don't annoy when user dismissed in past. (But make sure the disk is adoptable; we
- // used to allow snoozing non-adoptable disks too.)
- if (rec.isSnoozed() && disk.isAdoptable()) {
+ // Don't annoy when user dismissed in past.
+ if (rec.isSnoozed() && (disk.isAdoptable() || disk.isSd())) {
return null;
}
if (disk.isAdoptable() && !rec.isInited() && rec.getType() != VolumeInfo.TYPE_PUBLIC
@@ -439,8 +438,12 @@ public class StorageNotification implements CoreStartable {
buildUnmountPendingIntent(vol)))
.setContentIntent(browseIntent)
.setCategory(Notification.CATEGORY_SYSTEM);
- // Non-adoptable disks can't be snoozed.
- if (disk.isAdoptable()) {
+ // USB disks notification can be persistent
+ if (disk.isUsb()) {
+ builder.setOngoing(true);
+ }
+
+ if (disk.isAdoptable() || disk.isSd()) {
builder.setDeleteIntent(buildSnoozeIntent(vol.getFsUuid()));
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
index a4537267ed62..d874f4298ecb 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
@@ -37,6 +37,8 @@ import com.android.systemui.plugins.VolumeDialog;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.qs.tiles.DndTile;
import com.android.systemui.statusbar.policy.ExtensionController;
+import com.android.systemui.tristate.TriStateUiController;
+import com.android.systemui.tristate.TriStateUiControllerImpl;
import com.android.systemui.tuner.TunerService;
import java.io.PrintWriter;
@@ -50,7 +52,7 @@ import javax.inject.Inject;
*/
@SysUISingleton
public class VolumeDialogComponent implements VolumeComponent, TunerService.Tunable,
- VolumeDialogControllerImpl.UserActivityListener{
+ VolumeDialogControllerImpl.UserActivityListener, TriStateUiController.UserActivityListener {
public static final String VOLUME_DOWN_SILENT = "sysui_volume_down_silent";
public static final String VOLUME_UP_SILENT = "sysui_volume_up_silent";
@@ -67,6 +69,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
protected final Context mContext;
private final VolumeDialogControllerImpl mController;
+ private TriStateUiControllerImpl mTriStateController;
private final InterestingConfigChanges mConfigChanges = new InterestingConfigChanges(
ActivityInfo.CONFIG_FONT_SCALE | ActivityInfo.CONFIG_LOCALE
| ActivityInfo.CONFIG_ASSETS_PATHS | ActivityInfo.CONFIG_UI_MODE);
@@ -91,6 +94,8 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
mActivityStarter = activityStarter;
mController = volumeDialogController;
mController.setUserActivityListener(this);
+ boolean hasAlertSlider = mContext.getResources().
+ getBoolean(com.android.internal.R.bool.config_hasAlertSlider);
// Allow plugins to reference the VolumeDialogController.
pluginDependencyProvider.allowPluginDependency(VolumeDialogController.class);
extensionController.newExtension(VolumeDialog.class)
@@ -102,6 +107,13 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
}
mDialog = dialog;
mDialog.init(LayoutParams.TYPE_VOLUME_OVERLAY, mVolumeDialogCallback);
+ if (hasAlertSlider) {
+ if (mTriStateController != null) {
+ mTriStateController.destroy();
+ }
+ mTriStateController = new TriStateUiControllerImpl(mContext);
+ mTriStateController.init(LayoutParams.TYPE_VOLUME_OVERLAY, this);
+ }
}).build();
@@ -202,6 +214,11 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
mActivityStarter.startActivity(intent, true /* onlyProvisioned */, true /* dismissShade */);
}
+ @Override
+ public void onTriStateUserActivity() {
+ onUserActivity();
+ }
+
private final VolumeDialogImpl.Callback mVolumeDialogCallback = new VolumeDialogImpl.Callback() {
@Override
public void onZenSettingsClicked() {
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 1cfcf8cbbdcb..263a8989ed90 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -28,6 +28,7 @@ import static android.media.AudioManager.STREAM_VOICE_CALL;
import static android.view.View.ACCESSIBILITY_LIVE_REGION_POLITE;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
+import static android.view.View.LAYOUT_DIRECTION_LTR;
import static android.view.View.LAYOUT_DIRECTION_RTL;
import static android.view.View.VISIBLE;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
@@ -45,6 +46,8 @@ import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.Dialog;
import android.app.KeyguardManager;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothProfile;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
@@ -65,6 +68,9 @@ import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RotateDrawable;
import android.media.AudioManager;
import android.media.AudioSystem;
+import android.media.session.MediaController;
+import android.media.session.MediaSessionManager;
+import android.media.session.PlaybackState;
import android.os.Debug;
import android.os.Handler;
import android.os.Looper;
@@ -76,6 +82,7 @@ import android.provider.DeviceConfig;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.text.InputFilter;
+import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.util.Slog;
@@ -126,6 +133,7 @@ import com.android.systemui.plugins.VolumeDialog;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.plugins.VolumeDialogController.State;
import com.android.systemui.plugins.VolumeDialogController.StreamState;
+import com.android.systemui.statusbar.phone.ExpandableIndicator;
import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -249,6 +257,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
private CaptionsToggleImageButton mODICaptionsIcon;
private View mSettingsView;
private ImageButton mSettingsIcon;
+ private View mExpandRowsView;
+ private ExpandableIndicator mExpandRows;
private FrameLayout mZenIcon;
private final List<VolumeRow> mRows = new ArrayList<>();
private ConfigurableTexts mConfigurableTexts;
@@ -293,6 +303,20 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
@VisibleForTesting
int mVolumeRingerMuteIconDrawableId;
+ // Variable to track the default row with which the panel is initially shown
+ private VolumeRow mDefaultRow = null;
+
+ private FrameLayout mRoundedBorderBottom;
+
+ // Volume panel placement left or right
+ private boolean mVolumePanelOnLeft;
+
+ // Volume panel expand state
+ private boolean mExpanded;
+
+ // Number of animating rows
+ private int mAnimatingRows = 0;
+
public VolumeDialogImpl(
Context context,
VolumeDialogController volumeDialogController,
@@ -331,6 +355,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mUseBackgroundBlur =
mContext.getResources().getBoolean(R.bool.config_volumeDialogUseBackgroundBlur);
mInteractionJankMonitor = interactionJankMonitor;
+ mVolumePanelOnLeft =
+ mContext.getResources().getBoolean(R.bool.config_audioPanelOnLeftSide);
dumpManager.registerDumpable("VolumeDialogImpl", this);
@@ -466,25 +492,56 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
final int[] locInWindow = new int[2];
view.getLocationInWindow(locInWindow);
- float x = locInWindow[0];
- float y = locInWindow[1];
+ float xExtraSize = 0;
+ float yExtraSize = 0;
// The ringer and rows container has extra height at the top to fit the expanded ringer
// drawer. This area should not be touchable unless the ringer drawer is open.
- if (view == mTopContainer && !mIsRingerDrawerOpen) {
+ // In landscape the ringer expands to the left and it has to be ensured that if there
+ // are multiple rows they are touchable.
+ // The invisible expandable rows reserve space if the panel is not expanded, this space
+ // needs to be touchable.
+ if (view == mTopContainer) {
if (!isLandscape()) {
- y += getRingerDrawerOpenExtraSize();
+ if (!mIsRingerDrawerOpen) {
+ yExtraSize = getRingerDrawerOpenExtraSize();
+ }
+ if (!mExpanded) {
+ xExtraSize = getExpandableRowsExtraSize();
+ }
} else {
- x += getRingerDrawerOpenExtraSize();
+ if (!mIsRingerDrawerOpen && !mExpanded) {
+ xExtraSize =
+ Math.max(getRingerDrawerOpenExtraSize(), getExpandableRowsExtraSize());
+ } else if (!mIsRingerDrawerOpen) {
+ if (getRingerDrawerOpenExtraSize() > getVisibleRowsExtraSize()) {
+ xExtraSize = getRingerDrawerOpenExtraSize() - getVisibleRowsExtraSize();
+ }
+ } else if (!mExpanded) {
+ if ((getVisibleRowsExtraSize() + getExpandableRowsExtraSize())
+ > getRingerDrawerOpenExtraSize()) {
+ xExtraSize = (getVisibleRowsExtraSize() + getExpandableRowsExtraSize())
+ - getRingerDrawerOpenExtraSize();
+ }
+ }
}
}
- mTouchableRegion.op(
- (int) x,
- (int) y,
- locInWindow[0] + view.getWidth(),
- locInWindow[1] + view.getHeight(),
- Region.Op.UNION);
+ if (mVolumePanelOnLeft) {
+ mTouchableRegion.op(
+ locInWindow[0],
+ locInWindow[1] + (int) yExtraSize,
+ locInWindow[0] + view.getWidth() - (int) xExtraSize,
+ locInWindow[1] + view.getHeight(),
+ Region.Op.UNION);
+ } else {
+ mTouchableRegion.op(
+ locInWindow[0] + (int) xExtraSize,
+ locInWindow[1] + (int) yExtraSize,
+ locInWindow[0] + view.getWidth(),
+ locInWindow[1] + view.getHeight(),
+ Region.Op.UNION);
+ }
}
private void initDialog(int lockTaskModeState) {
@@ -495,6 +552,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mConfigurableTexts = new ConfigurableTexts(mContext);
mHovering = false;
mShowing = false;
+ mExpanded = false;
mWindow = mDialog.getWindow();
mWindow.requestFeature(Window.FEATURE_NO_TITLE);
mWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
@@ -513,17 +571,24 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
lp.setTitle(VolumeDialogImpl.class.getSimpleName());
lp.windowAnimations = -1;
lp.gravity = mContext.getResources().getInteger(R.integer.volume_dialog_gravity);
+ if (!mShowActiveStreamOnly) {
+ lp.gravity &= ~(Gravity.LEFT | Gravity.RIGHT);
+ lp.gravity |= mVolumePanelOnLeft ? Gravity.LEFT : Gravity.RIGHT;
+ }
mWindow.setAttributes(lp);
mWindow.setLayout(WRAP_CONTENT, WRAP_CONTENT);
mDialog.setContentView(R.layout.volume_dialog);
mDialogView = mDialog.findViewById(R.id.volume_dialog);
mDialogView.setAlpha(0);
+ mDialogView.setLayoutDirection(
+ mVolumePanelOnLeft ? LAYOUT_DIRECTION_LTR : LAYOUT_DIRECTION_RTL);
mDialog.setCanceledOnTouchOutside(true);
mDialog.setOnShowListener(dialog -> {
mDialogView.getViewTreeObserver().addOnComputeInternalInsetsListener(this);
if (!shouldSlideInVolumeTray()) {
- mDialogView.setTranslationX(mDialogView.getWidth() / 2.0f);
+ mDialogView.setTranslationX(
+ getTranslationForPanelLocation() * mDialogView.getWidth() / 2.0f);
}
mDialogView.setAlpha(0);
mDialogView.animate()
@@ -619,6 +684,9 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
updateBackgroundForDrawerClosedAmount();
setTopContainerBackgroundDrawable();
+
+ // Rows need to be updated after mRingerAndDrawerContainerBackground is set
+ updateRowsH(getActiveRow());
}
});
}
@@ -658,6 +726,41 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mSettingsView = mDialog.findViewById(R.id.settings_container);
mSettingsIcon = mDialog.findViewById(R.id.settings);
+ mRoundedBorderBottom = mDialog.findViewById(R.id.rounded_border_bottom);
+
+ mExpandRowsView = mDialog.findViewById(R.id.expandable_indicator_container);
+ mExpandRows = mDialog.findViewById(R.id.expandable_indicator);
+
+ if (mVolumePanelOnLeft) {
+ if (mRingerAndDrawerContainer != null) {
+ mRingerAndDrawerContainer.setLayoutDirection(LAYOUT_DIRECTION_RTL);
+ }
+
+ ViewGroup container = mDialog.findViewById(R.id.volume_dialog_container);
+ setGravity(container, Gravity.LEFT);
+ setLayoutGravity(container, Gravity.LEFT);
+
+ setGravity(mDialogView, Gravity.LEFT);
+ setLayoutGravity(mDialogView, Gravity.LEFT);
+
+ setGravity((ViewGroup) mTopContainer, Gravity.LEFT);
+
+ setLayoutGravity(mSelectedRingerContainer, Gravity.BOTTOM | Gravity.LEFT);
+
+ setLayoutGravity(mRingerDrawerNewSelectionBg, Gravity.BOTTOM | Gravity.LEFT);
+
+ setGravity(mRinger, Gravity.LEFT);
+ setLayoutGravity(mRinger, Gravity.BOTTOM | Gravity.LEFT);
+
+ setGravity(mDialogRowsViewContainer, Gravity.LEFT);
+ setLayoutGravity(mDialogRowsViewContainer, Gravity.LEFT);
+
+ setGravity(mODICaptionsView, Gravity.LEFT);
+ setLayoutGravity(mODICaptionsView, Gravity.LEFT);
+
+ mExpandRows.setRotation(-90);
+ }
+
if (mRows.isEmpty()) {
if (!AudioSystem.isSingleVolume(mContext)) {
addRow(STREAM_ACCESSIBILITY, R.drawable.ic_volume_accessibility,
@@ -709,6 +812,25 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mRingerCount = mShowVibrate ? 3 : 2;
}
+ // Helper to set gravity.
+ private void setGravity(ViewGroup viewGroup, int gravity) {
+ if (viewGroup instanceof LinearLayout) {
+ ((LinearLayout) viewGroup).setGravity(gravity);
+ }
+ }
+
+ // Helper to set layout gravity.
+ private void setLayoutGravity(ViewGroup viewGroup, int gravity) {
+ if (viewGroup != null) {
+ Object obj = viewGroup.getLayoutParams();
+ if (obj instanceof FrameLayout.LayoutParams) {
+ ((FrameLayout.LayoutParams) obj).gravity = gravity;
+ } else if (obj instanceof LinearLayout.LayoutParams) {
+ ((LinearLayout.LayoutParams) obj).gravity = gravity;
+ }
+ }
+ }
+
protected ViewGroup getDialogView() {
return mDialogView;
}
@@ -730,8 +852,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
}
private boolean isRtl() {
- return mContext.getResources().getConfiguration().getLayoutDirection()
- == LAYOUT_DIRECTION_RTL;
+ return mDialogView.getLayoutDirection() == LAYOUT_DIRECTION_RTL;
}
public void setStreamImportant(int stream, boolean important) {
@@ -922,6 +1043,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mDialogView.getPaddingTop(),
mDialogView.getPaddingRight(),
mDialogView.getPaddingBottom() + getRingerDrawerOpenExtraSize());
+ } else if (mVolumePanelOnLeft) {
+ mDialogView.setPadding(
+ mDialogView.getPaddingLeft(),
+ mDialogView.getPaddingTop(),
+ mDialogView.getPaddingRight() + getRingerDrawerOpenExtraSize(),
+ mDialogView.getPaddingBottom());
} else {
mDialogView.setPadding(
mDialogView.getPaddingLeft() + getRingerDrawerOpenExtraSize(),
@@ -991,15 +1118,22 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
}
/**
- * Translation to apply form the origin (either top or left) to overlap the selection background
- * with the given mode in the drawer.
+ * Translation to apply form the origin (either top or left/right) to overlap the selection
+ * background with the given mode in the drawer.
*/
private float getTranslationInDrawerForRingerMode(int mode) {
- return mode == RINGER_MODE_VIBRATE
+ return (mode == RINGER_MODE_VIBRATE
? -mRingerDrawerItemSize * 2
: mode == RINGER_MODE_SILENT
? -mRingerDrawerItemSize
- : 0;
+ : 0)
+ * (isLandscape()
+ ? getTranslationForPanelLocation()
+ : 1);
+ }
+
+ private float getTranslationForPanelLocation() {
+ return mVolumePanelOnLeft ? -1 : 1;
}
/** Animates in the ringer drawer. */
@@ -1030,12 +1164,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
getTranslationInDrawerForRingerMode(mState.ringerModeInternal));
}
- // Move the drawer so that the top/rightmost ringer choice overlaps with the selected ringer
+ // Move the drawer so that the top/outmost ringer choice overlaps with the selected ringer
// icon.
if (!isLandscape()) {
mRingerDrawerContainer.setTranslationY(mRingerDrawerItemSize * (mRingerCount - 1));
} else {
- mRingerDrawerContainer.setTranslationX(mRingerDrawerItemSize * (mRingerCount - 1));
+ mRingerDrawerContainer.setTranslationX(
+ getTranslationForPanelLocation() * mRingerDrawerItemSize * (mRingerCount - 1));
}
mRingerDrawerContainer.setAlpha(0f);
mRingerDrawerContainer.setVisibility(VISIBLE);
@@ -1117,7 +1252,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
.start();
} else {
mRingerDrawerContainer.animate()
- .translationX(mRingerDrawerItemSize * 2)
+ .translationX(getTranslationForPanelLocation() * mRingerDrawerItemSize * 2)
.start();
}
@@ -1138,24 +1273,108 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mIsRingerDrawerOpen = false;
}
+ /**
+ * Returns a {@link MediaController} that state is playing and type is local playback,
+ * and also have active sessions.
+ */
+ @Nullable
+ private MediaController getActiveLocalMediaController() {
+ MediaSessionManager mediaSessionManager =
+ mContext.getSystemService(MediaSessionManager.class);
+ MediaController localController = null;
+ final List<String> remoteMediaSessionLists = new ArrayList<>();
+ for (MediaController controller : mediaSessionManager.getActiveSessions(null)) {
+ final MediaController.PlaybackInfo pi = controller.getPlaybackInfo();
+ if (pi == null) {
+ // do nothing
+ continue;
+ }
+ final PlaybackState playbackState = controller.getPlaybackState();
+ if (playbackState == null) {
+ // do nothing
+ continue;
+ }
+ if (D.BUG) {
+ Log.d(TAG, "getActiveLocalMediaController() package name : "
+ + controller.getPackageName()
+ + ", play back type : " + pi.getPlaybackType()
+ + ", play back state : " + playbackState.getState());
+ }
+ if (playbackState.getState() != PlaybackState.STATE_PLAYING) {
+ // do nothing
+ continue;
+ }
+ if (pi.getPlaybackType() == MediaController.PlaybackInfo.PLAYBACK_TYPE_REMOTE) {
+ if (localController != null
+ && TextUtils.equals(
+ localController.getPackageName(), controller.getPackageName())) {
+ localController = null;
+ }
+ if (!remoteMediaSessionLists.contains(controller.getPackageName())) {
+ remoteMediaSessionLists.add(controller.getPackageName());
+ }
+ continue;
+ }
+ if (pi.getPlaybackType() == MediaController.PlaybackInfo.PLAYBACK_TYPE_LOCAL) {
+ if (localController == null
+ && !remoteMediaSessionLists.contains(controller.getPackageName())) {
+ localController = controller;
+ }
+ }
+ }
+ return localController;
+ }
+
+ private boolean isBluetoothA2dpConnected() {
+ final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ return mBluetoothAdapter != null && mBluetoothAdapter.isEnabled() &&
+ mBluetoothAdapter.getProfileConnectionState(BluetoothProfile.A2DP)
+ == BluetoothProfile.STATE_CONNECTED;
+ }
+
+ private boolean isMediaControllerAvailable() {
+ final MediaController mediaController = getActiveLocalMediaController();
+ return mediaController != null &&
+ !TextUtils.isEmpty(mediaController.getPackageName());
+ }
+
private void initSettingsH(int lockTaskModeState) {
+ if (mRoundedBorderBottom != null) {
+ mRoundedBorderBottom.setVisibility(!mDeviceProvisionedController.isCurrentUserSetup() ||
+ mActivityManager.getLockTaskModeState() != LOCK_TASK_MODE_NONE
+ ? VISIBLE : GONE);
+ }
if (mSettingsView != null) {
mSettingsView.setVisibility(
mDeviceProvisionedController.isCurrentUserSetup() &&
+ (isMediaControllerAvailable() || isBluetoothA2dpConnected()) &&
lockTaskModeState == LOCK_TASK_MODE_NONE ? VISIBLE : GONE);
}
if (mSettingsIcon != null) {
mSettingsIcon.setOnClickListener(v -> {
Events.writeEvent(Events.EVENT_SETTINGS_CLICK);
- dismissH(DISMISS_REASON_SETTINGS_CLICKED);
- mMediaOutputDialogFactory.dismiss();
if (FeatureFlagUtils.isEnabled(mContext,
FeatureFlagUtils.SETTINGS_VOLUME_PANEL_IN_SYSTEMUI)) {
mVolumePanelFactory.create(true /* aboveStatusBar */, null);
} else {
- mActivityStarter.startActivity(new Intent(Settings.Panel.ACTION_VOLUME),
- true /* dismissShade */);
+ String packageName = isMediaControllerAvailable()
+ ? getActiveLocalMediaController().getPackageName() : "";
+ mMediaOutputDialogFactory.create(packageName, true, mDialogView);
}
+ dismissH(DISMISS_REASON_SETTINGS_CLICKED);
+ });
+ }
+
+ if (mExpandRowsView != null) {
+ mExpandRowsView.setVisibility(
+ mDeviceProvisionedController.isCurrentUserSetup() &&
+ lockTaskModeState == LOCK_TASK_MODE_NONE ? VISIBLE : GONE);
+ }
+ if (mExpandRows != null) {
+ mExpandRows.setOnClickListener(v -> {
+ mExpanded = !mExpanded;
+ updateRowsH(mDefaultRow, true);
+ mExpandRows.setExpanded(mExpanded);
});
}
}
@@ -1421,6 +1640,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mConfigChanged = false;
}
+ if (mDefaultRow == null) {
+ mDefaultRow = getActiveRow();
+ }
+
initSettingsH(lockTaskModeState);
mShowing = true;
mIsAnimatingDismiss = false;
@@ -1465,6 +1688,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
protected void dismissH(int reason) {
Trace.beginSection("VolumeDialogImpl#dismissH");
+ // Avoid multiple animation calls on touch spams.
+ if (!mShowing) {
+ return;
+ }
Log.i(TAG, "mDialog.dismiss() reason: " + Events.DISMISS_REASONS[reason]
+ " from: " + Debug.getCaller());
@@ -1493,13 +1720,22 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mController.notifyVisible(false);
mDialog.dismiss();
tryToRemoveCaptionsTooltip();
+ mExpanded = false;
+ if (mExpandRows != null) {
+ mExpandRows.setExpanded(mExpanded);
+ }
+ mAnimatingRows = 0;
+ mDefaultRow = null;
mIsAnimatingDismiss = false;
hideRingerDrawer();
+ mController.notifyVisible(false);
}, 50));
- if (!shouldSlideInVolumeTray()) animator.translationX(mDialogView.getWidth() / 2.0f);
- animator.setListener(getJankListener(getDialogView(), TYPE_DISMISS,
- mDialogHideAnimationDurationMs)).start();
+ if (!shouldSlideInVolumeTray()) {
+ animator.translationX(getTranslationForPanelLocation() * mDialogView.getWidth() / 2.0f);
+ animator.setListener(getJankListener(getDialogView(), TYPE_DISMISS,
+ mDialogHideAnimationDurationMs)).start();
+ }
checkODICaptionsTooltip(true);
synchronized (mSafetyWarningLock) {
if (mSafetyWarning != null) {
@@ -1515,6 +1751,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|| mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION);
}
+ private boolean isExpandableRowH(VolumeRow row) {
+ return row != null && row != mDefaultRow && !row.defaultStream
+ && (row.stream == STREAM_RING
+ || row.stream == STREAM_ALARM
+ || row.stream == STREAM_MUSIC);
+ }
+
private boolean shouldBeVisibleH(VolumeRow row, VolumeRow activeRow) {
boolean isActive = row.stream == activeRow.stream;
@@ -1534,10 +1777,17 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
return true;
}
- if (row.defaultStream) {
+ if (mExpanded && isExpandableRowH(row)) {
+ return true;
+ }
+
+ // if the row is the default stream or the row with which this panel was created,
+ // show it additonally to the active row if it is one of the following streams
+ if (row.defaultStream || mDefaultRow == row) {
return activeRow.stream == STREAM_RING
|| activeRow.stream == STREAM_ALARM
|| activeRow.stream == STREAM_VOICE_CALL
+ || activeRow.stream == STREAM_MUSIC
|| activeRow.stream == STREAM_ACCESSIBILITY
|| mDynamic.get(activeRow.stream);
}
@@ -1548,29 +1798,39 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
private void updateRowsH(final VolumeRow activeRow) {
Trace.beginSection("VolumeDialogImpl#updateRowsH");
+ updateRowsH(activeRow, false);
+ }
+
+ private void updateRowsH(final VolumeRow activeRow, boolean animate) {
if (D.BUG) Log.d(TAG, "updateRowsH");
if (!mShowing) {
trimObsoleteH();
}
+ boolean isOutmostIndexMax = mVolumePanelOnLeft ? isRtl() : !isRtl();
+
// Index of the last row that is actually visible.
- int rightmostVisibleRowIndex = !isRtl() ? -1 : Short.MAX_VALUE;
+ int outmostVisibleRowIndex = isOutmostIndexMax ? -1 : Short.MAX_VALUE;
// apply changes to all rows
for (final VolumeRow row : mRows) {
final boolean isActive = row == activeRow;
+ final boolean isExpandableRow = isExpandableRowH(row);
final boolean shouldBeVisible = shouldBeVisibleH(row, activeRow);
- Util.setVisOrGone(row.view, shouldBeVisible);
- if (shouldBeVisible && mRingerAndDrawerContainerBackground != null) {
- // For RTL, the rightmost row has the lowest index since child views are laid out
+ if (!isExpandableRow) {
+ Util.setVisOrGone(row.view, shouldBeVisible);
+ } else if (!mExpanded) {
+ row.view.setVisibility(View.INVISIBLE);
+ }
+
+ if ((shouldBeVisible || isExpandableRow)
+ && mRingerAndDrawerContainerBackground != null) {
+ // For RTL, the outmost row has the lowest index since child views are laid out
// from right to left.
- rightmostVisibleRowIndex =
- !isRtl()
- ? Math.max(rightmostVisibleRowIndex,
- mDialogRowsView.indexOfChild(row.view))
- : Math.min(rightmostVisibleRowIndex,
- mDialogRowsView.indexOfChild(row.view));
+ outmostVisibleRowIndex = isOutmostIndexMax
+ ? Math.max(outmostVisibleRowIndex, mDialogRowsView.indexOfChild(row.view))
+ : Math.min(outmostVisibleRowIndex, mDialogRowsView.indexOfChild(row.view));
// Add spacing between each of the visible rows - we'll remove the spacing from the
// last row after the loop.
@@ -1578,12 +1838,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
if (layoutParams instanceof LinearLayout.LayoutParams) {
final LinearLayout.LayoutParams linearLayoutParams =
((LinearLayout.LayoutParams) layoutParams);
- if (!isRtl()) {
+ if (isOutmostIndexMax) {
linearLayoutParams.setMarginEnd(mRingerRowsPadding);
} else {
linearLayoutParams.setMarginStart(mRingerRowsPadding);
}
}
+ row.view.setLayoutParams(layoutParams);
// Set the background on each of the rows. We'll remove this from the last row after
// the loop, since the last row's background is drawn by the main volume container.
@@ -1591,13 +1852,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mContext.getDrawable(R.drawable.volume_row_rounded_background));
}
- if (row.view.isShown()) {
+ if (row.view.isShown() || isExpandableRow) {
updateVolumeRowTintH(row, isActive);
}
}
- if (rightmostVisibleRowIndex > -1 && rightmostVisibleRowIndex < Short.MAX_VALUE) {
- final View lastVisibleChild = mDialogRowsView.getChildAt(rightmostVisibleRowIndex);
+ if (outmostVisibleRowIndex > -1 && outmostVisibleRowIndex < Short.MAX_VALUE) {
+ final View lastVisibleChild = mDialogRowsView.getChildAt(outmostVisibleRowIndex);
final ViewGroup.LayoutParams layoutParams = lastVisibleChild.getLayoutParams();
// Remove the spacing on the last row, and remove its background since the container is
// drawing a background for this row.
@@ -1606,8 +1867,106 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
((LinearLayout.LayoutParams) layoutParams);
linearLayoutParams.setMarginStart(0);
linearLayoutParams.setMarginEnd(0);
+ lastVisibleChild.setLayoutParams(linearLayoutParams);
lastVisibleChild.setBackgroundColor(Color.TRANSPARENT);
}
+
+ int elevationCount = 0;
+ if (animate) {
+ // Increase the elevation of the outmost row so that other rows animate behind it.
+ lastVisibleChild.setElevation(1f / ++elevationCount);
+
+ // Add a solid background to the outmost row temporary so that other rows animate
+ // behind it
+ lastVisibleChild.setBackgroundDrawable(
+ mContext.getDrawable(R.drawable.volume_background));
+ }
+
+ int[] lastVisibleChildLocation = new int[2];
+ lastVisibleChild.getLocationInWindow(lastVisibleChildLocation);
+
+ // Track previous rows to calculate translations
+ int visibleRowsCount = 0;
+ int hiddenRowsCount = 0;
+ int rowWidth = mDialogWidth + mRingerRowsPadding;
+
+ for (final VolumeRow row : mRows) {
+ final boolean isExpandableRow = isExpandableRowH(row);
+ final boolean shouldBeVisible = shouldBeVisibleH(row, activeRow);
+
+ if (shouldBeVisible) {
+ visibleRowsCount++;
+ } else if (isExpandableRow) {
+ hiddenRowsCount++;
+ }
+
+ // Only move rows that are either expandable or visible and not the default stream
+ if ((!isExpandableRow && !shouldBeVisible) || row.defaultStream) {
+ continue;
+ }
+
+ // Cancel any ongoing animations
+ row.view.animate().cancel();
+
+ // Expandable rows need to animate behind the last visible row, an additional
+ // always visible stream animates next to the default stream
+ float translationX = getTranslationForPanelLocation() * hiddenRowsCount * rowWidth;
+
+ if (animate) {
+ // If the translation is not set and the panel is expanding start the
+ // animation behind the main row
+ if (isExpandableRow && mExpanded && row.view.getTranslationX() == 0f) {
+ row.view.setTranslationX(
+ getTranslationForPanelLocation() * visibleRowsCount * rowWidth);
+ }
+
+ // The elevation should decrease from the outmost row to the inner rows, so that
+ // every row animates behind the outer rows
+ row.view.setElevation(1f / ++elevationCount);
+
+ row.view.setVisibility(View.VISIBLE);
+
+ // Track how many rows are animating to avoid running animation end actions
+ // if there is still a row animating
+ mAnimatingRows++;
+ row.view.animate()
+ .translationX(translationX)
+ .setDuration(mExpanded ? mDialogShowAnimationDurationMs
+ : mDialogHideAnimationDurationMs)
+ .setInterpolator(mExpanded
+ ? new SystemUIInterpolators.LogDecelerateInterpolator()
+ : new SystemUIInterpolators.LogAccelerateInterpolator())
+ .setListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ mAnimatingRows--;
+ animation.removeAllListeners();
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ row.view.setElevation(0);
+ if (!shouldBeVisible) {
+ row.view.setVisibility(View.INVISIBLE);
+ }
+ mAnimatingRows--;
+ if (mAnimatingRows == 0) {
+ // Restore the elevation and background
+ lastVisibleChild.setElevation(0);
+ lastVisibleChild.setBackgroundColor(Color.TRANSPARENT);
+ // Set the active stream to ensure the volume keys change
+ // the volume of the tinted row. The tint was set before
+ // already, but setting the active row cancels ongoing
+ // animations.
+ mController.setActiveStream(activeRow.stream);
+ }
+ }
+ });
+ } else {
+ row.view.setTranslationX(translationX);
+ row.view.setVisibility(shouldBeVisible ? View.VISIBLE : View.INVISIBLE);
+ }
+ }
}
updateBackgroundForDrawerClosedAmount();
@@ -1730,7 +2089,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
protected void onStateChangedH(State state) {
if (D.BUG) Log.d(TAG, "onStateChangedH() state: " + state.toString());
- if (mState != null && state != null
+ if (mShowing && mState != null && state != null
&& mState.ringerModeInternal != -1
&& mState.ringerModeInternal != state.ringerModeInternal
&& state.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE) {
@@ -2087,6 +2446,36 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
return (mRingerCount - 1) * mRingerDrawerItemSize;
}
+ /**
+ * Return the size of the additionally visible rows next to the default stream.
+ * An additional row is visible for example while receiving a voice call.
+ */
+ private int getVisibleRowsExtraSize() {
+ VolumeRow activeRow = getActiveRow();
+ int visibleRows = 0;
+ for (final VolumeRow row : mRows) {
+ if (shouldBeVisibleH(row, activeRow)) {
+ visibleRows++;
+ }
+ }
+ return (visibleRows - 1) * (mDialogWidth + mRingerRowsPadding);
+ }
+
+ /**
+ * Return the size of invisible rows.
+ * Expandable rows are invisible while the panel is not expanded.
+ */
+ private int getExpandableRowsExtraSize() {
+ VolumeRow activeRow = getActiveRow();
+ int expandableRows = 0;
+ for (final VolumeRow row : mRows) {
+ if (isExpandableRowH(row)) {
+ expandableRows++;
+ }
+ }
+ return expandableRows * (mDialogWidth + mRingerRowsPadding);
+ }
+
private void updateBackgroundForDrawerClosedAmount() {
if (mRingerAndDrawerContainerBackground == null) {
return;
@@ -2095,6 +2484,9 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
final Rect bounds = mRingerAndDrawerContainerBackground.copyBounds();
if (!isLandscape()) {
bounds.top = (int) (mRingerDrawerClosedAmount * getRingerDrawerOpenExtraSize());
+ } else if (mVolumePanelOnLeft) {
+ bounds.right = (int) ((mDialogCornerRadius / 2) + mRingerDrawerItemSize
+ + (1f - mRingerDrawerClosedAmount) * getRingerDrawerOpenExtraSize());
} else {
bounds.left = (int) (mRingerDrawerClosedAmount * getRingerDrawerOpenExtraSize());
}
@@ -2102,7 +2494,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
}
/*
- * The top container is responsible for drawing the solid color background behind the rightmost
+ * The top container is responsible for drawing the solid color background behind the outmost
* (primary) volume row. This is because the volume drawer animates in from below, initially
* overlapping the primary row. We need the drawer to draw below the row's SeekBar, since it
* looks strange to overlap it, but above the row's background color, since otherwise it will be
@@ -2136,8 +2528,9 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
? mDialogRowsViewContainer.getTop()
: mDialogRowsViewContainer.getTop() - mDialogCornerRadius);
- // Set gravity to top-right, since additional rows will be added on the left.
- background.setLayerGravity(0, Gravity.TOP | Gravity.RIGHT);
+ // Set gravity to top and opposite side where additional rows will be added.
+ background.setLayerGravity(
+ 0, mVolumePanelOnLeft ? Gravity.TOP | Gravity.LEFT : Gravity.TOP | Gravity.RIGHT);
// In landscape, the ringer drawer animates out to the left (instead of down). Since the
// drawer comes from the right (beyond the bounds of the dialog), we should clip it so it
@@ -2293,9 +2686,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
if (mShowing) {
- if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
- dismissH(Events.DISMISS_REASON_TOUCH_OUTSIDE);
- return true;
+ switch(event.getAction()){
+ case MotionEvent.ACTION_OUTSIDE:
+ case MotionEvent.ACTION_DOWN:
+ // Touches inside won't trigger onTouchEvent
+ dismissH(Events.DISMISS_REASON_TOUCH_OUTSIDE);
+ return false;
}
}
return false;
diff --git a/packages/overlays/Android.mk b/packages/overlays/Android.mk
index 69641e69a9f2..4b0ae0abc66c 100644
--- a/packages/overlays/Android.mk
+++ b/packages/overlays/Android.mk
@@ -25,7 +25,6 @@ LOCAL_REQUIRED_MODULES := \
DisplayCutoutEmulationHoleOverlay \
DisplayCutoutEmulationTallOverlay \
DisplayCutoutEmulationWaterfallOverlay \
- FontNotoSerifSourceOverlay \
NavigationBarMode3ButtonOverlay \
NavigationBarModeGesturalOverlay \
NavigationBarModeGesturalOverlayNarrowBack \
diff --git a/proto/src/metrics_constants/metrics_constants.proto b/proto/src/metrics_constants/metrics_constants.proto
index 3801c2473c11..49f37db67e41 100644
--- a/proto/src/metrics_constants/metrics_constants.proto
+++ b/proto/src/metrics_constants/metrics_constants.proto
@@ -7437,5 +7437,8 @@ message MetricsEvent {
// ---- End Q Constants, all Q constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS
+
+ // ICE Metrics
+ ICE = 2772;
}
}
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 987cb2a755be..34745270650c 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -177,8 +177,6 @@ java_library_static {
"overlayable_policy_aidl-java",
"SurfaceFlingerProperties",
"com.android.sysprop.watchdog",
- "vendor.qti.hardware.servicetracker-V1.0-java",
- "vendor.qti.hardware.servicetracker-V1.2-java",
],
javac_shard_size: 50,
}
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index e282679d8695..771281b7365c 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -165,6 +165,9 @@ public final class BatteryService extends SystemService {
private boolean mBatteryLevelLow;
+ private boolean mOemFastCharger;
+ private boolean mLastOemFastCharger;
+
private long mDischargeStartTime;
private int mDischargeStartLevel;
@@ -491,6 +494,8 @@ public final class BatteryService extends SystemService {
shutdownIfNoPowerLocked();
shutdownIfOverTempLocked();
+ mOemFastCharger = isOemFastCharger();
+
if (force
|| (mHealthInfo.batteryStatus != mLastBatteryStatus
|| mHealthInfo.batteryHealth != mLastBatteryHealth
@@ -502,7 +507,8 @@ public final class BatteryService extends SystemService {
|| mHealthInfo.maxChargingCurrentMicroamps != mLastMaxChargingCurrent
|| mHealthInfo.maxChargingVoltageMicrovolts != mLastMaxChargingVoltage
|| mHealthInfo.batteryChargeCounterUah != mLastChargeCounter
- || mInvalidCharger != mLastInvalidCharger)) {
+ || mInvalidCharger != mLastInvalidCharger
+ || mOemFastCharger != mLastOemFastCharger)) {
if (mPlugType != mLastPlugType) {
if (mLastPlugType == BATTERY_PLUGGED_NONE) {
@@ -676,6 +682,7 @@ public final class BatteryService extends SystemService {
mLastChargeCounter = mHealthInfo.batteryChargeCounterUah;
mLastBatteryLevelCritical = mBatteryLevelCritical;
mLastInvalidCharger = mInvalidCharger;
+ mLastOemFastCharger = mOemFastCharger;
}
}
@@ -707,9 +714,11 @@ public final class BatteryService extends SystemService {
BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE,
mHealthInfo.maxChargingVoltageMicrovolts);
intent.putExtra(BatteryManager.EXTRA_CHARGE_COUNTER, mHealthInfo.batteryChargeCounterUah);
+ intent.putExtra(BatteryManager.EXTRA_OEM_FAST_CHARGER, mOemFastCharger);
if (DEBUG) {
Slog.d(TAG, "Sending ACTION_BATTERY_CHANGED. scale:" + BATTERY_SCALE
- + ", info:" + mHealthInfo.toString());
+ + ", info:" + mHealthInfo.toString()
+ + ", mOemFastCharger:" + mOemFastCharger);
}
mHandler.post(() -> ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL));
@@ -761,6 +770,25 @@ public final class BatteryService extends SystemService {
mLastBatteryLevelChangedSentMs = SystemClock.elapsedRealtime();
}
+ private boolean isOemFastCharger() {
+ final String path = mContext.getResources().getString(
+ com.android.internal.R.string.config_oemFastChargerStatusPath);
+
+ if (path.isEmpty())
+ return false;
+
+ final String value = mContext.getResources().getString(
+ com.android.internal.R.string.config_oemFastChargerStatusValue);
+
+ try {
+ return FileUtils.readTextFile(new File(path), value.length(), null).equals(value);
+ } catch (IOException e) {
+ Slog.e(TAG, "Failed to read oem fast charger status path: " + path);
+ }
+
+ return false;
+ }
+
// TODO: Current code doesn't work since "--unplugged" flag in BSS was purposefully removed.
private void logBatteryStatsLocked() {
IBinder batteryInfoService = ServiceManager.getService(BatteryStats.SERVICE_NAME);
diff --git a/services/core/java/com/android/server/ExtconUEventObserver.java b/services/core/java/com/android/server/ExtconUEventObserver.java
index 923db4f131e5..88fe49d07255 100644
--- a/services/core/java/com/android/server/ExtconUEventObserver.java
+++ b/services/core/java/com/android/server/ExtconUEventObserver.java
@@ -107,6 +107,7 @@ public abstract class ExtconUEventObserver extends UEventObserver {
public static final String EXTCON_MICROPHONE = "MICROPHONE";
public static final String EXTCON_HEADPHONE = "HEADPHONE";
+ public static final String EXTCON_DP = "DP";
public static final String EXTCON_HDMI = "HDMI";
public static final String EXTCON_MHL = "MHL";
public static final String EXTCON_DVI = "DVI";
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 7968ee78947f..e954e864a424 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -1619,6 +1619,8 @@ class StorageManagerService extends IStorageManager.Stub
// public API requirement of being in a stable location.
if (vol.disk.isAdoptable()) {
vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE_FOR_WRITE;
+ } else if (vol.disk.isSd()) {
+ vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE_FOR_WRITE;
}
vol.mountUserId = mCurrentUserId;
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java
index fcc1ef2a3882..5d46de335781 100644
--- a/services/core/java/com/android/server/UiModeManagerService.java
+++ b/services/core/java/com/android/server/UiModeManagerService.java
@@ -1916,7 +1916,10 @@ final class UiModeManagerService extends SystemService {
mComputedNightMode = false;
return;
}
- resetNightModeOverrideLocked();
+ if (mNightMode != MODE_NIGHT_AUTO || (mTwilightManager != null
+ && mTwilightManager.getLastTwilightState() != null)) {
+ resetNightModeOverrideLocked();
+ }
}
private boolean resetNightModeOverrideLocked() {
diff --git a/services/core/java/com/android/server/WiredAccessoryManager.java b/services/core/java/com/android/server/WiredAccessoryManager.java
index 5c76da59e96d..4a5dc4bc55f9 100644
--- a/services/core/java/com/android/server/WiredAccessoryManager.java
+++ b/services/core/java/com/android/server/WiredAccessoryManager.java
@@ -794,6 +794,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
mExtconInfos = ExtconInfo.getExtconInfoForTypes(new String[] {
ExtconInfo.EXTCON_HEADPHONE,
ExtconInfo.EXTCON_MICROPHONE,
+ ExtconInfo.EXTCON_DP,
ExtconInfo.EXTCON_HDMI,
ExtconInfo.EXTCON_LINE_OUT,
});
@@ -842,6 +843,9 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
if (extconInfo.hasCableType(ExtconInfo.EXTCON_HDMI)) {
updateBit(maskAndState, BIT_HDMI_AUDIO, status, ExtconInfo.EXTCON_HDMI);
}
+ if (extconInfo.hasCableType(ExtconInfo.EXTCON_DP)) {
+ updateBit(maskAndState, BIT_HDMI_AUDIO, status, ExtconInfo.EXTCON_DP);
+ }
if (extconInfo.hasCableType(ExtconInfo.EXTCON_LINE_OUT)) {
updateBit(maskAndState, BIT_LINEOUT, status, ExtconInfo.EXTCON_LINE_OUT);
}
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index ec678ff493af..6e9513e7c3ab 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -195,10 +195,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
-import vendor.qti.hardware.servicetracker.V1_0.IServicetracker;
-import vendor.qti.hardware.servicetracker.V1_0.ServiceData;
-import vendor.qti.hardware.servicetracker.V1_0.ClientData;
-
public final class ActiveServices {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActiveServices" : TAG_AM;
private static final String TAG_MU = TAG + POSTFIX_MU;
@@ -341,11 +337,6 @@ public final class ActiveServices {
/** Amount of time to allow a last ANR message to exist before freeing the memory. */
static final int LAST_ANR_LIFETIME_DURATION_MSECS = 2 * 60 * 60 * 1000; // Two hours
- private IServicetracker mServicetracker;
-
- private final boolean isLowRamDevice =
- SystemProperties.getBoolean("ro.config.low_ram", false);
-
String mLastAnrDump;
AppWidgetManagerInternal mAppWidgetManagerInternal;
@@ -616,24 +607,6 @@ public final class ActiveServices {
}
}
- private boolean getServicetrackerInstance() {
- if (mServicetracker == null ) {
- try {
- mServicetracker = IServicetracker.getService(false);
- } catch (java.util.NoSuchElementException e) {
- // Service doesn't exist or cannot be opened logged below
- } catch (RemoteException e) {
- if (DEBUG_SERVICE) Slog.e(TAG, "Failed to get servicetracker interface", e);
- return false;
- }
- if (mServicetracker == null) {
- if (DEBUG_SERVICE) Slog.w(TAG, "servicetracker HIDL not available");
- return false;
- }
- }
- return true;
- }
-
ServiceRecord getServiceByNameLocked(ComponentName name, int callingUser) {
// TODO: Deal with global services
if (DEBUG_MU)
@@ -2996,32 +2969,6 @@ public final class ActiveServices {
}
clist.add(c);
- if (!isLowRamDevice) {
- ServiceData sData = new ServiceData();
- sData.packageName = s.packageName;
- sData.processName = s.shortInstanceName;
- sData.lastActivity = s.lastActivity;
- if (s.app != null) {
- sData.pid = s.app.getPid();
- sData.serviceB = s.app.mState.isServiceB();
- } else {
- sData.pid = -1;
- sData.serviceB = false;
- }
-
- ClientData cData = new ClientData();
- cData.processName = callerApp.processName;
- cData.pid = callerApp.getPid();
- try {
- if (getServicetrackerInstance()) {
- mServicetracker.bindService(sData, cData);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send bind details to servicetracker HAL", e);
- mServicetracker = null;
- }
- }
-
boolean needOomAdj = false;
if ((flags&Context.BIND_AUTO_CREATE) != 0) {
s.lastActivity = SystemClock.uptimeMillis();
@@ -3234,31 +3181,6 @@ public final class ActiveServices {
try {
while (clist.size() > 0) {
ConnectionRecord r = clist.get(0);
- if (!isLowRamDevice) {
- ServiceData sData = new ServiceData();
- sData.packageName = r.binding.service.packageName;
- sData.processName = r.binding.service.shortInstanceName;
- sData.lastActivity = r.binding.service.lastActivity;
- if(r.binding.service.app != null) {
- sData.pid = r.binding.service.app.getPid();
- sData.serviceB = r.binding.service.app.mState.isServiceB();
- } else {
- sData.pid = -1;
- sData.serviceB = false;
- }
-
- ClientData cData = new ClientData();
- cData.processName = r.binding.client.processName;
- cData.pid = r.binding.client.getPid();
- try {
- if (getServicetrackerInstance()) {
- mServicetracker.unbindService(sData, cData);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send unbind details to servicetracker HAL", e);
- mServicetracker = null;
- }
- }
removeConnectionLocked(r, null, null, true);
if (clist.size() > 0 && clist.get(0) == r) {
// In case it didn't get removed above, do it now.
@@ -4546,24 +4468,6 @@ public final class ActiveServices {
app.mState.getReportedProcState());
r.postNotification();
created = true;
-
- if (!isLowRamDevice) {
- ServiceData sData = new ServiceData();
- sData.packageName = r.packageName;
- sData.processName = r.shortInstanceName;
- sData.pid = r.app.getPid();
- sData.lastActivity = r.lastActivity;
- sData.serviceB = r.app.mState.isServiceB();
-
- try {
- if (getServicetrackerInstance()) {
- mServicetracker.startService(sData);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send start details to servicetracker HAL", e);
- mServicetracker = null;
- }
- }
} catch (DeadObjectException e) {
Slog.w(TAG, "Application dead when creating service " + r);
mAm.appDiedLocked(app, "Died when creating service");
@@ -4763,27 +4667,7 @@ public final class ActiveServices {
private void bringDownServiceLocked(ServiceRecord r, boolean enqueueOomAdj) {
//Slog.i(TAG, "Bring down service:");
//r.dump(" ");
- if (!isLowRamDevice) {
- ServiceData sData = new ServiceData();
- sData.packageName = r.packageName;
- sData.processName = r.shortInstanceName;
- sData.lastActivity = r.lastActivity;
- if (r.app != null) {
- sData.pid = r.app.getPid();
- } else {
- sData.pid = -1;
- sData.serviceB = false;
- }
- try {
- if (getServicetrackerInstance()) {
- mServicetracker.destroyService(sData);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send destroy details to servicetracker HAL", e);
- mServicetracker = null;
- }
- }
// Report to all of the connections that the service is no longer
// available.
ArrayMap<IBinder, ArrayList<ConnectionRecord>> connections = r.getConnections();
@@ -5626,15 +5510,6 @@ public final class ActiveServices {
}
}
- try {
- if (!isLowRamDevice && getServicetrackerInstance()) {
- mServicetracker.killProcess(app.getPid());
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send kill process details to servicetracker HAL", e);
- mServicetracker = null;
- }
-
// Clean up any connections this application has to other services.
for (int i = psr.numberOfConnections() - 1; i >= 0; i--) {
ConnectionRecord r = psr.getConnectionAt(i);
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 44b186e1541f..9470a728389f 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -71,6 +71,7 @@ import android.content.pm.PackagePartitions;
import android.content.pm.UserInfo;
import android.os.BatteryStats;
import android.os.Binder;
+import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
@@ -761,7 +762,7 @@ class UserController implements Handler.Callback {
// purposefully block sending BOOT_COMPLETED until after all
// PRE_BOOT receivers are finished to avoid ANR'ing apps
final UserInfo info = getUserInfo(userId);
- if (!Objects.equals(info.lastLoggedInFingerprint, PackagePartitions.FINGERPRINT)
+ if (!Objects.equals(info.lastLoggedInFingerprint, Build.VERSION.INCREMENTAL)
|| SystemProperties.getBoolean("persist.pm.mock-upgrade", false)) {
// Suppress double notifications for managed profiles that
// were unlocked automatically as part of their parent user being
diff --git a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
index a6a3db11b729..e9b3e8577fd2 100644
--- a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
@@ -1720,9 +1720,17 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
mContext.getSystemService(Context.TELEPHONY_SERVICE);
int type = AGPS_SETID_TYPE_NONE;
String setId = null;
+ final Boolean isEmergency = mNIHandler.getInEmergency();
+
+ // Unless we are in an emergency, do not provide sensitive subscriber information
+ // to SUPL servers.
+ if (!isEmergency) {
+ mGnssNative.setAgpsSetId(type, "");
+ return;
+ }
int subId = SubscriptionManager.getDefaultDataSubscriptionId();
- if (mNIHandler.getInEmergency() && mNetworkConnectivityHandler.getActiveSubId() >= 0) {
+ if (isEmergency && mNetworkConnectivityHandler.getActiveSubId() >= 0) {
subId = mNetworkConnectivityHandler.getActiveSubId();
}
if (SubscriptionManager.isValidSubscriptionId(subId)) {
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index b10c51c67ce4..68c63dc170ed 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2317,7 +2317,6 @@ public class NotificationManagerService extends SystemService {
mAppOps,
new SysUiStatsEvent.BuilderFactory(),
mShowReviewPermissionsNotification);
- mPreferencesHelper.updateFixedImportance(mUm.getUsers());
mRankingHelper = new RankingHelper(getContext(),
mRankingHandler,
mPreferencesHelper,
@@ -2760,6 +2759,9 @@ public class NotificationManagerService extends SystemService {
maybeShowInitialReviewPermissionsNotification();
} else if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
mSnoozeHelper.scheduleRepostsForPersistedNotifications(System.currentTimeMillis());
+ } else if (phase == SystemService.PHASE_DEVICE_SPECIFIC_SERVICES_READY) {
+ mPreferencesHelper.updateFixedImportance(mUm.getUsers());
+ mPreferencesHelper.migrateNotificationPermissions(mUm.getUsers());
}
}
diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java
index 662db787ebe2..2013e2694205 100644
--- a/services/core/java/com/android/server/notification/PreferencesHelper.java
+++ b/services/core/java/com/android/server/notification/PreferencesHelper.java
@@ -237,7 +237,6 @@ public class PreferencesHelper implements RankingConfig {
Settings.Global.REVIEW_PERMISSIONS_NOTIFICATION_STATE,
NotificationManagerService.REVIEW_NOTIF_STATE_SHOULD_SHOW);
}
- ArrayList<PermissionHelper.PackagePermission> pkgPerms = new ArrayList<>();
synchronized (mPackagePreferences) {
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT) {
tag = parser.getName();
@@ -255,27 +254,18 @@ public class PreferencesHelper implements RankingConfig {
String name = parser.getAttributeValue(null, ATT_NAME);
if (!TextUtils.isEmpty(name)) {
restorePackage(parser, forRestore, userId, name, upgradeForBubbles,
- migrateToPermission, pkgPerms);
+ migrateToPermission);
}
}
}
}
}
- if (migrateToPermission) {
- for (PackagePermission p : pkgPerms) {
- try {
- mPermissionHelper.setNotificationPermission(p);
- } catch (Exception e) {
- Slog.e(TAG, "could not migrate setting for " + p.packageName, e);
- }
- }
- }
}
@GuardedBy("mPackagePreferences")
private void restorePackage(TypedXmlPullParser parser, boolean forRestore,
@UserIdInt int userId, String name, boolean upgradeForBubbles,
- boolean migrateToPermission, ArrayList<PermissionHelper.PackagePermission> pkgPerms) {
+ boolean migrateToPermission) {
try {
int uid = parser.getAttributeInt(null, ATT_UID, UNKNOWN_UID);
if (forRestore) {
@@ -382,14 +372,6 @@ public class PreferencesHelper implements RankingConfig {
if (migrateToPermission) {
r.importance = appImportance;
r.migrateToPm = true;
- if (r.uid != UNKNOWN_UID) {
- // Don't call into permission system until we have a valid uid
- PackagePermission pkgPerm = new PackagePermission(
- r.pkg, UserHandle.getUserId(r.uid),
- r.importance != IMPORTANCE_NONE,
- hasUserConfiguredSettings(r));
- pkgPerms.add(pkgPerm);
- }
}
} catch (Exception e) {
Slog.w(TAG, "Failed to restore pkg", e);
@@ -2680,6 +2662,31 @@ public class PreferencesHelper implements RankingConfig {
}
}
+ public void migrateNotificationPermissions(List<UserInfo> users) {
+ for (UserInfo user : users) {
+ List<PackageInfo> packages = mPm.getInstalledPackagesAsUser(
+ PackageManager.PackageInfoFlags.of(PackageManager.MATCH_ALL),
+ user.getUserHandle().getIdentifier());
+ for (PackageInfo pi : packages) {
+ synchronized (mPackagePreferences) {
+ PackagePreferences p = getOrCreatePackagePreferencesLocked(
+ pi.packageName, pi.applicationInfo.uid);
+ if (p.migrateToPm && p.uid != UNKNOWN_UID) {
+ try {
+ PackagePermission pkgPerm = new PackagePermission(
+ p.pkg, UserHandle.getUserId(p.uid),
+ p.importance != IMPORTANCE_NONE,
+ hasUserConfiguredSettings(p));
+ mPermissionHelper.setNotificationPermission(pkgPerm);
+ } catch (Exception e) {
+ Slog.e(TAG, "could not migrate setting for " + p.pkg, e);
+ }
+ }
+ }
+ }
+ }
+ }
+
private void updateConfig() {
mRankingHandler.requestSort();
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 8b15b2da3dfd..cc6b1258d480 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -862,6 +862,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
final PendingPackageBroadcasts mPendingBroadcasts;
+ ArrayList<ComponentName> mDisabledComponentsList;
+
static final int SEND_PENDING_BROADCAST = 1;
static final int INIT_COPY = 5;
static final int POST_INSTALL = 9;
@@ -1494,7 +1496,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
}
PackageManagerService m = new PackageManagerService(injector, onlyCore, factoryTest,
- PackagePartitions.FINGERPRINT, Build.IS_ENG, Build.IS_USERDEBUG,
+ Build.VERSION.INCREMENTAL, Build.IS_ENG, Build.IS_USERDEBUG,
Build.VERSION.SDK_INT, Build.VERSION.INCREMENTAL);
t.traceEnd(); // "create package manager"
@@ -1961,7 +1963,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
!buildFingerprint.equals(ver.fingerprint);
if (mIsUpgrade) {
PackageManagerServiceUtils.logCriticalInfo(Log.INFO, "Upgrading from "
- + ver.fingerprint + " to " + PackagePartitions.FINGERPRINT);
+ + ver.fingerprint + " to " + Build.VERSION.INCREMENTAL);
}
mInitAppsHelper = new InitAppsHelper(this, mApexManager, mInstallPackageHelper,
@@ -2075,8 +2077,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
// allow... it would be nice to have some better way to handle
// this situation.
if (mIsUpgrade) {
- Slog.i(TAG, "Build fingerprint changed from " + ver.fingerprint + " to "
- + PackagePartitions.FINGERPRINT
+ Slog.i(TAG, "Build incremental version changed from " + ver.fingerprint + " to "
+ + Build.VERSION.INCREMENTAL
+ "; regranting permissions for internal storage");
}
mPermissionManager.onStorageVolumeMounted(
@@ -2092,13 +2094,24 @@ public class PackageManagerService implements PackageSender, TestUtilityService
}
}
+ // Disable components marked for disabling at build-time
+ mDisabledComponentsList = new ArrayList<ComponentName>();
+ enableComponents(mContext.getResources().getStringArray(
+ com.android.internal.R.array.config_deviceDisabledComponents), false);
+ enableComponents(mContext.getResources().getStringArray(
+ com.android.internal.R.array.config_globallyDisabledComponents), false);
+
+ // Enable components marked for forced-enable at build-time
+ enableComponents(mContext.getResources().getStringArray(
+ com.android.internal.R.array.config_forceEnabledComponents), true);
+
// If this is first boot after an OTA, and a normal boot, then
// we need to clear code cache directories.
// Note that we do *not* clear the application profiles. These remain valid
// across OTAs and are used to drive profile verification (post OTA) and
// profile compilation (without waiting to collect a fresh set of profiles).
if (mIsUpgrade && !mOnlyCore) {
- Slog.i(TAG, "Build fingerprint changed; clearing code caches");
+ Slog.i(TAG, "Build incremental version changed; clearing code caches");
for (int i = 0; i < packageSettings.size(); i++) {
final PackageSetting ps = packageSettings.valueAt(i);
if (Objects.equals(StorageManager.UUID_PRIVATE_INTERNAL, ps.getVolumeUuid())) {
@@ -2109,7 +2122,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
| Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
}
}
- ver.fingerprint = PackagePartitions.FINGERPRINT;
+ ver.fingerprint = Build.VERSION.INCREMENTAL;
}
// Defer the app data fixup until we are done with app data clearing above.
@@ -2268,6 +2281,30 @@ public class PackageManagerService implements PackageSender, TestUtilityService
Slog.i(TAG, "Fix for b/169414761 is applied");
}
+ private void enableComponents(String[] components, boolean enable) {
+ // Disable or enable components marked at build-time
+ for (String name : components) {
+ ComponentName cn = ComponentName.unflattenFromString(name);
+ if (!enable) {
+ mDisabledComponentsList.add(cn);
+ }
+ Slog.v(TAG, "Changing enabled state of " + name + " to " + enable);
+ String className = cn.getClassName();
+ String packageName = cn.getPackageName();
+ AndroidPackage pkg = mPackages.get(packageName);
+ if (pkg == null || !AndroidPackageUtils.hasComponentClassName(pkg, className)) {
+ Slog.w(TAG, "Unable to change enabled state of " + name + " to " + enable);
+ continue;
+ }
+ PackageSetting pkgSetting = mSettings.getPackageLPr(packageName);
+ if (enable) {
+ pkgSetting.enableComponentLPw(className, UserHandle.USER_OWNER);
+ } else {
+ pkgSetting.disableComponentLPw(className, UserHandle.USER_OWNER);
+ }
+ }
+ }
+
@GuardedBy("mLock")
void updateInstantAppInstallerLocked(String modifiedPackage) {
// we're only interested in updating the installer application when 1) it's not
@@ -5637,6 +5674,12 @@ public class PackageManagerService implements PackageSender, TestUtilityService
public void setComponentEnabledSetting(ComponentName componentName,
int newState, int flags, int userId) {
if (!mUserManager.exists(userId)) return;
+ // Don't allow to enable components marked for disabling at build-time
+ if (mDisabledComponentsList.contains(componentName)) {
+ Slog.d(TAG, "Ignoring attempt to set enabled state of disabled component "
+ + componentName.flattenToString());
+ return;
+ }
setEnabledSettings(List.of(new PackageManager.ComponentEnabledSetting(componentName, newState, flags)),
userId, null /* callingPackage */);
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index cfd029346340..a9b624653b92 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -445,7 +445,7 @@ public final class Settings implements Watchable, Snappable {
public void forceCurrent() {
sdkVersion = Build.VERSION.SDK_INT;
databaseVersion = CURRENT_DATABASE_VERSION;
- fingerprint = PackagePartitions.FINGERPRINT;
+ fingerprint = Build.VERSION.INCREMENTAL;
}
}
@@ -5527,7 +5527,7 @@ public final class Settings implements Watchable, Snappable {
}
private String getExtendedFingerprint(long version) {
- return PackagePartitions.FINGERPRINT + "?pc_version=" + version;
+ return Build.VERSION.INCREMENTAL + "?pc_version=" + version;
}
private static long uniformRandom(double low, double high) {
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index a2b2983a8f35..4564e9dccc13 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -5168,7 +5168,7 @@ public class ShortcutService extends IShortcutService.Stub {
// Injection point.
String injectBuildFingerprint() {
- return Build.FINGERPRINT;
+ return Build.VERSION.INCREMENTAL;
}
final void wtf(String message) {
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 88aeb17dc2b4..af7b481dd311 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -4104,7 +4104,7 @@ public class UserManagerService extends IUserManager.Stub {
userInfo.creationTime = getCreationTime();
userInfo.partial = true;
userInfo.preCreated = preCreate;
- userInfo.lastLoggedInFingerprint = PackagePartitions.FINGERPRINT;
+ userInfo.lastLoggedInFingerprint = Build.VERSION.INCREMENTAL;
if (userTypeDetails.hasBadge() && parentId != UserHandle.USER_NULL) {
userInfo.profileBadge = getFreeProfileBadgeLU(parentId, userType);
}
@@ -5390,7 +5390,7 @@ public class UserManagerService extends IUserManager.Stub {
t.traceBegin("onBeforeStartUser-" + userId);
final int userSerial = userInfo.serialNumber;
// Migrate only if build fingerprints mismatch
- boolean migrateAppsData = !PackagePartitions.FINGERPRINT.equals(
+ boolean migrateAppsData = !Build.VERSION.INCREMENTAL.equals(
userInfo.lastLoggedInFingerprint);
t.traceBegin("prepareUserData");
mUserDataPreparer.prepareUserData(userId, userSerial, StorageManager.FLAG_STORAGE_DE);
@@ -5421,7 +5421,7 @@ public class UserManagerService extends IUserManager.Stub {
}
final int userSerial = userInfo.serialNumber;
// Migrate only if build fingerprints mismatch
- boolean migrateAppsData = !PackagePartitions.FINGERPRINT.equals(
+ boolean migrateAppsData = !Build.VERSION.INCREMENTAL.equals(
userInfo.lastLoggedInFingerprint);
final TimingsTraceAndSlog t = new TimingsTraceAndSlog();
@@ -5466,7 +5466,7 @@ public class UserManagerService extends IUserManager.Stub {
if (now > EPOCH_PLUS_30_YEARS) {
userData.info.lastLoggedInTime = now;
}
- userData.info.lastLoggedInFingerprint = PackagePartitions.FINGERPRINT;
+ userData.info.lastLoggedInFingerprint = Build.VERSION.INCREMENTAL;
scheduleWriteUser(userData);
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 6fbaaba3288f..7e52edb208bc 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -190,6 +190,7 @@ import com.android.internal.app.AssistUtils;
import com.android.internal.inputmethod.SoftInputShowHideReason;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
+import com.android.internal.os.DeviceKeyHandler;
import com.android.internal.os.RoSystemProperties;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.policy.IShortcutService;
@@ -220,11 +221,15 @@ import com.android.server.wm.WindowManagerInternal;
import com.android.server.wm.WindowManagerInternal.AppTransitionListener;
import com.android.server.wm.WindowManagerService;
+import dalvik.system.PathClassLoader;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -612,6 +617,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private int mCurrentUserId;
+ private AssistUtils mAssistUtils;
+
// Maps global key codes to the components that will handle them.
private GlobalKeyManager mGlobalKeyManager;
@@ -636,6 +643,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Timeout for showing the keyguard after the screen is on, in case no "ready" is received.
private int mKeyguardDrawnTimeout = 1000;
+ private final List<DeviceKeyHandler> mDeviceKeyHandlers = new ArrayList<>();
+
private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3;
private static final int MSG_DISPATCH_MEDIA_KEY_REPEAT_WITH_WAKE_LOCK = 4;
private static final int MSG_KEYGUARD_DRAWN_COMPLETE = 5;
@@ -1317,6 +1326,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
+ private boolean hasAssistant() {
+ return mAssistUtils.getAssistComponentForUser(mCurrentUserId) != null;
+ }
+
private int getResolvedLongPressOnPowerBehavior() {
if (FactoryTest.isLongPressOnPowerOffEnabled()) {
return LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM;
@@ -1324,7 +1337,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// If the config indicates the assistant behavior but the device isn't yet provisioned, show
// global actions instead.
- if (mLongPressOnPowerBehavior == LONG_PRESS_POWER_ASSISTANT && !isDeviceProvisioned()) {
+ if (mLongPressOnPowerBehavior == LONG_PRESS_POWER_ASSISTANT &&
+ (!isDeviceProvisioned() || !hasAssistant())) {
return LONG_PRESS_POWER_GLOBAL_ACTIONS;
}
@@ -2138,6 +2152,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mSafeModeEnabledVibePattern = getLongIntArray(mContext.getResources(),
com.android.internal.R.array.config_safeModeEnabledVibePattern);
+ mAssistUtils = new AssistUtils(context);
+
mGlobalKeyManager = new GlobalKeyManager(mContext);
// Controls rotation and the like.
@@ -2200,6 +2216,28 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mWindowManagerFuncs.onKeyguardShowingAndNotOccludedChanged();
}
});
+ final String[] deviceKeyHandlerLibs = res.getStringArray(
+ com.android.internal.R.array.config_deviceKeyHandlerLibs);
+ final String[] deviceKeyHandlerClasses = res.getStringArray(
+ com.android.internal.R.array.config_deviceKeyHandlerClasses);
+
+ for (int i = 0;
+ i < deviceKeyHandlerLibs.length && i < deviceKeyHandlerClasses.length; i++) {
+ try {
+ PathClassLoader loader = new PathClassLoader(
+ deviceKeyHandlerLibs[i], getClass().getClassLoader());
+ Class<?> klass = loader.loadClass(deviceKeyHandlerClasses[i]);
+ Constructor<?> constructor = klass.getConstructor(Context.class);
+ mDeviceKeyHandlers.add((DeviceKeyHandler) constructor.newInstance(mContext));
+ } catch (Exception e) {
+ Slog.w(TAG, "Could not instantiate device key handler "
+ + deviceKeyHandlerLibs[i] + " from class "
+ + deviceKeyHandlerClasses[i], e);
+ }
+ }
+ if (DEBUG_INPUT) {
+ Slog.d(TAG, "" + mDeviceKeyHandlers.size() + " device key handlers loaded");
+ }
initKeyCombinationRules();
initSingleKeyGestureRules();
mSideFpsEventHandler = new SideFpsEventHandler(mContext, mHandler, mPowerManager);
@@ -3124,6 +3162,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return key_consumed;
}
+ // Specific device key handling
+ if (dispatchKeyToKeyHandlers(event)) {
+ return -1;
+ }
+
// Reserve all the META modifier combos for system behavior
if ((metaState & KeyEvent.META_META_ON) != 0) {
return key_consumed;
@@ -3176,6 +3219,23 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
+ private boolean dispatchKeyToKeyHandlers(KeyEvent event) {
+ for (DeviceKeyHandler handler : mDeviceKeyHandlers) {
+ try {
+ if (DEBUG_INPUT) {
+ Log.d(TAG, "Dispatching key event " + event + " to handler " + handler);
+ }
+ event = handler.handleKeyEvent(event);
+ if (event == null) {
+ return true;
+ }
+ } catch (Exception e) {
+ Slog.w(TAG, "Could not dispatch event to device key handler", e);
+ }
+ }
+ return false;
+ }
+
// TODO(b/117479243): handle it in InputPolicy
/** {@inheritDoc} */
@Override
@@ -3890,6 +3950,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
&& (!isNavBarVirtKey || mNavBarVirtualKeyHapticFeedbackEnabled)
&& event.getRepeatCount() == 0;
+ // Specific device key handling
+ if (dispatchKeyToKeyHandlers(event)) {
+ return 0;
+ }
+
// Handle special keys.
switch (keyCode) {
case KeyEvent.KEYCODE_BACK: {
diff --git a/services/core/java/com/android/server/power/Notifier.java b/services/core/java/com/android/server/power/Notifier.java
index dad9584c6722..f817bc4ac1b4 100644
--- a/services/core/java/com/android/server/power/Notifier.java
+++ b/services/core/java/com/android/server/power/Notifier.java
@@ -115,6 +115,8 @@ public class Notifier {
-1);
private static final VibrationAttributes HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES =
VibrationAttributes.createForUsage(VibrationAttributes.USAGE_HARDWARE_FEEDBACK);
+ private static final VibrationEffect CHARGING_VIBRATION_DOUBLE_CLICK_EFFECT =
+ VibrationEffect.createPredefined(VibrationEffect.EFFECT_DOUBLE_CLICK);
private final Object mLock = new Object();
@@ -844,8 +846,8 @@ public class Notifier {
final boolean vibrate = Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.CHARGING_VIBRATION_ENABLED, 1, userId) != 0;
if (vibrate) {
- mVibrator.vibrate(CHARGING_VIBRATION_EFFECT,
- HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES);
+ mVibrator.vibrate(mVibrator.hasAmplitudeControl() ? CHARGING_VIBRATION_EFFECT :
+ CHARGING_VIBRATION_DOUBLE_CLICK_EFFECT, HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES);
}
// play sound
diff --git a/services/core/java/com/android/server/textservices/TextServicesManagerService.java b/services/core/java/com/android/server/textservices/TextServicesManagerService.java
index cd2b8943ce11..f2106696de29 100644
--- a/services/core/java/com/android/server/textservices/TextServicesManagerService.java
+++ b/services/core/java/com/android/server/textservices/TextServicesManagerService.java
@@ -43,6 +43,8 @@ import android.service.textservice.SpellCheckerService;
import android.text.TextUtils;
import android.util.Slog;
import android.util.SparseArray;
+import android.view.inputmethod.InputMethodManager;
+import android.view.inputmethod.InputMethodSubtype;
import android.view.textservice.SpellCheckerInfo;
import android.view.textservice.SpellCheckerSubtype;
import android.view.textservice.SuggestionsInfo;
@@ -544,19 +546,37 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
// subtypeHashCode == 0 means spell checker language settings is "auto"
- if (systemLocale == null) {
+ Locale candidateLocale = null;
+ final InputMethodManager imm = mContext.getSystemService(InputMethodManager.class);
+ if (imm != null) {
+ final InputMethodSubtype currentInputMethodSubtype =
+ imm.getCurrentInputMethodSubtype();
+ if (currentInputMethodSubtype != null) {
+ final String localeString = currentInputMethodSubtype.getLocale();
+ if (!TextUtils.isEmpty(localeString)) {
+ // 1. Use keyboard locale if available in the spell checker
+ candidateLocale = SubtypeLocaleUtils.constructLocaleFromString(localeString);
+ }
+ }
+ }
+ if (candidateLocale == null) {
+ // 2. Use System locale if available in the spell checker
+ candidateLocale = systemLocale;
+ }
+
+ if (candidateLocale == null) {
return null;
}
SpellCheckerSubtype firstLanguageMatchingSubtype = null;
for (int i = 0; i < sci.getSubtypeCount(); ++i) {
final SpellCheckerSubtype scs = sci.getSubtypeAt(i);
final Locale scsLocale = scs.getLocaleObject();
- if (Objects.equals(scsLocale, systemLocale)) {
+ if (Objects.equals(scsLocale, candidateLocale)) {
// Exact match wins.
return scs;
}
if (firstLanguageMatchingSubtype == null && scsLocale != null
- && TextUtils.equals(systemLocale.getLanguage(), scsLocale.getLanguage())) {
+ && TextUtils.equals(candidateLocale.getLanguage(), scsLocale.getLanguage())) {
// Remember as a fall back candidate
firstLanguageMatchingSubtype = scs;
}
diff --git a/services/core/java/com/android/server/webkit/SystemImpl.java b/services/core/java/com/android/server/webkit/SystemImpl.java
index 68f554cb2758..5604fc6c0f39 100644
--- a/services/core/java/com/android/server/webkit/SystemImpl.java
+++ b/services/core/java/com/android/server/webkit/SystemImpl.java
@@ -219,7 +219,7 @@ public class SystemImpl implements SystemInterface {
@Override
public boolean systemIsDebuggable() {
- return Build.IS_DEBUGGABLE;
+ return Build.IS_DEBUGGABLE && Build.IS_ENG;
}
@Override
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index d5b9608dda9a..fd0cd9665ef1 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -193,7 +193,6 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SWITCH;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_TRANSITION;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_USER_LEAVING;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_VISIBILITY;
-import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SERVICETRACKER;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_ADD_REMOVE;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_APP;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_CONFIGURATION;
@@ -303,7 +302,6 @@ import android.os.PersistableBundle;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.service.contentcapture.ActivityEvent;
@@ -384,10 +382,6 @@ import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;
-import vendor.qti.hardware.servicetracker.V1_2.IServicetracker;
-import vendor.qti.hardware.servicetracker.V1_2.ActivityDetails;
-import vendor.qti.hardware.servicetracker.V1_2.ActivityStats;
-import vendor.qti.hardware.servicetracker.V1_2.ActivityStates;
/**
* An entry in the history task, representing an activity.
*/
@@ -648,9 +642,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
public BoostFramework mPerf = null;
public BoostFramework mPerf_iop = null;
- private final boolean isLowRamDevice =
- SystemProperties.getBoolean("ro.config.low_ram", false);
-
boolean mVoiceInteraction;
private int mPendingRelaunchCount;
@@ -2089,7 +2080,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
resultWho = _resultWho;
requestCode = _reqCode;
setState(INITIALIZING, "ActivityRecord ctor");
- callServiceTrackeronActivityStatechange(INITIALIZING, true);
launchFailed = false;
stopped = false;
delayedResume = false;
@@ -3702,7 +3692,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
// destroyed when the next activity reports idle.
addToStopping(false /* scheduleIdle */, false /* idleDelayed */,
"completeFinishing");
- callServiceTrackeronActivityStatechange(STOPPING, true);
setState(STOPPING, "completeFinishing");
} else if (addToFinishingAndWaitForIdle()) {
// We added this activity to the finishing list and something else is becoming
@@ -3729,7 +3718,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
* destroying it until the next one starts.
*/
boolean destroyIfPossible(String reason) {
- callServiceTrackeronActivityStatechange(FINISHING, true);
setState(FINISHING, "destroyIfPossible");
// Make sure the record is cleaned out of other places.
@@ -3781,7 +3769,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
@VisibleForTesting
boolean addToFinishingAndWaitForIdle() {
ProtoLog.v(WM_DEBUG_STATES, "Enqueueing pending finish: %s", this);
- callServiceTrackeronActivityStatechange(FINISHING, true);
setState(FINISHING, "addToFinishingAndWaitForIdle");
if (!mTaskSupervisor.mFinishingActivities.contains(this)) {
mTaskSupervisor.mFinishingActivities.add(this);
@@ -3852,14 +3839,12 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
// we are not removing it from the list.
if (finishing && !skipDestroy) {
ProtoLog.v(WM_DEBUG_STATES, "Moving to DESTROYING: %s (destroy requested)", this);
- callServiceTrackeronActivityStatechange(DESTROYING, true);
setState(DESTROYING,
"destroyActivityLocked. finishing and not skipping destroy");
mAtmService.mH.postDelayed(mDestroyTimeoutRunnable, DESTROY_TIMEOUT);
} else {
ProtoLog.v(WM_DEBUG_STATES, "Moving to DESTROYED: %s "
+ "(destroy skipped)", this);
- callServiceTrackeronActivityStatechange(DESTROYED, true);
setState(DESTROYED,
"destroyActivityLocked. not finishing or skipping destroy");
if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during destroy for activity " + this);
@@ -3872,7 +3857,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
removedFromHistory = true;
} else {
ProtoLog.v(WM_DEBUG_STATES, "Moving to DESTROYED: %s (no app)", this);
- callServiceTrackeronActivityStatechange(DESTROYED, true);
setState(DESTROYED, "destroyActivityLocked. not finishing and had no app");
}
}
@@ -3909,7 +3893,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
removeTimeouts();
ProtoLog.v(WM_DEBUG_STATES, "Moving to DESTROYED: %s (removed from history)",
this);
- callServiceTrackeronActivityStatechange(DESTROYED, true);
setState(DESTROYED, "removeFromHistory");
if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during remove for activity " + this);
detachFromProcess();
@@ -4007,7 +3990,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
frozenBeforeDestroy = false;
if (setState) {
- callServiceTrackeronActivityStatechange(DESTROYED, true);
setState(DESTROYED, "cleanUp");
if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during cleanUp for activity " + this);
detachFromProcess();
@@ -5676,8 +5658,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
mState = state;
- callServiceTrackeronActivityStatechange(state, false);
-
if (getTaskFragment() != null) {
getTaskFragment().onActivityStateChanged(this, state, reason);
}
@@ -5744,79 +5724,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
}
}
- void callServiceTrackeronActivityStatechange(State state, boolean early_notify) {
- IServicetracker mServicetracker;
- ActivityDetails aDetails = new ActivityDetails();
- ActivityStats aStats = new ActivityStats();
- int aState = ActivityStates.UNKNOWN;
-
- aDetails.launchedFromPid = this.launchedFromPid;
- aDetails.launchedFromUid = this.launchedFromUid;
- aDetails.packageName = this.packageName;
- aDetails.processName = (this.processName!= null)? this.processName:"none";
- aDetails.intent = this.intent.getComponent().toString();
- aDetails.className = this.intent.getComponent().getClassName();
- aDetails.versioncode = this.info.applicationInfo.versionCode;
-
- aStats.createTime = this.createTime;
- aStats.lastVisibleTime = this.lastVisibleTime;
- aStats.launchCount = this.launchCount;
- aStats.lastLaunchTime = this.lastLaunchTime;
-
- switch(state) {
- case INITIALIZING :
- aState = ActivityStates.INITIALIZING;
- break;
- case STARTED :
- aState = ActivityStates.STARTED;
- break;
- case RESUMED :
- aState = ActivityStates.RESUMED;
- break;
- case PAUSING :
- aState = ActivityStates.PAUSING;
- break;
- case PAUSED :
- aState = ActivityStates.PAUSED;
- break;
- case STOPPING :
- aState = ActivityStates.STOPPING;
- break;
- case STOPPED:
- aState = ActivityStates.STOPPED;
- break;
- case FINISHING :
- aState = ActivityStates.FINISHING;
- break;
- case DESTROYING:
- aState = ActivityStates.DESTROYING;
- break;
- case DESTROYED :
- aState = ActivityStates.DESTROYED;
- break;
- case RESTARTING_PROCESS:
- aState = ActivityStates.RESTARTING_PROCESS;
- break;
- }
- if (!isLowRamDevice) {
- if(DEBUG_SERVICETRACKER) {
- Slog.v(TAG, "Calling mServicetracker.OnActivityStateChange with flag "
- + early_notify + " state " + state);
- }
- try {
- mServicetracker = mAtmService.mTaskSupervisor.getServicetrackerInstance();
- if (mServicetracker != null)
- mServicetracker.OnActivityStateChange(aState, aDetails, aStats, early_notify);
- else
- Slog.e(TAG, "Unable to get servicetracker HAL instance");
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send activity state change details to servicetracker HAL", e);
- mAtmService.mTaskSupervisor.destroyServicetrackerInstance();
- }
- }
-
- }
-
State getState() {
return mState;
}
@@ -6127,7 +6034,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
}
// An activity must be in the {@link PAUSING} state for the system to validate
// the move to {@link PAUSED}.
- callServiceTrackeronActivityStatechange(PAUSING, true);
setState(PAUSING, "makeActiveIfNeeded");
try {
mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), token,
@@ -6141,7 +6047,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
if (DEBUG_VISIBILITY) {
Slog.v(TAG_VISIBILITY, "Start visible activity, " + this);
}
- callServiceTrackeronActivityStatechange(STARTED, true);
setState(STARTED, "makeActiveIfNeeded");
try {
@@ -6373,7 +6278,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
shortComponentName, pausingActivity != null
? pausingActivity.shortComponentName : "(none)");
if (isState(PAUSING)) {
- callServiceTrackeronActivityStatechange(PAUSED, true);
setState(PAUSED, "activityPausedLocked");
if (finishing) {
ProtoLog.v(WM_DEBUG_STATES,
@@ -6445,7 +6349,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
try {
stopped = false;
ProtoLog.v(WM_DEBUG_STATES, "Moving to STOPPING: %s (stop requested)", this);
- callServiceTrackeronActivityStatechange(STOPPING, true);
setState(STOPPING, "stopIfPossible");
getRootTask().onARStopTriggered(this);
@@ -6465,7 +6368,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
// Just in case, assume it to be stopped.
stopped = true;
ProtoLog.v(WM_DEBUG_STATES, "Stop failed; moving to STOPPED: %s", this);
- callServiceTrackeronActivityStatechange(STOPPED, true);
setState(STOPPED, "stopIfPossible");
if (deferRelaunchUntilPaused) {
destroyImmediately("stop-except");
@@ -6499,7 +6401,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
removeStopTimeout();
stopped = true;
if (isStopping) {
- callServiceTrackeronActivityStatechange(STOPPED, true);
setState(STOPPED, "activityStoppedLocked");
}
@@ -9796,7 +9697,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
mAtmService.getAppWarningsLocked().onResumeActivity(this);
} else {
removePauseTimeout();
- callServiceTrackeronActivityStatechange(PAUSED, true);
setState(PAUSED, "relaunchActivityLocked");
}
@@ -9826,7 +9726,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
}
// The restarting state avoids removing this record when process is died.
- callServiceTrackeronActivityStatechange(RESTARTING_PROCESS, true);
setState(RESTARTING_PROCESS, "restartActivityProcess");
if (!mVisibleRequested || mHaveState) {
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java b/services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java
index 6671b360ed0b..33d1b44b9743 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java
@@ -58,8 +58,6 @@ public class ActivityTaskManagerDebugConfig {
static final boolean DEBUG_ACTIVITY_STARTS = DEBUG_ALL || false;
public static final boolean DEBUG_CLEANUP = DEBUG_ALL || false;
public static final boolean DEBUG_METRICS = DEBUG_ALL || false;
- //Flag to enable Servicetracker logs in AOSP side
- static final boolean DEBUG_SERVICETRACKER = false;
static final String POSTFIX_APP = APPEND_CATEGORY_NAME ? "_App" : "";
static final String POSTFIX_CLEANUP = (APPEND_CATEGORY_NAME) ? "_Cleanup" : "";
diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
index b77c8a9c3c66..d249408eabbf 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
@@ -162,8 +162,6 @@ import java.util.function.Consumer;
import java.util.Arrays;
import android.os.AsyncTask;
-import vendor.qti.hardware.servicetracker.V1_2.IServicetracker;
-
// TODO: This class has become a dumping ground. Let's
// - Move things relating to the hierarchy to RootWindowContainer
// - Move things relating to activity life cycles to maybe a new class called ActivityLifeCycler
@@ -271,8 +269,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
private AppOpsManager mAppOpsManager;
- private IServicetracker mServicetracker;
-
/** Common synchronization logic used to save things to disks. */
PersisterQueue mPersisterQueue;
LaunchParamsPersister mLaunchParamsPersister;
@@ -471,28 +467,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
mLaunchParamsPersister.onSystemReady();
}
- public IServicetracker getServicetrackerInstance() {
- if (mServicetracker == null) {
- try {
- mServicetracker = IServicetracker.getService(false);
- } catch (java.util.NoSuchElementException e) {
- // Service doesn't exist or cannot be opened logged below
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to get servicetracker interface", e);
- return null;
- }
- if (mServicetracker == null) {
- Slog.w(TAG, "servicetracker HIDL not available");
- return null;
- }
- }
- return mServicetracker;
- }
-
- public void destroyServicetrackerInstance() {
- mServicetracker = null;
- }
-
void onUserUnlocked(int userId) {
// Only start persisting when the first user is unlocked. The method call is
// idempotent so there is no side effect to call it again when the second user is
diff --git a/services/core/java/com/android/server/wm/AlertWindowNotification.java b/services/core/java/com/android/server/wm/AlertWindowNotification.java
index c589feae56ca..51c93a6293b4 100644
--- a/services/core/java/com/android/server/wm/AlertWindowNotification.java
+++ b/services/core/java/com/android/server/wm/AlertWindowNotification.java
@@ -24,6 +24,7 @@ import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.provider.Settings.ACTION_MANAGE_APP_OVERLAY_PERMISSION;
+import android.annotation.UserIdInt;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
@@ -37,6 +38,7 @@ import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
+import android.os.UserHandle;
import com.android.internal.R;
import com.android.internal.util.ImageUtils;
@@ -53,11 +55,14 @@ class AlertWindowNotification {
private String mNotificationTag;
private final NotificationManager mNotificationManager;
private final String mPackageName;
+ private final @UserIdInt int mUserId;
private boolean mPosted;
- AlertWindowNotification(WindowManagerService service, String packageName) {
+ AlertWindowNotification(WindowManagerService service, String packageName,
+ @UserIdInt int userId) {
mService = service;
mPackageName = packageName;
+ mUserId = userId;
mNotificationManager =
(NotificationManager) mService.mContext.getSystemService(NOTIFICATION_SERVICE);
mNotificationTag = CHANNEL_PREFIX + mPackageName;
@@ -100,7 +105,7 @@ class AlertWindowNotification {
final Context context = mService.mContext;
final PackageManager pm = context.getPackageManager();
- final ApplicationInfo aInfo = getApplicationInfo(pm, mPackageName);
+ final ApplicationInfo aInfo = getApplicationInfoAsUser(pm, mPackageName, mUserId);
final String appName = (aInfo != null)
? pm.getApplicationLabel(aInfo).toString() : mPackageName;
@@ -138,6 +143,7 @@ class AlertWindowNotification {
final Intent intent = new Intent(ACTION_MANAGE_APP_OVERLAY_PERMISSION,
Uri.fromParts("package", packageName, null));
intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
+ intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.of(mUserId));
// Calls into activity manager...
return PendingIntent.getActivity(context, mRequestCode, intent,
FLAG_CANCEL_CURRENT | FLAG_IMMUTABLE);
@@ -168,9 +174,10 @@ class AlertWindowNotification {
}
- private ApplicationInfo getApplicationInfo(PackageManager pm, String packageName) {
+ private ApplicationInfo getApplicationInfoAsUser(PackageManager pm, String packageName,
+ @UserIdInt int userId) {
try {
- return pm.getApplicationInfo(packageName, 0);
+ return pm.getApplicationInfoAsUser(packageName, 0, userId);
} catch (PackageManager.NameNotFoundException e) {
return null;
}
diff --git a/services/core/java/com/android/server/wm/RemoteDisplayChangeController.java b/services/core/java/com/android/server/wm/RemoteDisplayChangeController.java
index 43baebc7255a..e646f14a3e13 100644
--- a/services/core/java/com/android/server/wm/RemoteDisplayChangeController.java
+++ b/services/core/java/com/android/server/wm/RemoteDisplayChangeController.java
@@ -114,9 +114,15 @@ public class RemoteDisplayChangeController {
// timed-out, so run all continue callbacks and clear the list
synchronized (mService.mGlobalLock) {
for (int i = 0; i < mCallbacks.size(); ++i) {
- mCallbacks.get(i).onContinueRemoteDisplayChange(null /* transaction */);
+ final ContinueRemoteDisplayChangeCallback callback = mCallbacks.get(i);
+ if (i == mCallbacks.size() - 1) {
+ // Clear all callbacks before calling the last one, so that if the callback
+ // itself calls {@link #isWaitingForRemoteDisplayChange()}, it will get
+ // {@code false}. After all, there is nothing pending after this one.
+ mCallbacks.clear();
+ }
+ callback.onContinueRemoteDisplayChange(null /* transaction */);
}
- mCallbacks.clear();
}
}
diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java
index fb68fe666c0b..67088e957eb8 100644
--- a/services/core/java/com/android/server/wm/Session.java
+++ b/services/core/java/com/android/server/wm/Session.java
@@ -761,7 +761,8 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
if (mAlertWindowSurfaces.isEmpty()) {
cancelAlertWindowNotification();
} else if (mAlertWindowNotification == null){
- mAlertWindowNotification = new AlertWindowNotification(mService, mPackageName);
+ mAlertWindowNotification = new AlertWindowNotification(mService, mPackageName,
+ UserHandle.getUserId(mUid));
if (mShowingAlertWindowNotificationAllowed) {
mAlertWindowNotification.post();
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
index 770feaba9303..07bef3d044c3 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
@@ -676,10 +676,6 @@ public class PreferencesHelperTest extends UiServiceTestCase {
compareChannels(ido, mHelper.getNotificationChannel(PKG_O, UID_O, ido.getId(), false));
compareChannels(idp, mHelper.getNotificationChannel(PKG_P, UID_P, idp.getId(), false));
- verify(mPermissionHelper).setNotificationPermission(nMr1Expected);
- verify(mPermissionHelper).setNotificationPermission(oExpected);
- verify(mPermissionHelper).setNotificationPermission(pExpected);
-
// verify that we also write a state for review_permissions_notification to eventually
// show a notification
assertEquals(NotificationManagerService.REVIEW_NOTIF_STATE_SHOULD_SHOW,
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 3edee50216b6..67b67c5bda70 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -9193,7 +9193,7 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_SHOW_4G_FOR_3G_DATA_ICON_BOOL, false);
sDefaults.putString(KEY_OPERATOR_NAME_FILTER_PATTERN_STRING, "");
sDefaults.putString(KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING, "");
- sDefaults.putBoolean(KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL, true);
+ sDefaults.putBoolean(KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL, false);
sDefaults.putInt(KEY_LTE_PLUS_THRESHOLD_BANDWIDTH_KHZ_INT, 20000);
sDefaults.putInt(KEY_NR_ADVANCED_THRESHOLD_BANDWIDTH_KHZ_INT, 0);
sDefaults.putBoolean(KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL, false);