diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 059ac1742072..18ab23bd46c8 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4650,6 +4650,44 @@ public boolean validate(@Nullable String value) {
*/
public static final String GLOBAL_ACTIONS_EMERGENCY = "global_actions_emergency";
+ /**
+ * volume answer
+ * @hide
+ */
+ public static final String ANSWER_VOLUME_BUTTON_BEHAVIOR_ANSWER = "call_volume_answer";
+ /** @hide */
+ private static final Validator ANSWER_VOLUME_BUTTON_BEHAVIOR_ANSWER_VALIDATOR =
+ BOOLEAN_VALIDATOR;
+
+ /**
+ * Volume rocker wake
+ * @hide
+ */
+ public static final String VOLUME_ROCKER_WAKE = "volume_rocker_wake";
+ /** @hide */
+ private static final Validator VOLUME_ROCKER_WAKE_VALIDATOR =
+ BOOLEAN_VALIDATOR;
+
+ /**
+ * @hide
+ */
+ public static final String LOCK_SHOW_STATUS_BAR = "lockscreen_show_status_bar";
+
+ /** @hide */
+ private static final Validator LOCK_SHOW_STATUS_BAR_VALIDATOR =
+ BOOLEAN_VALIDATOR;
+
+ /**
+ * Whether to show the kill app button in notification guts
+ * @hide
+ */
+ public static final String NOTIFICATION_GUTS_KILL_APP_BUTTON =
+ "notification_guts_kill_app_button";
+
+ /** @hide */
+ private static final Validator NOTIFICATION_GUTS_KILL_APP_BUTTON_VALIDATOR =
+ BOOLEAN_VALIDATOR;
+
/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
@@ -4716,6 +4754,10 @@ public boolean validate(@Nullable String value) {
ALARM_ALERT,
NOTIFICATION_LIGHT_PULSE,
USE_OLD_MOBILETYPE,
+ ANSWER_VOLUME_BUTTON_BEHAVIOR_ANSWER,
+ VOLUME_ROCKER_WAKE,
+ LOCK_SHOW_STATUS_BAR,
+ NOTIFICATION_GUTS_KILL_APP_BUTTON,
};
/**
@@ -4840,6 +4882,10 @@ public boolean validate(@Nullable String value) {
PRIVATE_SETTINGS.add(BUTTON_BRIGHTNESS);
PRIVATE_SETTINGS.add(PROXIMITY_ON_WAKE);
PRIVATE_SETTINGS.add(USE_OLD_MOBILETYPE);
+ PRIVATE_SETTINGS.add(ANSWER_VOLUME_BUTTON_BEHAVIOR_ANSWER);
+ PRIVATE_SETTINGS.add(VOLUME_ROCKER_WAKE);
+ PRIVATE_SETTINGS.add(LOCK_SHOW_STATUS_BAR);
+ PRIVATE_SETTINGS.add(NOTIFICATION_GUTS_KILL_APP_BUTTON);
}
/**
@@ -4938,6 +4984,10 @@ public boolean validate(@Nullable String value) {
VALIDATORS.put(PROXIMITY_ON_WAKE, PROXIMITY_ON_WAKE_VALIDATOR);
VALIDATORS.put(BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED, BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED_VALIDATOR);
VALIDATORS.put(USE_OLD_MOBILETYPE, USE_OLD_MOBILETYPE_VALIDATOR);
+ VALIDATORS.put(ANSWER_VOLUME_BUTTON_BEHAVIOR_ANSWER,ANSWER_VOLUME_BUTTON_BEHAVIOR_ANSWER_VALIDATOR);
+ VALIDATORS.put(VOLUME_ROCKER_WAKE, VOLUME_ROCKER_WAKE_VALIDATOR);
+ VALIDATORS.put(LOCK_SHOW_STATUS_BAR,LOCK_SHOW_STATUS_BAR_VALIDATOR);
+ VALIDATORS.put(NOTIFICATION_GUTS_KILL_APP_BUTTON, NOTIFICATION_GUTS_KILL_APP_BUTTON_VALIDATOR);
}
/**
@@ -13800,6 +13850,14 @@ public boolean validate(@Nullable String value) {
*/
public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed";
+
+ /**
+ * Whether to wake the display when plugging or unplugging the charger
+ *
+ * @hide
+ */
+ public static final String WAKE_WHEN_PLUGGED_OR_UNPLUGGED = "wake_when_plugged_or_unplugged";
+
/**
* Indicates whether this device is currently in retail demo mode. If true, the device
* usage is severely limited.
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 1d2e6884b390..aecf6a0af78b 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -105,6 +105,7 @@
+
diff --git a/packages/SystemUI/res/layout/notification_info.xml b/packages/SystemUI/res/layout/notification_info.xml
index 87de9d4d3b51..7f7f360b7da3 100644
--- a/packages/SystemUI/res/layout/notification_info.xml
+++ b/packages/SystemUI/res/layout/notification_info.xml
@@ -328,7 +328,7 @@ asked for it -->
android:minHeight="@dimen/notification_importance_toggle_size"
android:maxWidth="200dp"
style="@style/TextAppearance.NotificationInfo.Button"/>
+
Bootloader
Screenshot
Flashlight
+
+
+ Force stop?
+ If you force stop an app, it may misbehave.
+ @android:string/ok
+ @android:string/cancel
+ Close App
+
diff --git a/packages/SystemUI/res/values/evolution_strings.xml b/packages/SystemUI/res/values/evolution_strings.xml
new file mode 100644
index 000000000000..28bbe923439d
--- /dev/null
+++ b/packages/SystemUI/res/values/evolution_strings.xml
@@ -0,0 +1,199 @@
+
+
+
+
+ Columns
+ Columns landscape
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ Reset
+ Show labels
+ Quickbar columns
+ Automatic
+
+
+ Screenshot deleted
+
+
+ Advanced
+ Recovery
+ Bootloader
+ SystemUI
+
+
+ Screenshot
+ Partial screenshot
+
+
+ Sound search
+ Sorry, but this doesn\'t work if you don\'t have a Sound search app.
+
+
+ USB tethering off
+ USB tethering on
+ USB tethering turned off
+ USB tethering turned on
+ USB tethering
+
+
+ AOD
+
+
+ Sound
+ Mute
+ Ring
+ Vibrate
+
+
+ Caffeine
+ Caffeine off
+ Caffeine on
+
+
+ Heads up
+ Heads up off
+ Heads up on
+ Heads up turned off
+ Heads up turned on
+
+
+ Sync
+ Sync off
+ Sync on
+ Sync turned off
+ Sync turned on
+
+
+ Volume panel
+
+
+ Music
+ Play
+ Pause
+
+
+ Compass
+ %1$.0f\u00b0 %2$s
+ Initializing\u2026
+ Compass off
+ Compass on
+ Compass turned off
+ Compass turned on
+ N
+ NE
+ E
+ SE
+ S
+ SW
+ W
+ NW
+
+
+ Ambient display
+ Ambient display off
+ Ambient display on
+ Ambient display turned off
+ Ambient display turned on
+
+
+ Sleep Screen
+
+
+ VPN
+ Connect to\u2026
+ Please enter your credentials for connecting to %s
+ Username
+ Password
+ Connect
+
+
+ Reboot
+ Recovery
+
+
+ LTE
+ LTE ON
+ LTE OFF
+
+
+
+ Battery Saving
+ Location reporting: battery saving mode.
+ Sensors Only
+ Location reporting: sensors only mode.
+ High Accuracy
+ Location reporting: high accuracy mode.
+
+
+ %2$s • Dash Charging (%s until full)
+ Dash Charging
+
+
+ Reading mode
+ Reading mode on.
+ Reading mode off.
+ Reading mode turned on.
+ Reading mode turned off.
+
+ Statusbar icon
+
+ Default
+ None
+
+
+ Swipe from icon to launch
+
+
+ Screenrecord
+
+
+ HW keys on
+ HW keys off
+ HW keys
+
+
+ Gaming Mode
+ Gaming mode enabled
+ Gaming mode disabled
+ Gaming Mode
+ When gaming mode is enabled, all heads-up messages will be disabled and hardware keys will be turned off. All the disabled settings will be reset to default once you exit Gaming Mode.
+ Gaming mode on
+ Gaming mode off
+
+
+ Data disabled
+ Data saver
+ NFC
+ Roaming
+ VPN
+
+
+ Nfc
+
+
+ Force stop?
+ If you force stop an app, it may misbehave.
+ @android:string/ok
+ @android:string/cancel
+ Close App
+
+
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java
index 148d83b5ab5c..c10f2bd5c7d2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java
@@ -30,20 +30,26 @@
import android.animation.ObjectAnimator;
import android.annotation.IntDef;
import android.annotation.Nullable;
+import android.app.ActivityManager;
import android.app.INotificationManager;
+import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.metrics.LogMaker;
import android.os.Handler;
import android.os.RemoteException;
+import android.os.UserHandle;
+import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.transition.ChangeBounds;
@@ -64,6 +70,9 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
+import com.android.settingslib.Utils;
+import com.android.systemui.statusbar.phone.StatusBar;
+import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.notification.logging.NotificationCounters;
@@ -384,6 +393,7 @@ private void bindInlineControls() {
applyAlertingBehavior(
mWasShownHighPriority ? BEHAVIOR_ALERTING : BEHAVIOR_SILENT,
false /* userTriggered */);
+
}
private void bindHeader() {
@@ -430,6 +440,42 @@ private void bindHeader() {
final View settingsButton = findViewById(R.id.info);
settingsButton.setOnClickListener(getSettingsOnClickListener());
settingsButton.setVisibility(settingsButton.hasOnClickListeners() ? VISIBLE : GONE);
+
+ final TextView killButton = (TextView) findViewById(R.id.notification_inspect_kill);
+ boolean killButtonEnabled = Settings.System.getIntForUser(
+ mContext.getContentResolver(),
+ Settings.System.NOTIFICATION_GUTS_KILL_APP_BUTTON, 0,
+ UserHandle.USER_CURRENT) != 0;
+ if (killButtonEnabled && !isThisASystemPackage(mPackageName)) {
+ killButton.setVisibility(View.VISIBLE);
+ killButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ KeyguardManager keyguardManager = (KeyguardManager)
+ mContext.getSystemService(Context.KEYGUARD_SERVICE);
+ if (keyguardManager.inKeyguardRestrictedInputMode()) {
+ // Don't do anything
+ return;
+ }
+ final SystemUIDialog killDialog = new SystemUIDialog(mContext);
+ killDialog.setTitle(mContext.getText(R.string.force_stop_dlg_title));
+ killDialog.setMessage(mContext.getText(R.string.force_stop_dlg_text));
+ killDialog.setPositiveButton(
+ R.string.dlg_ok, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ // kill pkg
+ ActivityManager actMan =
+ (ActivityManager) mContext.getSystemService(
+ Context.ACTIVITY_SERVICE);
+ actMan.forceStopPackage(mPackageName);
+ }
+ });
+ killDialog.setNegativeButton(R.string.dlg_cancel, null);
+ killDialog.show();
+ }
+ });
+ } else {
+ killButton.setVisibility(View.GONE);
+ }
}
private OnClickListener getSettingsOnClickListener() {
@@ -511,6 +557,20 @@ private void bindGroup() throws RemoteException {
}
}
+ private boolean isThisASystemPackage(String packageName) {
+ try {
+ final UserHandle userHandle = mSbn.getUser();
+ PackageManager pm = StatusBar.getPackageManagerForUser(mContext,
+ userHandle.getIdentifier());
+ PackageInfo packageInfo = pm.getPackageInfo(packageName,
+ PackageManager.GET_SIGNATURES);
+ PackageInfo sys = pm.getPackageInfo("android", PackageManager.GET_SIGNATURES);
+ return (packageInfo != null && packageInfo.signatures != null &&
+ sys.signatures[0].equals(packageInfo.signatures[0]));
+ } catch (PackageManager.NameNotFoundException e) {
+ return false;
+ }
+ }
@VisibleForTesting
void logBlockingHelperCounter(String counterTag) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index e28e8aedae39..553ecf13ec5d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -18,6 +18,10 @@
import static com.android.systemui.ScreenDecorations.DisplayCutoutView.boundsFromDirection;
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.AnimatorListenerAdapter;
import android.annotation.ColorInt;
import android.content.Context;
import android.content.res.Configuration;
@@ -25,6 +29,8 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Pair;
import android.util.TypedValue;
@@ -106,6 +112,8 @@ public class KeyguardStatusBarView extends RelativeLayout
// Cutout
private boolean mHasBigCutout;
+ private boolean mHideContents;
+
public KeyguardStatusBarView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -191,13 +199,20 @@ private void updateVisibilities() {
// If we have no keyguard switcher, the screen width is under 600dp. In this case,
// we only show the multi-user switch if it's enabled through UserManager as well as
// by the user.
+
if (!mHasBigCutout && mMultiUserSwitch.isMultiUserEnabled()) {
mMultiUserSwitch.setVisibility(View.VISIBLE);
+ } else if (mMultiUserSwitch.isMultiUserEnabled()) {
+ mMultiUserSwitch.setVisibility(mHideContents ? View.INVISIBLE : View.VISIBLE);
+
} else {
mMultiUserSwitch.setVisibility(View.GONE);
}
}
mBatteryView.setForceShowPercent(mBatteryCharging && mShowPercentAvailable);
+ if (mCarrierLabel != null) {
+ mCarrierLabel.setVisibility(mHideContents ? View.INVISIBLE : View.VISIBLE);
+ }
}
private void updateSystemIconsLayoutParams() {
@@ -501,4 +516,96 @@ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
mBatteryView.dump(fd, pw, args);
}
}
+
+ public void toggleContents(boolean hideContents) {
+ boolean shouldShowContents = Settings.System.getIntForUser(
+ getContext().getContentResolver(), Settings.System.LOCK_SHOW_STATUS_BAR, 1,
+ UserHandle.USER_CURRENT) == 1;
+ if (shouldShowContents) {
+ hideContents = false;
+ }
+ if (mHideContents == hideContents) {
+ return;
+ }
+
+ mHideContents = hideContents;
+ if (mHideContents) {
+ Animator fadeAnimator1 = null;
+ if (mMultiUserSwitch.getVisibility() != View.GONE) {
+ fadeAnimator1 = ObjectAnimator.ofFloat(mMultiUserSwitch, "alpha", 1f, 0f);
+ fadeAnimator1.setDuration(500);
+ fadeAnimator1.setInterpolator(Interpolators.ALPHA_OUT);
+ fadeAnimator1.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mMultiUserSwitch.setVisibility(View.INVISIBLE);
+ }
+ });
+ }
+ Animator fadeAnimator2 = ObjectAnimator.ofFloat(mSystemIconsContainer, "alpha", 1f, 0f);
+ fadeAnimator2.setDuration(500);
+ fadeAnimator2.setInterpolator(Interpolators.ALPHA_OUT);
+ fadeAnimator2.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mSystemIconsContainer.setVisibility(View.INVISIBLE);
+ }
+ });
+ Animator fadeAnimator3 = null;
+ if (mCarrierLabel.getVisibility() != View.GONE) {
+ fadeAnimator3 = ObjectAnimator.ofFloat(mCarrierLabel, "alpha", 1f, 0f);
+ fadeAnimator3.setDuration(500);
+ fadeAnimator3.setInterpolator(Interpolators.ALPHA_OUT);
+ fadeAnimator3.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mCarrierLabel.setVisibility(View.INVISIBLE);
+ }
+ });
+ }
+ AnimatorSet set = new AnimatorSet();
+ set.playTogether(fadeAnimator2);
+ if (fadeAnimator3 != null) {
+ set.playTogether(fadeAnimator3);
+ }
+ if (fadeAnimator1 != null) {
+ set.playTogether(fadeAnimator1);
+ }
+ set.start();
+ } else {
+ Animator fadeAnimator1 = null;
+ if (mMultiUserSwitch.getVisibility() != View.GONE) {
+ mMultiUserSwitch.setAlpha(0f);
+ mMultiUserSwitch.setVisibility(View.VISIBLE);
+ fadeAnimator1 = ObjectAnimator.ofFloat(mMultiUserSwitch, "alpha", 0f, 1f);
+ fadeAnimator1.setDuration(500);
+ fadeAnimator1.setInterpolator(Interpolators.ALPHA_IN);
+ }
+
+ mSystemIconsContainer.setAlpha(0f);
+ mSystemIconsContainer.setVisibility(View.VISIBLE);
+ Animator fadeAnimator2 = ObjectAnimator.ofFloat(mSystemIconsContainer, "alpha", 0f, 1f);
+ fadeAnimator2.setDuration(500);
+ fadeAnimator2.setInterpolator(Interpolators.ALPHA_IN);
+
+ Animator fadeAnimator3 = null;
+ if (mCarrierLabel.getVisibility() != View.GONE) {
+ mCarrierLabel.setAlpha(0f);
+ mCarrierLabel.setVisibility(View.VISIBLE);
+ fadeAnimator3 = ObjectAnimator.ofFloat(mCarrierLabel, "alpha", 0f, 1f);
+ fadeAnimator3.setDuration(500);
+ fadeAnimator3.setInterpolator(Interpolators.ALPHA_IN);
+ }
+
+ AnimatorSet set = new AnimatorSet();
+ set.playTogether(fadeAnimator2);
+ if (fadeAnimator3 != null) {
+ set.playTogether(fadeAnimator3);
+ }
+ if (fadeAnimator1 != null) {
+ set.playTogether(fadeAnimator1);
+ }
+ set.start();
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 6bc0cf6e0a3d..f9c4a3ed9cb0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1596,6 +1596,9 @@ public void onStateChanged(int statusBarState) {
} else {
mKeyguardStatusBar.setAlpha(1f);
mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE);
+ if (keyguardShowing) {
+ mKeyguardStatusBar.toggleContents(true);
+ }
if (keyguardShowing && oldState != mBarState) {
if (mQs != null) {
mQs.hideImmediately();
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index e029a599ac7f..c21be594d83c 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -393,6 +393,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private boolean mHasFeatureLeanback;
private boolean mHasFeatureHdmiCec;
+ boolean mVolumeRockerWake;
+
// Assigned on main thread, accessed on UI thread
volatile VrManagerInternal mVrManagerInternal;
@@ -540,6 +542,9 @@ public void onDrawn() {
DisplayRotation mDefaultDisplayRotation;
DisplayPolicy mDefaultDisplayPolicy;
+ // The volume key answer
+ boolean mVolumeAnswer;
+
// What we do when the user long presses on home
private int mLongPressOnHomeBehavior;
@@ -796,6 +801,12 @@ void observe() {
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE), false, this,
UserHandle.USER_ALL);
+ resolver.registerContentObserver(Settings.System.getUriFor(
+ Settings.System.ANSWER_VOLUME_BUTTON_BEHAVIOR_ANSWER), false, this,
+ UserHandle.USER_ALL);
+ resolver.registerContentObserver(Settings.System.getUriFor(
+ Settings.System.VOLUME_ROCKER_WAKE), false, this,
+ UserHandle.USER_ALL);
updateSettings();
}
@@ -2056,6 +2067,15 @@ public void updateSettings() {
mRingerToggleChord = Settings.Secure.VOLUME_HUSH_OFF;
}
+ // volume rocker answer
+ mVolumeAnswer = (Settings.System.getIntForUser(resolver,
+ Settings.System.ANSWER_VOLUME_BUTTON_BEHAVIOR_ANSWER, 0,
+ UserHandle.USER_CURRENT) != 0);
+
+ // volume rocker wake
+ mVolumeRockerWake = Settings.System.getIntForUser(resolver,
+ Settings.System.VOLUME_ROCKER_WAKE, 0, UserHandle.USER_CURRENT) != 0;
+
// Configure wake gesture.
boolean wakeGestureEnabledSetting = Settings.Secure.getIntForUser(resolver,
Settings.Secure.WAKE_GESTURE_ENABLED, 0,
@@ -3744,9 +3764,12 @@ public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags) {
}
// Basic policy based on interactive state.
+ final boolean isVolumeRockerWake = !isScreenOn()
+ && mVolumeRockerWake
+ && (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN);
int result;
boolean isWakeKey = (policyFlags & WindowManagerPolicy.FLAG_WAKE) != 0
- || event.isWakeKey();
+ || event.isWakeKey() || isVolumeRockerWake;
if (interactive || (isInjected && !isWakeKey)) {
// When the device is interactive or the key is injected pass the
// key to the application.
@@ -3879,6 +3902,10 @@ public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags) {
// When {@link #mHandleVolumeKeysInWM} is set, volume key events
// should be dispatched to WM.
if (telecomManager.isRinging()) {
+ // The volume key answer
+ if (mVolumeAnswer) {
+ telecomManager.acceptRingingCall();
+ }
// If an incoming call is ringing, either VOLUME key means
// "silence ringer". We handle these keys here, rather than
// in the InCallScreen, to make sure we'll respond to them
@@ -4227,6 +4254,9 @@ private boolean isWakeKeyWhenScreenOff(int keyCode) {
// ignore volume keys unless docked
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_DOWN:
+ if (mVolumeRockerWake) {
+ return true;
+ }
case KeyEvent.KEYCODE_VOLUME_MUTE:
return mDefaultDisplayPolicy.getDockMode() != Intent.EXTRA_DOCK_STATE_UNDOCKED;
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index 1f70d4cbe6c7..4049b0097b65 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -471,6 +471,9 @@ public final class PowerManagerService extends SystemService
// A bitfield of battery conditions under which to make the screen stay on.
private int mStayOnWhilePluggedInSetting;
+ // True if the device should wake up when plugged or unplugged
+ private int mWakeUpWhenPluggedOrUnpluggedSetting;
+
// True if the device should stay on.
private boolean mStayOn;
@@ -971,6 +974,9 @@ public void systemReady(IAppOpsService appOps) {
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED),
false, mSettingsObserver, UserHandle.USER_ALL);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED),
+ false, mSettingsObserver, UserHandle.USER_ALL);
IVrManager vrManager = IVrManager.Stub.asInterface(getBinderService(Context.VR_SERVICE));
if (vrManager != null) {
try {
@@ -1113,6 +1119,9 @@ private void updateSettingsLocked() {
Settings.System.PROXIMITY_ON_WAKE,
mProximityWakeEnabledByDefaultConfig ? 1 : 0) == 1;
+ mWakeUpWhenPluggedOrUnpluggedSetting = Settings.Global.getInt(resolver,
+ Settings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED,
+ (mWakeUpWhenPluggedOrUnpluggedConfig ? 1 : 0));
mDirty |= DIRTY_SETTINGS;
}
@@ -1892,7 +1901,7 @@ private void updateIsPoweredLocked(int dirty) {
private boolean shouldWakeUpWhenPluggedOrUnpluggedLocked(
boolean wasPowered, int oldPlugType, boolean dockedOnWirelessCharger) {
// Don't wake when powered unless configured to do so.
- if (!mWakeUpWhenPluggedOrUnpluggedConfig) {
+ if (mWakeUpWhenPluggedOrUnpluggedSetting == 0) {
return false;
}