summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/bluetooth/BluetoothGattServerCallback.java4
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java16
-rw-r--r--packages/SystemUI/res/layout/volume_zen_footer.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java1
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java13
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java82
8 files changed, 83 insertions, 41 deletions
diff --git a/core/java/android/bluetooth/BluetoothGattServerCallback.java b/core/java/android/bluetooth/BluetoothGattServerCallback.java
index 22eba351b361..2c8114be3fe3 100644
--- a/core/java/android/bluetooth/BluetoothGattServerCallback.java
+++ b/core/java/android/bluetooth/BluetoothGattServerCallback.java
@@ -184,7 +184,7 @@ public abstract class BluetoothGattServerCallback {
/**
* Callback indicating the connection parameters were updated.
*
- * @param gatt The remote device involved
+ * @param device The remote device involved
* @param interval Connection interval used on this connection, 1.25ms unit. Valid range is from
* 6 (7.5ms) to 3200 (4000ms).
* @param latency Slave latency for the connection in number of connection events. Valid range
@@ -195,7 +195,7 @@ public abstract class BluetoothGattServerCallback {
* successfully
* @hide
*/
- public void onConnectionUpdated(BluetoothDevice gatt, int interval, int latency, int timeout,
+ public void onConnectionUpdated(BluetoothDevice device, int interval, int latency, int timeout,
int status) {
}
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 860bb44dbd5d..0bd298151f7e 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -195,8 +195,12 @@ public class BatteryStatsImpl extends BatteryStats {
return mKernelMemoryStats;
}
- /** Temporary container for Resource Power Manager stats. */
+ /** Container for Resource Power Manager stats. Updated by updateRpmStatsLocked. */
private final RpmStats mTmpRpmStats = new RpmStats();
+ /** The soonest the RPM stats can be updated after it was last updated. */
+ private static final long RPM_STATS_UPDATE_FREQ_MS = 1000;
+ /** Last time that RPM stats were updated by updateRpmStatsLocked. */
+ private long mLastRpmStatsUpdateTimeMs = -RPM_STATS_UPDATE_FREQ_MS;
public interface BatteryCallback {
public void batteryNeedsCpuUpdate();
@@ -10266,11 +10270,17 @@ public class BatteryStatsImpl extends BatteryStats {
}
/**
- * Read and record Resource Power Manager state and voter times.
+ * Read and record Resource Power Manager (RPM) state and voter times.
+ * If RPM stats were fetched more recently than RPM_STATS_UPDATE_FREQ_MS ago, uses the old data
+ * instead of fetching it anew.
*/
public void updateRpmStatsLocked() {
if (mPlatformIdleStateCallback == null) return;
- mPlatformIdleStateCallback.fillLowPowerStats(mTmpRpmStats);
+ long now = SystemClock.elapsedRealtime();
+ if (now - mLastRpmStatsUpdateTimeMs >= RPM_STATS_UPDATE_FREQ_MS) {
+ mPlatformIdleStateCallback.fillLowPowerStats(mTmpRpmStats);
+ mLastRpmStatsUpdateTimeMs = now;
+ }
for (Map.Entry<String, RpmStats.PowerStatePlatformSleepState> pstate
: mTmpRpmStats.mPlatformLowPowerStats.entrySet()) {
diff --git a/packages/SystemUI/res/layout/volume_zen_footer.xml b/packages/SystemUI/res/layout/volume_zen_footer.xml
index 7ffcb1efb7b3..df79c5ff5ba4 100644
--- a/packages/SystemUI/res/layout/volume_zen_footer.xml
+++ b/packages/SystemUI/res/layout/volume_zen_footer.xml
@@ -25,18 +25,15 @@
android:id="@+id/zen_embedded_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
- android:layout_marginBottom="12dp"
android:layout_marginTop="8dp"
android:background="@color/qs_tile_divider" />
-
<RelativeLayout
android:id="@+id/zen_introduction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
- android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="@drawable/zen_introduction_message_background"
android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent.Light">
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java
index 13912fe0c16d..97e9c3dfd82c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/SlashImageView.java
@@ -48,6 +48,7 @@ public class SlashImageView extends ImageView {
mSlash = null;
super.setImageDrawable(null);
} else if (mSlash == null) {
+ setImageLevel(drawable.getLevel());
super.setImageDrawable(drawable);
} else {
mSlash.setAnimationEnabled(mAnimationEnabled);
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 0fd6c7440c94..761e979d3244 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -75,6 +75,7 @@ import android.widget.TextView;
import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
+import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.plugins.VolumeDialog;
import com.android.systemui.plugins.VolumeDialogController;
@@ -515,6 +516,9 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable {
if (mSafetyWarning != null) return 5000;
if (mExpanded || mExpandButtonAnimationRunning) return 5000;
if (mActiveStream == AudioManager.STREAM_MUSIC) return 1500;
+ if (mZenFooter.shouldShowIntroduction()) {
+ return 6000;
+ }
return 3000;
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java b/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
index 74642129b197..80e162983a65 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
@@ -152,6 +152,7 @@ public class ZenFooter extends LinearLayout {
mController.getCurrentUser(), true /*shortVersion*/);
Util.setText(mSummaryLine2, line2);
}
+
public boolean shouldShowIntroduction() {
final boolean confirmed = Prefs.getBoolean(mContext,
Prefs.Key.DND_CONFIRMED_ALARM_INTRODUCTION, false);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java
index 9fe3e10b752e..98ca1b4fc799 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java
@@ -76,6 +76,19 @@ public class SlashImageViewTest extends SysuiTestCase {
assertTrue(mSlashView.getSlashDrawable() == null);
}
+ @Test
+ public void testSetImageDrawableUsesDrawableLevel() {
+ SlashImageView iv = new SlashImageView(mContext);
+ Drawable mockDrawable = mock(Drawable.class);
+ mockDrawable.setLevel(2);
+ assertTrue(mockDrawable.getLevel() == 2);
+
+ iv.setImageDrawable(mockDrawable);
+
+ // Make sure setting the drawable didn't reset its level to 0
+ assertTrue(mockDrawable.getLevel() == 2);
+ }
+
// Expose getSlashDrawable
private static class TestableSlashImageView extends SlashImageView {
TestableSlashImageView(Context c) {
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 53fde762bdfa..0cca63b810e4 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2772,17 +2772,22 @@ public class NotificationManagerService extends SystemService {
public void setNotificationPolicyAccessGranted(String pkg, boolean granted)
throws RemoteException {
checkCallerIsSystemOrShell();
- if (!mActivityManager.isLowRamDevice()) {
- mConditionProviders.setPackageOrComponentEnabled(
- pkg, getCallingUserHandle().getIdentifier(), true, granted);
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ if (!mActivityManager.isLowRamDevice()) {
+ mConditionProviders.setPackageOrComponentEnabled(
+ pkg, getCallingUserHandle().getIdentifier(), true, granted);
- getContext().sendBroadcastAsUser(new Intent(
- NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)
- .setPackage(pkg)
- .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
- getCallingUserHandle(), null);
+ getContext().sendBroadcastAsUser(new Intent(
+ NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)
+ .setPackage(pkg)
+ .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
+ getCallingUserHandle(), null);
- savePolicyFile();
+ savePolicyFile();
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
}
}
@@ -2864,19 +2869,25 @@ public class NotificationManagerService extends SystemService {
boolean granted) throws RemoteException {
Preconditions.checkNotNull(listener);
checkCallerIsSystemOrShell();
- if (!mActivityManager.isLowRamDevice()) {
- mConditionProviders.setPackageOrComponentEnabled(listener.flattenToString(),
- userId, false, granted);
- mListeners.setPackageOrComponentEnabled(listener.flattenToString(),
- userId, true, granted);
-
- getContext().sendBroadcastAsUser(new Intent(
- NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)
- .setPackage(listener.getPackageName())
- .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
- getCallingUserHandle(), null);
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ if (!mActivityManager.isLowRamDevice()) {
+ mConditionProviders.setPackageOrComponentEnabled(listener.flattenToString(),
+ userId, false, granted);
+ mListeners.setPackageOrComponentEnabled(listener.flattenToString(),
+ userId, true, granted);
- savePolicyFile();
+ getContext().sendBroadcastAsUser(new Intent(
+ NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)
+
+ .setPackage(listener.getPackageName())
+ .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
+ getCallingUserHandle(), null);
+
+ savePolicyFile();
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
}
}
@@ -2885,19 +2896,24 @@ public class NotificationManagerService extends SystemService {
int userId, boolean granted) throws RemoteException {
Preconditions.checkNotNull(assistant);
checkCallerIsSystemOrShell();
- if (!mActivityManager.isLowRamDevice()) {
- mConditionProviders.setPackageOrComponentEnabled(assistant.flattenToString(),
- userId, false, granted);
- mAssistants.setPackageOrComponentEnabled(assistant.flattenToString(),
- userId, true, granted);
-
- getContext().sendBroadcastAsUser(new Intent(
- NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)
- .setPackage(assistant.getPackageName())
- .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
- getCallingUserHandle(), null);
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ if (!mActivityManager.isLowRamDevice()) {
+ mConditionProviders.setPackageOrComponentEnabled(assistant.flattenToString(),
+ userId, false, granted);
+ mAssistants.setPackageOrComponentEnabled(assistant.flattenToString(),
+ userId, true, granted);
+
+ getContext().sendBroadcastAsUser(new Intent(
+ NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)
+ .setPackage(assistant.getPackageName())
+ .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
+ getCallingUserHandle(), null);
- savePolicyFile();
+ savePolicyFile();
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
}
}