diff options
author | Prerepa Viswanadham <dham@google.com> | 2015-05-05 01:05:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-05 01:06:38 +0000 |
commit | d1808401ca3bfd6b6b9a975c1e739b194d18f849 (patch) | |
tree | 50c16a5c966772fd3b3ac4f7d2e79c97252935c7 /services/core/java/com | |
parent | 44b60be189183138437a3faf9a73388af0efcf44 (diff) | |
parent | 059ded5a7b7389b7eefc2502bd712228931ed107 (diff) | |
download | frameworks_base-d1808401ca3bfd6b6b9a975c1e739b194d18f849.zip frameworks_base-d1808401ca3bfd6b6b9a975c1e739b194d18f849.tar.gz frameworks_base-d1808401ca3bfd6b6b9a975c1e739b194d18f849.tar.bz2 |
Merge changes from topic 'mwd-merge-050415' into mnc-dev
* changes:
Merge commit 'b6f59f4' into master_merge
Merge commit 'f6db0ce' into master_merge
Merge commit '17455a3' into master_merge
Merge commit 'b4d5b32' into master_merge
Merge commit 'a1a2fa7' into master_merge
Merge commit '8dfdb98' into master_merge
Merge commit 'eba66c3' into master_merge
Diffstat (limited to 'services/core/java/com')
4 files changed, 40 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 8c6e290..bc93268 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -678,7 +678,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { handleRemoveListLocked(); } broadcastCallStateChanged(state, incomingNumber, - SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); + SubscriptionManager.INVALID_SUBSCRIPTION_ID); } public void notifyCallStateForSubscriber(int subId, int state, String incomingNumber) { @@ -1374,6 +1374,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } + /** + * Broadcasts an intent notifying apps of a phone state change. {@code subId} can be + * a valid subId, in which case this function fires a subId-specific intent, or it + * can be {@code SubscriptionManager.INVALID_SUBSCRIPTION_ID}, in which case we send + * a global state change broadcast ({@code TelephonyManager.ACTION_PHONE_STATE_CHANGED}). + */ private void broadcastCallStateChanged(int state, String incomingNumber, int subId) { long ident = Binder.clearCallingIdentity(); try { @@ -1394,7 +1400,14 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { if (!TextUtils.isEmpty(incomingNumber)) { intent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, incomingNumber); } - intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); + + // If a valid subId was specified, we should fire off a subId-specific state + // change intent and include the subId. + if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { + intent.setAction(PhoneConstants.ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED); + intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); + } + mContext.sendBroadcastAsUser(intent, UserHandle.ALL, android.Manifest.permission.READ_PHONE_STATE, AppOpsManager.OP_READ_PHONE_STATE); diff --git a/services/core/java/com/android/server/net/DelayedDiskWrite.java b/services/core/java/com/android/server/net/DelayedDiskWrite.java index 6ed277d..8f09eb7 100644 --- a/services/core/java/com/android/server/net/DelayedDiskWrite.java +++ b/services/core/java/com/android/server/net/DelayedDiskWrite.java @@ -38,6 +38,10 @@ public class DelayedDiskWrite { } public void write(final String filePath, final Writer w) { + write(filePath, w, true); + } + + public void write(final String filePath, final Writer w, final boolean open) { if (TextUtils.isEmpty(filePath)) { throw new IllegalArgumentException("empty file path"); } @@ -54,16 +58,18 @@ public class DelayedDiskWrite { mDiskWriteHandler.post(new Runnable() { @Override public void run() { - doWrite(filePath, w); + doWrite(filePath, w, open); } }); } - private void doWrite(String filePath, Writer w) { + private void doWrite(String filePath, Writer w, boolean open) { DataOutputStream out = null; try { - out = new DataOutputStream(new BufferedOutputStream( + if (open) { + out = new DataOutputStream(new BufferedOutputStream( new FileOutputStream(filePath))); + } w.onWriteCalled(out); } catch (IOException e) { loge("Error writing data file " + filePath); diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index adc3a7d..51503ec 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2673,6 +2673,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } return -1; + } else if (keyCode == KeyEvent.KEYCODE_N && event.isMetaPressed()) { + if (down) { + IStatusBarService service = getStatusBarService(); + if (service != null) { + try { + service.expandNotificationsPanel(); + } catch (RemoteException e) { + // do nothing. + } + } + } } else if (keyCode == KeyEvent.KEYCODE_ASSIST) { if (down) { if (repeatCount == 0) { diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index 1e0185d..84eab42 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -390,7 +390,7 @@ public final class ShutdownThread extends Thread { } } - rebootOrShutdown(mReboot, mRebootReason); + rebootOrShutdown(mContext, mReboot, mRebootReason); } private void shutdownRadios(int timeout) { @@ -507,17 +507,18 @@ public final class ShutdownThread extends Thread { * Do not call this directly. Use {@link #reboot(Context, String, boolean)} * or {@link #shutdown(Context, boolean)} instead. * + * @param context Context used to vibrate or null without vibration * @param reboot true to reboot or false to shutdown * @param reason reason for reboot */ - public static void rebootOrShutdown(boolean reboot, String reason) { + public static void rebootOrShutdown(final Context context, boolean reboot, String reason) { if (reboot) { Log.i(TAG, "Rebooting, reason: " + reason); PowerManagerService.lowLevelReboot(reason); Log.e(TAG, "Reboot failed, will attempt shutdown instead"); - } else if (SHUTDOWN_VIBRATE_MS > 0) { + } else if (SHUTDOWN_VIBRATE_MS > 0 && context != null) { // vibrate before shutting down - Vibrator vibrator = new SystemVibrator(); + Vibrator vibrator = new SystemVibrator(context); try { vibrator.vibrate(SHUTDOWN_VIBRATE_MS, VIBRATION_ATTRIBUTES); } catch (Exception e) { |