Loading media/java/android/media/AudioService.java +7 −0 Original line number Diff line number Diff line Loading @@ -1390,6 +1390,13 @@ public class AudioService extends IAudioService.Stub { if ((ringerMode == AudioManager.RINGER_MODE_VIBRATE) && !mHasVibrator) { ringerMode = AudioManager.RINGER_MODE_SILENT; } if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) SystemProperties.set("persist.sys.silent", "1"); else SystemProperties.set("persist.sys.silent", "0"); if (ringerMode != getRingerMode()) { setRingerModeInt(ringerMode, true); // Send sticky broadcast Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +51 −1 Original line number Diff line number Diff line Loading @@ -459,6 +459,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mVolumeDownKeyConsumedByScreenshotChord; private boolean mVolumeUpKeyTriggered; private boolean mPowerKeyTriggered; private long mVolumeUpKeyTime; private boolean mVolumeUpKeyConsumedByScreenshotChord; private long mPowerKeyTime; /* The number of steps between min and max brightness */ Loading Loading @@ -707,6 +709,24 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } private void interceptScreenshotLog() { if (mScreenshotChordEnabled && mVolumeUpKeyTriggered && mPowerKeyTriggered && !mVolumeDownKeyTriggered) { final long now = SystemClock.uptimeMillis(); if (now <= mVolumeUpKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS && now <= mPowerKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS) { mVolumeUpKeyConsumedByScreenshotChord = true; cancelPendingScreenshotForLog(); mHandler.postDelayed(mScreenshotForLog, getScreenshotChordLongPressDelay()); } } } private void cancelPendingScreenshotForLog() { mHandler.removeCallbacks(mScreenshotForLog); } private long getScreenshotChordLongPressDelay() { if (mKeyguardDelegate.isShowing()) { // Double the time it takes to take a screenshot from the keyguard Loading Loading @@ -762,6 +782,19 @@ public class PhoneWindowManager implements WindowManagerPolicy { } }; private final Runnable mScreenshotForLog = new Runnable() { public void run() { Intent intent = new Intent(); intent.setAction("android.system.agent"); intent.putExtra("para", "takeLogs"); try { mContext.startService(intent); } catch (Exception e) { Slog.e(TAG, "Exception when start SystemAgent service", e); } } }; void showGlobalActionsDialog() { if (mGlobalActions == null) { mGlobalActions = new GlobalActions(mContext, mWindowManagerFuncs); Loading Loading @@ -2011,6 +2044,20 @@ public class PhoneWindowManager implements WindowManagerPolicy { } return -1; } if (mVolumeUpKeyTriggered && !mPowerKeyTriggered) { final long now = SystemClock.uptimeMillis(); final long timeoutTime = mVolumeUpKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS; if (now < timeoutTime) { return timeoutTime - now; } } if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && mVolumeUpKeyConsumedByScreenshotChord) { if (!down) { mVolumeUpKeyConsumedByScreenshotChord = false; } return -1; } } // First we always handle the home key here, so applications Loading Loading @@ -3916,8 +3963,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (isScreenOn && !mVolumeUpKeyTriggered && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) { mVolumeUpKeyTriggered = true; mVolumeUpKeyTime = event.getDownTime(); mVolumeUpKeyConsumedByScreenshotChord = false; cancelPendingPowerKeyAction(); cancelPendingScreenshotChordAction(); interceptScreenshotLog(); } } else { mVolumeUpKeyTriggered = false; Loading Loading @@ -4009,6 +4058,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mPowerKeyTriggered = true; mPowerKeyTime = event.getDownTime(); interceptScreenshotChord(); interceptScreenshotLog(); if (mButtonLightEnabled) { try { Loading services/java/com/android/server/net/NetworkPolicyManagerService.java +27 −0 Original line number Diff line number Diff line Loading @@ -1434,6 +1434,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { public void setNetworkPolicies(NetworkPolicy[] policies) { mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG); // Before clear and refresh mNetworkPolicy, we need to ensure all the // policies to be added are validated, otherwise this service will throw // IllegalArgumentException and cause system crash when updating network // template after receiving ACTION_NETWORK_STATS_UPDATED. validatePoliciesToSet(policies); maybeRefreshTrustedTime(); synchronized (mRulesLock) { mNetworkPolicy.clear(); Loading @@ -1448,6 +1454,27 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } } /** * ensure the policies have valid template * * @param policies */ private void validatePoliciesToSet(NetworkPolicy[] policies) { for (NetworkPolicy policy : policies) { switch (policy.template.getMatchRule()) { case MATCH_MOBILE_3G_LOWER: case MATCH_MOBILE_4G: case MATCH_MOBILE_ALL: case MATCH_WIFI: case MATCH_ETHERNET: break; default: throw new IllegalArgumentException("unexpected template " + policy.template.getMatchRule()); } } } private void addNetworkPolicyLocked(NetworkPolicy policy) { mNetworkPolicy.put(policy.template, policy); Loading Loading
media/java/android/media/AudioService.java +7 −0 Original line number Diff line number Diff line Loading @@ -1390,6 +1390,13 @@ public class AudioService extends IAudioService.Stub { if ((ringerMode == AudioManager.RINGER_MODE_VIBRATE) && !mHasVibrator) { ringerMode = AudioManager.RINGER_MODE_SILENT; } if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) SystemProperties.set("persist.sys.silent", "1"); else SystemProperties.set("persist.sys.silent", "0"); if (ringerMode != getRingerMode()) { setRingerModeInt(ringerMode, true); // Send sticky broadcast Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +51 −1 Original line number Diff line number Diff line Loading @@ -459,6 +459,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mVolumeDownKeyConsumedByScreenshotChord; private boolean mVolumeUpKeyTriggered; private boolean mPowerKeyTriggered; private long mVolumeUpKeyTime; private boolean mVolumeUpKeyConsumedByScreenshotChord; private long mPowerKeyTime; /* The number of steps between min and max brightness */ Loading Loading @@ -707,6 +709,24 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } private void interceptScreenshotLog() { if (mScreenshotChordEnabled && mVolumeUpKeyTriggered && mPowerKeyTriggered && !mVolumeDownKeyTriggered) { final long now = SystemClock.uptimeMillis(); if (now <= mVolumeUpKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS && now <= mPowerKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS) { mVolumeUpKeyConsumedByScreenshotChord = true; cancelPendingScreenshotForLog(); mHandler.postDelayed(mScreenshotForLog, getScreenshotChordLongPressDelay()); } } } private void cancelPendingScreenshotForLog() { mHandler.removeCallbacks(mScreenshotForLog); } private long getScreenshotChordLongPressDelay() { if (mKeyguardDelegate.isShowing()) { // Double the time it takes to take a screenshot from the keyguard Loading Loading @@ -762,6 +782,19 @@ public class PhoneWindowManager implements WindowManagerPolicy { } }; private final Runnable mScreenshotForLog = new Runnable() { public void run() { Intent intent = new Intent(); intent.setAction("android.system.agent"); intent.putExtra("para", "takeLogs"); try { mContext.startService(intent); } catch (Exception e) { Slog.e(TAG, "Exception when start SystemAgent service", e); } } }; void showGlobalActionsDialog() { if (mGlobalActions == null) { mGlobalActions = new GlobalActions(mContext, mWindowManagerFuncs); Loading Loading @@ -2011,6 +2044,20 @@ public class PhoneWindowManager implements WindowManagerPolicy { } return -1; } if (mVolumeUpKeyTriggered && !mPowerKeyTriggered) { final long now = SystemClock.uptimeMillis(); final long timeoutTime = mVolumeUpKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS; if (now < timeoutTime) { return timeoutTime - now; } } if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && mVolumeUpKeyConsumedByScreenshotChord) { if (!down) { mVolumeUpKeyConsumedByScreenshotChord = false; } return -1; } } // First we always handle the home key here, so applications Loading Loading @@ -3916,8 +3963,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (isScreenOn && !mVolumeUpKeyTriggered && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) { mVolumeUpKeyTriggered = true; mVolumeUpKeyTime = event.getDownTime(); mVolumeUpKeyConsumedByScreenshotChord = false; cancelPendingPowerKeyAction(); cancelPendingScreenshotChordAction(); interceptScreenshotLog(); } } else { mVolumeUpKeyTriggered = false; Loading Loading @@ -4009,6 +4058,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mPowerKeyTriggered = true; mPowerKeyTime = event.getDownTime(); interceptScreenshotChord(); interceptScreenshotLog(); if (mButtonLightEnabled) { try { Loading
services/java/com/android/server/net/NetworkPolicyManagerService.java +27 −0 Original line number Diff line number Diff line Loading @@ -1434,6 +1434,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { public void setNetworkPolicies(NetworkPolicy[] policies) { mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG); // Before clear and refresh mNetworkPolicy, we need to ensure all the // policies to be added are validated, otherwise this service will throw // IllegalArgumentException and cause system crash when updating network // template after receiving ACTION_NETWORK_STATS_UPDATED. validatePoliciesToSet(policies); maybeRefreshTrustedTime(); synchronized (mRulesLock) { mNetworkPolicy.clear(); Loading @@ -1448,6 +1454,27 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } } /** * ensure the policies have valid template * * @param policies */ private void validatePoliciesToSet(NetworkPolicy[] policies) { for (NetworkPolicy policy : policies) { switch (policy.template.getMatchRule()) { case MATCH_MOBILE_3G_LOWER: case MATCH_MOBILE_4G: case MATCH_MOBILE_ALL: case MATCH_WIFI: case MATCH_ETHERNET: break; default: throw new IllegalArgumentException("unexpected template " + policy.template.getMatchRule()); } } } private void addNetworkPolicyLocked(NetworkPolicy policy) { mNetworkPolicy.put(policy.template, policy); Loading