Merge "BluetoothMidiService: Use MidiBtleTimeTracker to interpret incoming Bluetooth MIDI timestamps"
diff --git a/api/current.txt b/api/current.txt
index 6db4ba7..83a81d5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -15014,6 +15014,7 @@
method public int write(short[], int, int, int);
method public int write(float[], int, int, int);
method public int write(java.nio.ByteBuffer, int, int);
+ method public int write(java.nio.ByteBuffer, int, int, long);
field public static final int ERROR = -1; // 0xffffffff
field public static final int ERROR_BAD_VALUE = -2; // 0xfffffffe
field public static final int ERROR_INVALID_OPERATION = -3; // 0xfffffffd
diff --git a/api/system-current.txt b/api/system-current.txt
index 0d35d7c..9e98f28 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -16226,6 +16226,7 @@
method public int write(short[], int, int, int);
method public int write(float[], int, int, int);
method public int write(java.nio.ByteBuffer, int, int);
+ method public int write(java.nio.ByteBuffer, int, int, long);
field public static final int ERROR = -1; // 0xffffffff
field public static final int ERROR_BAD_VALUE = -2; // 0xfffffffe
field public static final int ERROR_INVALID_OPERATION = -3; // 0xfffffffd
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index d56dc1e..bde8f39 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -16,6 +16,8 @@
package android.app;
+import android.annotation.NonNull;
+
/**
* Activity manager local system service interface.
*
@@ -27,4 +29,23 @@
public abstract int startIsolatedProcess(String entryPoint, String[] mainArgs,
String processName, String abiOverride, int uid, Runnable crashHandler);
+
+ /**
+ * Acquires a sleep token with the specified tag.
+ *
+ * @param tag A string identifying the purpose of the token (eg. "Dream").
+ */
+ public abstract SleepToken acquireSleepToken(@NonNull String tag);
+
+ /**
+ * Sleep tokens cause the activity manager to put the top activity to sleep.
+ * They are used by components such as dreams that may hide and block interaction
+ * with underlying activities.
+ */
+ public static abstract class SleepToken {
+ /**
+ * Releases the sleep token.
+ */
+ public abstract void release();
+ }
}
diff --git a/core/java/android/os/storage/DiskInfo.java b/core/java/android/os/storage/DiskInfo.java
index 9f38de8..64f2a05 100644
--- a/core/java/android/os/storage/DiskInfo.java
+++ b/core/java/android/os/storage/DiskInfo.java
@@ -68,6 +68,9 @@
if (TextUtils.isEmpty(label)) {
return false;
}
+ if (label.equalsIgnoreCase("ata")) {
+ return false;
+ }
if (label.toLowerCase().contains("generic")) {
return false;
}
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index efa3ef2..f101352 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -69,6 +69,8 @@
/** {@hide} */
public static final String PROP_PRIMARY_PHYSICAL = "ro.vold.primary_physical";
+ /** {@hide} */
+ public static final String PROP_FORCE_ADOPTABLE = "persist.fw.force_adoptable";
/** {@hide} */
public static final int FLAG_ALL_METADATA = 1 << 0;
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 44455fa..ded9d31 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -19,7 +19,9 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
+import java.lang.Math;
import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
import java.nio.NioUtils;
import android.annotation.IntDef;
@@ -279,6 +281,14 @@
* Reference to the app-ops service.
*/
private final IAppOpsService mAppOps;
+ /**
+ * HW_AV_SYNC track AV Sync Header
+ */
+ private ByteBuffer mAvSyncHeader = null;
+ /**
+ * HW_AV_SYNC track audio data bytes remaining to write after current AV sync header
+ */
+ private int mAvSyncBytesRemaining = 0;
//--------------------------------
// Used exclusively by native code
@@ -1489,6 +1499,8 @@
synchronized(mPlayStateLock) {
native_stop();
mPlayState = PLAYSTATE_STOPPED;
+ mAvSyncHeader = null;
+ mAvSyncBytesRemaining = 0;
}
}
@@ -1533,6 +1545,8 @@
if (mState == STATE_INITIALIZED) {
// flush the data in native layer
native_flush();
+ mAvSyncHeader = null;
+ mAvSyncBytesRemaining = 0;
}
}
@@ -1849,6 +1863,86 @@
}
/**
+ * Writes the audio data to the audio sink for playback (streaming mode) on a HW_AV_SYNC track.
+ * In streaming mode, the blocking behavior will depend on the write mode.
+ * @param audioData the buffer that holds the data to play, starting at the position reported
+ * by <code>audioData.position()</code>.
+ * <BR>Note that upon return, the buffer position (<code>audioData.position()</code>) will
+ * have been advanced to reflect the amount of data that was successfully written to
+ * the AudioTrack.
+ * @param sizeInBytes number of bytes to write.
+ * <BR>Note this may differ from <code>audioData.remaining()</code>, but cannot exceed it.
+ * @param writeMode one of {@link #WRITE_BLOCKING}, {@link #WRITE_NON_BLOCKING}.
+ * <BR>With {@link #WRITE_BLOCKING}, the write will block until all data has been written
+ * to the audio sink.
+ * <BR>With {@link #WRITE_NON_BLOCKING}, the write will return immediately after
+ * queuing as much audio data for playback as possible without blocking.
+ * @param timestamp The timestamp of the first decodable audio frame in the provided audioData.
+ * @return 0 or a positive number of bytes that were written, or
+ * {@link #ERROR_BAD_VALUE}, {@link #ERROR_INVALID_OPERATION}, or
+ * {@link AudioManager#ERROR_DEAD_OBJECT} if the AudioTrack is not valid anymore and
+ * needs to be recreated.
+ */
+ public int write(ByteBuffer audioData, int sizeInBytes,
+ @WriteMode int writeMode, long timestamp) {
+
+ if ((mAttributes.getFlags() & AudioAttributes.FLAG_HW_AV_SYNC) == 0) {
+ Log.d(TAG, "AudioTrack.write() called on a regular AudioTrack. Ignoring pts...");
+ return write(audioData, sizeInBytes, writeMode);
+ }
+
+ if ((audioData == null) || (sizeInBytes < 0) || (sizeInBytes > audioData.remaining())) {
+ Log.e(TAG, "AudioTrack.write() called with invalid size (" + sizeInBytes + ") value");
+ return ERROR_BAD_VALUE;
+ }
+
+ // create timestamp header if none exists
+ if (mAvSyncHeader == null) {
+ mAvSyncHeader = ByteBuffer.allocate(16);
+ mAvSyncHeader.order(ByteOrder.BIG_ENDIAN);
+ mAvSyncHeader.putInt(0x55550001);
+ mAvSyncHeader.putInt(sizeInBytes);
+ mAvSyncHeader.putLong(timestamp);
+ mAvSyncHeader.position(0);
+ mAvSyncBytesRemaining = sizeInBytes;
+ }
+
+ // write timestamp header if not completely written already
+ int ret = 0;
+ if (mAvSyncHeader.remaining() != 0) {
+ ret = write(mAvSyncHeader, mAvSyncHeader.remaining(), writeMode);
+ if (ret < 0) {
+ Log.e(TAG, "AudioTrack.write() could not write timestamp header!");
+ mAvSyncHeader = null;
+ mAvSyncBytesRemaining = 0;
+ return ret;
+ }
+ if (mAvSyncHeader.remaining() > 0) {
+ Log.v(TAG, "AudioTrack.write() partial timestamp header written.");
+ return 0;
+ }
+ }
+
+ // write audio data
+ int sizeToWrite = Math.min(mAvSyncBytesRemaining, sizeInBytes);
+ ret = write(audioData, sizeToWrite, writeMode);
+ if (ret < 0) {
+ Log.e(TAG, "AudioTrack.write() could not write audio data!");
+ mAvSyncHeader = null;
+ mAvSyncBytesRemaining = 0;
+ return ret;
+ }
+
+ mAvSyncBytesRemaining -= ret;
+ if (mAvSyncBytesRemaining == 0) {
+ mAvSyncHeader = null;
+ }
+
+ return ret;
+ }
+
+
+ /**
* Sets the playback head position within the static buffer to zero,
* that is it rewinds to start of static buffer.
* The track must be stopped or paused, and
diff --git a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
index 7d5bf6b..1699809 100644
--- a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
+++ b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
@@ -39,7 +39,9 @@
private static final Intent INTENT_EMERGENCY_DIAL = new Intent()
.setAction("com.android.phone.EmergencyDialer.DIAL")
.setPackage("com.android.phone")
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
+ | Intent.FLAG_ACTIVITY_CLEAR_TASK);
KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
diff --git a/packages/PrintSpooler/Android.mk b/packages/PrintSpooler/Android.mk
index 27d1b23..19e44e3 100644
--- a/packages/PrintSpooler/Android.mk
+++ b/packages/PrintSpooler/Android.mk
@@ -18,6 +18,8 @@
LOCAL_MODULE_TAGS := optional
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res frameworks/support/v7/recyclerview/res
+LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages android.support.v7.recyclerview
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += \
src/com/android/printspooler/renderer/IPdfRenderer.aidl \
@@ -30,4 +32,4 @@
include $(BUILD_PACKAGE)
-include $(call all-makefiles-under, $(LOCAL_PATH))
\ No newline at end of file
+include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index 649fcde..f88802a 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -823,7 +823,10 @@
case VoldResponseCode.DISK_CREATED: {
if (cooked.length != 3) break;
final String id = cooked[1];
- final int flags = Integer.parseInt(cooked[2]);
+ int flags = Integer.parseInt(cooked[2]);
+ if (SystemProperties.getBoolean(StorageManager.PROP_FORCE_ADOPTABLE, false)) {
+ flags |= DiskInfo.FLAG_ADOPTABLE;
+ }
mDisks.put(id, new DiskInfo(id, flags));
break;
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index b658932..15d6756 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -114,6 +114,7 @@
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.StackInfo;
import android.app.ActivityManagerInternal;
+import android.app.ActivityManagerInternal.SleepToken;
import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.app.ActivityThread;
@@ -1013,6 +1014,13 @@
*/
private int mWakefulness = PowerManagerInternal.WAKEFULNESS_AWAKE;
+ /**
+ * A list of tokens that cause the top activity to be put to sleep.
+ * They are used by components that may hide and block interaction with underlying
+ * activities.
+ */
+ final ArrayList<SleepToken> mSleepTokens = new ArrayList<SleepToken>();
+
static final int LOCK_SCREEN_HIDDEN = 0;
static final int LOCK_SCREEN_LEAVING = 1;
static final int LOCK_SCREEN_SHOWN = 2;
@@ -9813,15 +9821,14 @@
return false;
}
+ // TODO: Transform the lock screen state into a sleep token instead.
switch (mWakefulness) {
case PowerManagerInternal.WAKEFULNESS_AWAKE:
case PowerManagerInternal.WAKEFULNESS_DREAMING:
- // If we're interactive but applications are already paused then defer
- // resuming them until the lock screen is hidden.
- return mSleeping && mLockScreenShown != LOCK_SCREEN_HIDDEN;
case PowerManagerInternal.WAKEFULNESS_DOZING:
- // If we're dozing then pause applications whenever the lock screen is shown.
- return mLockScreenShown != LOCK_SCREEN_HIDDEN;
+ // Pause applications whenever the lock screen is shown or any sleep
+ // tokens have been acquired.
+ return (mLockScreenShown != LOCK_SCREEN_HIDDEN || !mSleepTokens.isEmpty());
case PowerManagerInternal.WAKEFULNESS_ASLEEP:
default:
// If we're asleep then pause applications unconditionally.
@@ -12950,6 +12957,7 @@
if (dumpPackage == null) {
pw.println(" mWakefulness="
+ PowerManagerInternal.wakefulnessToString(mWakefulness));
+ pw.println(" mSleepTokens=" + mSleepTokens);
pw.println(" mSleeping=" + mSleeping + " mLockScreenShown="
+ lockScreenShownToString());
pw.println(" mShuttingDown=" + mShuttingDown + " mTestPssMode=" + mTestPssMode);
@@ -19723,6 +19731,42 @@
return ActivityManagerService.this.startIsolatedProcess(entryPoint, entryPointArgs,
processName, abiOverride, uid, crashHandler);
}
+
+ @Override
+ public SleepToken acquireSleepToken(String tag) {
+ Preconditions.checkNotNull(tag);
+
+ synchronized (ActivityManagerService.this) {
+ SleepTokenImpl token = new SleepTokenImpl(tag);
+ mSleepTokens.add(token);
+ updateSleepIfNeededLocked();
+ return token;
+ }
+ }
+ }
+
+ private final class SleepTokenImpl extends SleepToken {
+ private final String mTag;
+ private final long mAcquireTime;
+
+ public SleepTokenImpl(String tag) {
+ mTag = tag;
+ mAcquireTime = SystemClock.uptimeMillis();
+ }
+
+ @Override
+ public void release() {
+ synchronized (ActivityManagerService.this) {
+ if (mSleepTokens.remove(this)) {
+ updateSleepIfNeededLocked();
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "{\"" + mTag + "\", acquire at " + TimeUtils.formatUptime(mAcquireTime) + "}";
+ }
}
/**
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index ad85b59..25857c5 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -17,6 +17,8 @@
package com.android.server.policy;
import android.app.ActivityManager;
+import android.app.ActivityManagerInternal;
+import android.app.ActivityManagerInternal.SleepToken;
import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.IUiModeManager;
@@ -252,6 +254,7 @@
WindowManagerFuncs mWindowManagerFuncs;
WindowManagerInternal mWindowManagerInternal;
PowerManager mPowerManager;
+ ActivityManagerInternal mActivityManagerInternal;
DreamManagerInternal mDreamManagerInternal;
IStatusBarService mStatusBarService;
boolean mPreloadedRecentApps;
@@ -493,6 +496,8 @@
boolean mShowingLockscreen;
boolean mShowingDream;
boolean mDreamingLockscreen;
+ boolean mDreamingSleepTokenNeeded;
+ SleepToken mDreamingSleepToken;
boolean mKeyguardSecure;
boolean mKeyguardSecureIncludingHidden;
volatile boolean mKeyguardOccluded;
@@ -599,6 +604,7 @@
private static final int MSG_LAUNCH_VOICE_ASSIST_WITH_WAKE_LOCK = 12;
private static final int MSG_POWER_DELAYED_PRESS = 13;
private static final int MSG_POWER_LONG_PRESS = 14;
+ private static final int MSG_UPDATE_DREAMING_SLEEP_TOKEN = 15;
private class PolicyHandler extends Handler {
@Override
@@ -647,6 +653,9 @@
case MSG_POWER_LONG_PRESS:
powerLongPress();
break;
+ case MSG_UPDATE_DREAMING_SLEEP_TOKEN:
+ updateDreamingSleepToken(msg.arg1 != 0);
+ break;
}
}
}
@@ -1220,6 +1229,7 @@
mWindowManager = windowManager;
mWindowManagerFuncs = windowManagerFuncs;
mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
+ mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
mDreamManagerInternal = LocalServices.getService(DreamManagerInternal.class);
// Init display burn-in protection
@@ -4239,6 +4249,15 @@
// while the dream is showing.
if (!mShowingDream) {
mDreamingLockscreen = mShowingLockscreen;
+ if (mDreamingSleepTokenNeeded) {
+ mDreamingSleepTokenNeeded = false;
+ mHandler.obtainMessage(MSG_UPDATE_DREAMING_SLEEP_TOKEN, 0, 1).sendToTarget();
+ }
+ } else {
+ if (!mDreamingSleepTokenNeeded) {
+ mDreamingSleepTokenNeeded = true;
+ mHandler.obtainMessage(MSG_UPDATE_DREAMING_SLEEP_TOKEN, 1, 1).sendToTarget();
+ }
}
if (mStatusBar != null) {
@@ -5851,6 +5870,18 @@
}
}
+ private void updateDreamingSleepToken(boolean acquire) {
+ if (acquire) {
+ if (mDreamingSleepToken == null) {
+ mDreamingSleepToken = mActivityManagerInternal.acquireSleepToken("Dream");
+ }
+ } else {
+ if (mDreamingSleepToken != null) {
+ mDreamingSleepToken.release();
+ }
+ }
+ }
+
/** {@inheritDoc} */
@Override
public void enableScreenAfterBoot() {
@@ -6487,7 +6518,8 @@
pw.print(" mStatusBarLayer="); pw.println(mStatusBarLayer);
pw.print(prefix); pw.print("mShowingLockscreen="); pw.print(mShowingLockscreen);
pw.print(" mShowingDream="); pw.print(mShowingDream);
- pw.print(" mDreamingLockscreen="); pw.println(mDreamingLockscreen);
+ pw.print(" mDreamingLockscreen="); pw.print(mDreamingLockscreen);
+ pw.print(" mDreamingSleepToken="); pw.println(mDreamingSleepToken);
if (mLastInputMethodWindow != null) {
pw.print(prefix); pw.print("mLastInputMethodWindow=");
pw.println(mLastInputMethodWindow);
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 3ecf5ac..e4c003a 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -396,7 +396,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- subInfo = iSub.getActiveSubscriptionInfo(subId);
+ subInfo = iSub.getActiveSubscriptionInfo(subId, mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -424,7 +424,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getActiveSubscriptionInfoForIccId(iccId);
+ result = iSub.getActiveSubscriptionInfoForIccId(iccId, mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -450,7 +450,8 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getActiveSubscriptionInfoForSimSlotIndex(slotIdx);
+ result = iSub.getActiveSubscriptionInfoForSimSlotIndex(slotIdx,
+ mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -472,7 +473,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getAllSubInfoList();
+ result = iSub.getAllSubInfoList(mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -510,7 +511,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getActiveSubscriptionInfoList();
+ result = iSub.getActiveSubscriptionInfoList(mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -531,7 +532,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getAllSubInfoCount();
+ result = iSub.getAllSubInfoCount(mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -551,7 +552,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getActiveSubInfoCount();
+ result = iSub.getActiveSubInfoCount(mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -600,7 +601,7 @@
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
// FIXME: This returns 1 on success, 0 on error should should we return it?
- iSub.addSubInfoRecord(iccId, slotId);
+ iSub.addSubInfoRecord(iccId, slotId, mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -630,7 +631,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.setIconTint(tint, subId);
+ result = iSub.setIconTint(tint, subId, mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -675,7 +676,8 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.setDisplayNameUsingSrc(displayName, subId, nameSource);
+ result = iSub.setDisplayNameUsingSrc(displayName, subId, nameSource,
+ mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -703,7 +705,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.setDisplayNumber(number, subId);
+ result = iSub.setDisplayNumber(number, subId, mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -732,7 +734,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.setDataRoaming(roaming, subId);
+ result = iSub.setDataRoaming(roaming, subId, mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -967,7 +969,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- iSub.clearSubInfo();
+ iSub.clearSubInfo(mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
@@ -1001,7 +1003,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- iSub.clearDefaultsForInactiveSubIds();
+ iSub.clearDefaultsForInactiveSubIds(mContext.getOpPackageName());
}
} catch (RemoteException ex) {
// ignore it
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index acbc0aa..3f8aca0 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -22,42 +22,48 @@
interface ISub {
/**
+ * @param callingPackage The package maing the call.
* @return a list of all subscriptions in the database, this includes
* all subscriptions that have been seen.
*/
- List<SubscriptionInfo> getAllSubInfoList();
+ List<SubscriptionInfo> getAllSubInfoList(String callingPackage);
/**
+ * @param callingPackage The package maing the call.
* @return the count of all subscriptions in the database, this includes
* all subscriptions that have been seen.
*/
- int getAllSubInfoCount();
+ int getAllSubInfoCount(String callingPackage);
/**
* Get the active SubscriptionInfo with the subId key
* @param subId The unique SubscriptionInfo key in database
+ * @param callingPackage The package maing the call.
* @return SubscriptionInfo, maybe null if its not active
*/
- SubscriptionInfo getActiveSubscriptionInfo(int subId);
+ SubscriptionInfo getActiveSubscriptionInfo(int subId, String callingPackage);
/**
* Get the active SubscriptionInfo associated with the iccId
* @param iccId the IccId of SIM card
+ * @param callingPackage The package maing the call.
* @return SubscriptionInfo, maybe null if its not active
*/
- SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId);
+ SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage);
/**
* Get the active SubscriptionInfo associated with the slotIdx
* @param slotIdx the slot which the subscription is inserted
+ * @param callingPackage The package maing the call.
* @return SubscriptionInfo, maybe null if its not active
*/
- SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx);
+ SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx, String callingPackage);
/**
* Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted
* by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}.
*
+ * @param callingPackage The package maing the call.
* @return Sorted list of the currently {@link SubscriptionInfo} records available on the device.
* <ul>
* <li>
@@ -74,12 +80,13 @@
* </li>
* </ul>
*/
- List<SubscriptionInfo> getActiveSubscriptionInfoList();
+ List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage);
/**
+ * @param callingPackage The package maing the call.
* @return the number of active subscriptions
*/
- int getActiveSubInfoCount();
+ int getActiveSubInfoCount(String callingPackage);
/**
* @return the maximum number of subscriptions this device will support at any one time.
@@ -90,50 +97,57 @@
* Add a new SubscriptionInfo to subinfo database if needed
* @param iccId the IccId of the SIM card
* @param slotId the slot which the SIM is inserted
+ * @param callingPackage The package maing the call.
* @return the URL of the newly created row or the updated row
*/
- int addSubInfoRecord(String iccId, int slotId);
+ int addSubInfoRecord(String iccId, int slotId, String callingPackage);
/**
* Set SIM icon tint color by simInfo index
* @param tint the icon tint color of the SIM
* @param subId the unique SubscriptionInfo index in database
+ * @param callingPackage The package maing the call.
* @return the number of records updated
*/
- int setIconTint(int tint, int subId);
+ int setIconTint(int tint, int subId, String callingPackage);
/**
* Set display name by simInfo index
* @param displayName the display name of SIM card
* @param subId the unique SubscriptionInfo index in database
+ * @param callingPackage The package maing the call.
* @return the number of records updated
*/
- int setDisplayName(String displayName, int subId);
+ int setDisplayName(String displayName, int subId, String callingPackage);
/**
* Set display name by simInfo index with name source
* @param displayName the display name of SIM card
* @param subId the unique SubscriptionInfo index in database
* @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT
+ * @param callingPackage The package maing the call.
* @return the number of records updated
*/
- int setDisplayNameUsingSrc(String displayName, int subId, long nameSource);
+ int setDisplayNameUsingSrc(String displayName, int subId, long nameSource,
+ String callingPackage);
/**
* Set phone number by subId
* @param number the phone number of the SIM
* @param subId the unique SubscriptionInfo index in database
+ * @param callingPackage The package maing the call.
* @return the number of records updated
*/
- int setDisplayNumber(String number, int subId);
+ int setDisplayNumber(String number, int subId, String callingPackage);
/**
* Set data roaming by simInfo index
* @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming
+ * @param callingPackage The package maing the call.
* @param subId the unique SubscriptionInfo index in database
* @return the number of records updated
*/
- int setDataRoaming(int roaming, int subId);
+ int setDataRoaming(int roaming, int subId, String callingPackage);
int getSlotId(int subId);
@@ -141,7 +155,7 @@
int getDefaultSubId();
- int clearSubInfo();
+ int clearSubInfo(String callingPackage);
int getPhoneId(int subId);
@@ -161,7 +175,7 @@
void setDefaultSmsSubId(int subId);
- void clearDefaultsForInactiveSubIds();
+ void clearDefaultsForInactiveSubIds(String callingPackage);
int[] getActiveSubIdList();