Merge "Bug 17262099: MMS API changes (multi-project)." into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index f215a5f..15230c3 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5424,7 +5424,7 @@
method public boolean getCrossProfileCallerIdDisabled(android.content.ComponentName);
method public java.util.List<java.lang.String> getCrossProfileWidgetProviders(android.content.ComponentName);
method public int getCurrentFailedPasswordAttempts();
- method public java.util.List<byte[]> getInstalledCaCerts();
+ method public java.util.List<byte[]> getInstalledCaCerts(android.content.ComponentName);
method public int getKeyguardDisabledFeatures(android.content.ComponentName);
method public int getMaximumFailedPasswordsForWipe(android.content.ComponentName);
method public long getMaximumTimeToLock(android.content.ComponentName);
@@ -5445,7 +5445,7 @@
method public boolean getScreenCaptureDisabled(android.content.ComponentName);
method public boolean getStorageEncryption(android.content.ComponentName);
method public int getStorageEncryptionStatus();
- method public boolean hasCaCertInstalled(byte[]);
+ method public boolean hasCaCertInstalled(android.content.ComponentName, byte[]);
method public boolean hasGrantedPolicy(android.content.ComponentName, int);
method public boolean installCaCert(android.content.ComponentName, byte[]);
method public boolean isActivePasswordSufficient();
@@ -28267,7 +28267,6 @@
method public final void setRequestingRingback(boolean);
method public final void setRinging();
method public final void setStatusHints(android.telecomm.StatusHints);
- method public final void startActivityFromInCall(android.app.PendingIntent);
method public static java.lang.String stateToString(int);
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_DIALING = 3; // 0x3
@@ -28327,10 +28326,15 @@
method public java.lang.CharSequence getLabel();
method public java.lang.CharSequence getShortDescription();
method public java.lang.String getSubscriptionNumber();
+ method public java.util.List<java.lang.String> getSupportedUriSchemes();
+ method public boolean supportsUriScheme(java.lang.String);
method public void writeToParcel(android.os.Parcel, int);
field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
field public static final android.os.Parcelable.Creator CREATOR;
+ field public static final java.lang.String SCHEME_SIP = "sip";
+ field public static final java.lang.String SCHEME_TEL = "tel";
+ field public static final java.lang.String SCHEME_VOICEMAIL = "voicemail";
}
public static class PhoneAccount.Builder {
@@ -28343,6 +28347,8 @@
method public android.telecomm.PhoneAccount.Builder withLabel(java.lang.CharSequence);
method public android.telecomm.PhoneAccount.Builder withShortDescription(java.lang.CharSequence);
method public android.telecomm.PhoneAccount.Builder withSubscriptionNumber(java.lang.String);
+ method public android.telecomm.PhoneAccount.Builder withSupportedUriScheme(java.lang.String);
+ method public android.telecomm.PhoneAccount.Builder withSupportedUriSchemes(java.util.List<java.lang.String>);
}
public class PhoneAccountHandle implements android.os.Parcelable {
@@ -28445,7 +28451,6 @@
method public void onParentChanged(android.telecomm.RemoteConnection, android.telecomm.RemoteConnection);
method public void onPostDialWait(android.telecomm.RemoteConnection, java.lang.String);
method public void onRequestingRingback(android.telecomm.RemoteConnection, boolean);
- method public void onStartActivityFromInCall(android.telecomm.RemoteConnection, android.app.PendingIntent);
method public void onStateChanged(android.telecomm.RemoteConnection, int);
method public void onStatusHintsChanged(android.telecomm.RemoteConnection, android.telecomm.StatusHints);
}
@@ -28471,9 +28476,10 @@
method public void addNewIncomingCall(android.telecomm.PhoneAccountHandle, android.os.Bundle);
method public void cancelMissedCallsNotification();
method public void clearAccounts(java.lang.String);
- method public android.telecomm.PhoneAccountHandle getDefaultOutgoingPhoneAccount();
+ method public android.telecomm.PhoneAccountHandle getDefaultOutgoingPhoneAccount(java.lang.String);
method public java.util.List<android.telecomm.PhoneAccountHandle> getEnabledPhoneAccounts();
method public android.telecomm.PhoneAccount getPhoneAccount(android.telecomm.PhoneAccountHandle);
+ method public java.util.List<android.telecomm.PhoneAccountHandle> getPhoneAccountsSupportingScheme(java.lang.String);
method public boolean handleMmi(java.lang.String);
method public boolean hasMultipleEnabledAccounts();
method public boolean isInCall();
@@ -28859,7 +28865,7 @@
method public boolean getAutoPersisting();
method public android.os.Bundle getCarrierConfigValues();
method public static android.telephony.SmsManager getDefault();
- method public static android.telephony.SmsManager getSmsManagerForSubId(long);
+ method public static android.telephony.SmsManager getSmsManagerUsingSubId(long);
method public long getSubId();
method public android.net.Uri importMultimediaMessage(android.net.Uri, java.lang.String, long, boolean, boolean);
method public android.net.Uri importTextMessage(java.lang.String, int, java.lang.String, long, boolean, boolean);
@@ -32917,6 +32923,7 @@
field public static final int KEYCODE_GUIDE = 172; // 0xac
field public static final int KEYCODE_H = 36; // 0x24
field public static final int KEYCODE_HEADSETHOOK = 79; // 0x4f
+ field public static final int KEYCODE_HELP = 259; // 0x103
field public static final int KEYCODE_HENKAN = 214; // 0xd6
field public static final int KEYCODE_HOME = 3; // 0x3
field public static final int KEYCODE_I = 37; // 0x25
@@ -33017,9 +33024,36 @@
field public static final int KEYCODE_T = 48; // 0x30
field public static final int KEYCODE_TAB = 61; // 0x3d
field public static final int KEYCODE_TV = 170; // 0xaa
+ field public static final int KEYCODE_TV_ANTENNA_CABLE = 242; // 0xf2
+ field public static final int KEYCODE_TV_AUDIO_DESCRIPTION = 252; // 0xfc
+ field public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN = 254; // 0xfe
+ field public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP = 253; // 0xfd
+ field public static final int KEYCODE_TV_CONTENTS_MENU = 256; // 0x100
field public static final int KEYCODE_TV_DATA_SERVICE = 230; // 0xe6
field public static final int KEYCODE_TV_INPUT = 178; // 0xb2
+ field public static final int KEYCODE_TV_INPUT_COMPONENT_1 = 249; // 0xf9
+ field public static final int KEYCODE_TV_INPUT_COMPONENT_2 = 250; // 0xfa
+ field public static final int KEYCODE_TV_INPUT_COMPOSITE_1 = 247; // 0xf7
+ field public static final int KEYCODE_TV_INPUT_COMPOSITE_2 = 248; // 0xf8
+ field public static final int KEYCODE_TV_INPUT_HDMI_1 = 243; // 0xf3
+ field public static final int KEYCODE_TV_INPUT_HDMI_2 = 244; // 0xf4
+ field public static final int KEYCODE_TV_INPUT_HDMI_3 = 245; // 0xf5
+ field public static final int KEYCODE_TV_INPUT_HDMI_4 = 246; // 0xf6
+ field public static final int KEYCODE_TV_INPUT_VGA_1 = 251; // 0xfb
+ field public static final int KEYCODE_TV_MEDIA_CONTEXT_MENU = 257; // 0x101
+ field public static final int KEYCODE_TV_NETWORK = 241; // 0xf1
+ field public static final int KEYCODE_TV_NUMBER_ENTRY = 234; // 0xea
field public static final int KEYCODE_TV_POWER = 177; // 0xb1
+ field public static final int KEYCODE_TV_RADIO_SERVICE = 232; // 0xe8
+ field public static final int KEYCODE_TV_SATELLITE = 237; // 0xed
+ field public static final int KEYCODE_TV_SATELLITE_BS = 238; // 0xee
+ field public static final int KEYCODE_TV_SATELLITE_CS = 239; // 0xef
+ field public static final int KEYCODE_TV_SATELLITE_SERVICE = 240; // 0xf0
+ field public static final int KEYCODE_TV_TELETEXT = 233; // 0xe9
+ field public static final int KEYCODE_TV_TERRESTRIAL_ANALOG = 235; // 0xeb
+ field public static final int KEYCODE_TV_TERRESTRIAL_DIGITAL = 236; // 0xec
+ field public static final int KEYCODE_TV_TIMER_PROGRAMMING = 258; // 0x102
+ field public static final int KEYCODE_TV_ZOOM_MODE = 255; // 0xff
field public static final int KEYCODE_U = 49; // 0x31
field public static final int KEYCODE_UNKNOWN = 0; // 0x0
field public static final int KEYCODE_V = 50; // 0x32
diff --git a/core/java/android/app/ActivityTransitionState.java b/core/java/android/app/ActivityTransitionState.java
index 613e248..ad4a22b 100644
--- a/core/java/android/app/ActivityTransitionState.java
+++ b/core/java/android/app/ActivityTransitionState.java
@@ -151,6 +151,7 @@
mEnterActivityOptions = options;
mIsEnterTriggered = false;
if (mEnterActivityOptions.isReturning()) {
+ restoreExitedViews();
int result = mEnterActivityOptions.getResultCode();
if (result != 0) {
activity.onActivityReenter(result, mEnterActivityOptions.getResultData());
diff --git a/core/java/android/app/EnterTransitionCoordinator.java b/core/java/android/app/EnterTransitionCoordinator.java
index 47d3fd6..4126647 100644
--- a/core/java/android/app/EnterTransitionCoordinator.java
+++ b/core/java/android/app/EnterTransitionCoordinator.java
@@ -170,7 +170,7 @@
private void sendSharedElementDestination() {
boolean allReady;
- if (allowOverlappingTransitions()) {
+ if (allowOverlappingTransitions() && getEnterViewsTransition() != null) {
allReady = false;
} else {
allReady = !getDecor().isLayoutRequested();
@@ -466,6 +466,7 @@
Drawable background = getDecor().getBackground();
if (background != null) {
background = background.mutate();
+ getWindow().setBackgroundDrawable(background);
mBackgroundAnimator = ObjectAnimator.ofInt(background, "alpha", 255);
mBackgroundAnimator.setDuration(getFadeDuration());
mBackgroundAnimator.addListener(new AnimatorListenerAdapter() {
diff --git a/core/java/android/app/ExitTransitionCoordinator.java b/core/java/android/app/ExitTransitionCoordinator.java
index 3760b96..231c93f 100644
--- a/core/java/android/app/ExitTransitionCoordinator.java
+++ b/core/java/android/app/ExitTransitionCoordinator.java
@@ -140,7 +140,8 @@
if (getDecor() != null) {
getDecor().suppressLayout(true);
}
- if (!mSharedElements.isEmpty() && getSharedElementTransition() != null) {
+ if (mExitSharedElementBundle != null && !mExitSharedElementBundle.isEmpty() &&
+ !mSharedElements.isEmpty() && getSharedElementTransition() != null) {
startTransition(new Runnable() {
public void run() {
startSharedElementExit();
@@ -259,6 +260,8 @@
ViewGroup decor = getDecor();
Drawable background;
if (decor != null && (background = decor.getBackground()) != null) {
+ background = background.mutate();
+ getWindow().setBackgroundDrawable(background);
mBackgroundAnimator = ObjectAnimator.ofInt(background, "alpha", 0);
mBackgroundAnimator.addListener(new AnimatorListenerAdapter() {
@Override
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 9ed8960..282444a 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -115,13 +115,14 @@
= "android.app.action.ACTION_PROVISION_MANAGED_PROFILE";
/**
- * A {@link Parcelable} extra of type {@link PersistableBundle} that allows a mobile device
- * management application that starts managed profile provisioning to pass data to itself on the
- * managed profile when provisioning completes. The mobile device management application sends
- * this extra in an intent with the action {@link #ACTION_PROVISION_MANAGED_PROFILE} and
- * receives it in {@link DeviceAdminReceiver#onProfileProvisioningComplete} via an intent with
- * the action {@link DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE}. The bundle is
- * not changed during the managed profile provisioning.
+ * A {@link android.os.Parcelable} extra of type {@link android.os.PersistableBundle} that allows
+ * a mobile device management application that starts managed profile provisioning to pass data
+ * to itself on the managed profile when provisioning completes. The mobile device management
+ * application sends this extra in an intent with the action
+ * {@link #ACTION_PROVISION_MANAGED_PROFILE} and receives it in
+ * {@link DeviceAdminReceiver#onProfileProvisioningComplete} via an intent with the action
+ * {@link DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE}. The bundle is not changed
+ * during the managed profile provisioning.
*/
public static final String EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE =
"android.app.extra.ADMIN_EXTRA_BUNDLE";
@@ -1785,16 +1786,24 @@
* If a user has installed any certificates by other means than device policy these will be
* included too.
*
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
* @return a List of byte[] arrays, each encoding one user CA certificate.
*/
- public List<byte[]> getInstalledCaCerts() {
- final TrustedCertificateStore certStore = new TrustedCertificateStore();
+ public List<byte[]> getInstalledCaCerts(ComponentName admin) {
List<byte[]> certs = new ArrayList<byte[]>();
- for (String alias : certStore.userAliases()) {
+ if (mService != null) {
try {
- certs.add(certStore.getCertificate(alias).getEncoded());
- } catch (CertificateException ce) {
- Log.w(TAG, "Could not encode certificate: " + alias, ce);
+ mService.enforceCanManageCaCerts(admin);
+ final TrustedCertificateStore certStore = new TrustedCertificateStore();
+ for (String alias : certStore.userAliases()) {
+ try {
+ certs.add(certStore.getCertificate(alias).getEncoded());
+ } catch (CertificateException ce) {
+ Log.w(TAG, "Could not encode certificate: " + alias, ce);
+ }
+ }
+ } catch (RemoteException re) {
+ Log.w(TAG, "Failed talking with device policy service", re);
}
}
return certs;
@@ -1821,13 +1830,19 @@
/**
* Returns whether this certificate is installed as a trusted CA.
*
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
* @param certBuffer encoded form of the certificate to look up.
*/
- public boolean hasCaCertInstalled(byte[] certBuffer) {
- try {
- return getCaCertAlias(certBuffer) != null;
- } catch (CertificateException ce) {
- Log.w(TAG, "Could not parse certificate", ce);
+ public boolean hasCaCertInstalled(ComponentName admin, byte[] certBuffer) {
+ if (mService != null) {
+ try {
+ mService.enforceCanManageCaCerts(admin);
+ return getCaCertAlias(certBuffer) != null;
+ } catch (RemoteException re) {
+ Log.w(TAG, "Failed talking with device policy service", re);
+ } catch (CertificateException ce) {
+ Log.w(TAG, "Could not parse certificate", ce);
+ }
}
return false;
}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index c984cf9..57d8b95 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -124,6 +124,7 @@
boolean installCaCert(in ComponentName admin, in byte[] certBuffer);
void uninstallCaCert(in ComponentName admin, in String alias);
+ void enforceCanManageCaCerts(in ComponentName admin);
void addPersistentPreferredActivity(in ComponentName admin, in IntentFilter filter, in ComponentName activity);
void clearPackagePersistentPreferredActivities(in ComponentName admin, String packageName);
diff --git a/core/java/android/app/job/JobScheduler.java b/core/java/android/app/job/JobScheduler.java
index ca7022d..5edc2a0 100644
--- a/core/java/android/app/job/JobScheduler.java
+++ b/core/java/android/app/job/JobScheduler.java
@@ -21,14 +21,23 @@
import android.content.Context;
/**
- * Class for scheduling various types of jobs with the scheduling framework on the device.
+ * This is an API for scheduling various types of jobs against the framework that will be executed
+ * in your application's own process.
+ * <p>
* See {@link android.app.job.JobInfo} for more description of the types of jobs that can be run
- * and how to construct them.
+ * and how to construct them. You will construct these JobInfo objects and pass them to the
+ * JobScheduler with {@link #schedule(JobInfo)}. When the criteria declared are met, the
+ * system will execute this job on your application's {@link android.app.job.JobService}.
+ * You identify which JobService is meant to execute the logic for your job when you create the
+ * JobInfo with {@link android.app.job.JobInfo.Builder#Builder(int, android.content.ComponentName)}.
+ * </p>
+ * <p>
* The framework will be intelligent about when you receive your callbacks, and attempt to batch
* and defer them as much as possible. Typically if you don't specify a deadline on your job, it
* can be run at any moment depending on the current state of the JobScheduler's internal queue,
* however it might be deferred as long as until the next time the device is connected to a power
* source.
+ * </p>
* <p>You do not
* instantiate this class directly; instead, retrieve it through
* {@link android.content.Context#getSystemService
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java
index b98e5ae..36997e5 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -375,6 +375,14 @@
} // else ASSERT(mPort == channel)
ret = 0;
} catch (IOException e) {
+ if (mPfd != null) {
+ try {
+ mPfd.close();
+ } catch (IOException e1) {
+ Log.e(TAG, "bindListen, close mPfd: " + e1);
+ }
+ mPfd = null;
+ }
Log.e(TAG, "bindListen, fail to get port number, exception: " + e);
return -1;
}
diff --git a/core/java/android/transition/ChangeTransform.java b/core/java/android/transition/ChangeTransform.java
index d579f54..cb0a875 100644
--- a/core/java/android/transition/ChangeTransform.java
+++ b/core/java/android/transition/ChangeTransform.java
@@ -45,6 +45,10 @@
private static final String PROPNAME_TRANSFORMS = "android:changeTransform:transforms";
private static final String PROPNAME_PARENT = "android:changeTransform:parent";
private static final String PROPNAME_PARENT_MATRIX = "android:changeTransform:parentMatrix";
+ private static final String PROPNAME_INTERMEDIATE_PARENT_MATRIX =
+ "android:changeTransform:intermediateParentMatrix";
+ private static final String PROPNAME_INTERMEDIATE_MATRIX =
+ "android:changeTransform:intermediateMatrix";
private static final String[] sTransitionProperties = {
PROPNAME_MATRIX,
@@ -172,6 +176,10 @@
parent.transformMatrixToGlobal(parentMatrix);
parentMatrix.preTranslate(-parent.getScrollX(), -parent.getScrollY());
transitionValues.values.put(PROPNAME_PARENT_MATRIX, parentMatrix);
+ transitionValues.values.put(PROPNAME_INTERMEDIATE_MATRIX,
+ view.getTag(R.id.transitionTransform));
+ transitionValues.values.put(PROPNAME_INTERMEDIATE_PARENT_MATRIX,
+ view.getTag(R.id.parentMatrix));
}
return;
}
@@ -199,12 +207,13 @@
ViewGroup endParent = (ViewGroup) endValues.values.get(PROPNAME_PARENT);
boolean handleParentChange = mReparent && !parentsMatch(startParent, endParent);
- Matrix startMatrix = (Matrix) startValues.view.getTag(R.id.transitionTransform);
+ Matrix startMatrix = (Matrix) startValues.values.get(PROPNAME_INTERMEDIATE_MATRIX);
if (startMatrix != null) {
startValues.values.put(PROPNAME_MATRIX, startMatrix);
}
- Matrix startParentMatrix = (Matrix) startValues.view.getTag(R.id.parentMatrix);
+ Matrix startParentMatrix = (Matrix)
+ startValues.values.get(PROPNAME_INTERMEDIATE_PARENT_MATRIX);
if (startParentMatrix != null) {
startValues.values.put(PROPNAME_PARENT_MATRIX, startParentMatrix);
}
@@ -250,9 +259,11 @@
ObjectAnimator animator = ObjectAnimator.ofObject(view, ANIMATION_MATRIX_PROPERTY,
new TransitionUtils.MatrixEvaluator(), startMatrix, endMatrix);
+ final Matrix finalEndMatrix = endMatrix;
+
AnimatorListenerAdapter listener = new AnimatorListenerAdapter() {
private boolean mIsCanceled;
- private Matrix mTempMatrix;
+ private Matrix mTempMatrix = new Matrix();
@Override
public void onAnimationCancel(Animator animation) {
@@ -262,8 +273,7 @@
@Override
public void onAnimationEnd(Animator animation) {
if (!mIsCanceled) {
- view.setTagInternal(R.id.transitionTransform, null);
- view.setTagInternal(R.id.parentMatrix, null);
+ setCurrentMatrix(finalEndMatrix);
}
ANIMATION_MATRIX_PROPERTY.set(view, null);
transforms.restore(view);
@@ -273,19 +283,19 @@
public void onAnimationPause(Animator animation) {
ValueAnimator animator = (ValueAnimator) animation;
Matrix currentMatrix = (Matrix) animator.getAnimatedValue();
- if (mTempMatrix == null) {
- mTempMatrix = new Matrix(currentMatrix);
- } else {
- mTempMatrix.set(currentMatrix);
- }
- view.setTagInternal(R.id.transitionTransform, mTempMatrix);
- transforms.restore(view);
+ setCurrentMatrix(currentMatrix);
}
@Override
public void onAnimationResume(Animator animation) {
setIdentityTransforms(view);
}
+
+ private void setCurrentMatrix(Matrix currentMatrix) {
+ mTempMatrix.set(currentMatrix);
+ view.setTagInternal(R.id.transitionTransform, mTempMatrix);
+ transforms.restore(view);
+ }
};
animator.addListener(listener);
@@ -423,6 +433,8 @@
public void onTransitionEnd(Transition transition) {
transition.removeListener(this);
GhostView.removeGhost(mView);
+ mView.setTagInternal(R.id.transitionTransform, null);
+ mView.setTagInternal(R.id.parentMatrix, null);
}
@Override
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index 964b054..0701b53 100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -660,8 +660,96 @@
/** Key code constant: Voice Assist key.
* Launches the global voice assist activity. Not delivered to applications. */
public static final int KEYCODE_VOICE_ASSIST = 231;
+ /** Key code constant: Radio key.
+ * Toggles TV service / Radio service. */
+ public static final int KEYCODE_TV_RADIO_SERVICE = 232;
+ /** Key code constant: Teletext key.
+ * Displays Teletext service. */
+ public static final int KEYCODE_TV_TELETEXT = 233;
+ /** Key code constant: Number entry key.
+ * Initiates to enter multi-digit channel nubmber when each digit key is assigned
+ * for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC
+ * User Control Code. */
+ public static final int KEYCODE_TV_NUMBER_ENTRY = 234;
+ /** Key code constant: Analog Terrestrial key.
+ * Switches to analog terrestrial broadcast service. */
+ public static final int KEYCODE_TV_TERRESTRIAL_ANALOG = 235;
+ /** Key code constant: Digital Terrestrial key.
+ * Switches to digital terrestrial broadcast service. */
+ public static final int KEYCODE_TV_TERRESTRIAL_DIGITAL = 236;
+ /** Key code constant: Satellite key.
+ * Switches to digital satellite broadcast service. */
+ public static final int KEYCODE_TV_SATELLITE = 237;
+ /** Key code constant: BS key.
+ * Switches to BS digital satellite broadcasting service available in Japan. */
+ public static final int KEYCODE_TV_SATELLITE_BS = 238;
+ /** Key code constant: CS key.
+ * Switches to CS digital satellite broadcasting service available in Japan. */
+ public static final int KEYCODE_TV_SATELLITE_CS = 239;
+ /** Key code constant: BS/CS key.
+ * Toggles between BS and CS digital satellite services. */
+ public static final int KEYCODE_TV_SATELLITE_SERVICE = 240;
+ /** Key code constant: Toggle Network key.
+ * Toggles selecting broacast services. */
+ public static final int KEYCODE_TV_NETWORK = 241;
+ /** Key code constant: Antenna/Cable key.
+ * Toggles broadcast input source between antenna and cable. */
+ public static final int KEYCODE_TV_ANTENNA_CABLE = 242;
+ /** Key code constant: HDMI #1 key.
+ * Switches to HDMI input #1. */
+ public static final int KEYCODE_TV_INPUT_HDMI_1 = 243;
+ /** Key code constant: HDMI #2 key.
+ * Switches to HDMI input #2. */
+ public static final int KEYCODE_TV_INPUT_HDMI_2 = 244;
+ /** Key code constant: HDMI #3 key.
+ * Switches to HDMI input #3. */
+ public static final int KEYCODE_TV_INPUT_HDMI_3 = 245;
+ /** Key code constant: HDMI #4 key.
+ * Switches to HDMI input #4. */
+ public static final int KEYCODE_TV_INPUT_HDMI_4 = 246;
+ /** Key code constant: Composite #1 key.
+ * Switches to composite video input #1. */
+ public static final int KEYCODE_TV_INPUT_COMPOSITE_1 = 247;
+ /** Key code constant: Composite #2 key.
+ * Switches to composite video input #2. */
+ public static final int KEYCODE_TV_INPUT_COMPOSITE_2 = 248;
+ /** Key code constant: Component #1 key.
+ * Switches to component video input #1. */
+ public static final int KEYCODE_TV_INPUT_COMPONENT_1 = 249;
+ /** Key code constant: Component #2 key.
+ * Switches to component video input #2. */
+ public static final int KEYCODE_TV_INPUT_COMPONENT_2 = 250;
+ /** Key code constant: VGA #1 key.
+ * Switches to VGA (analog RGB) input #1. */
+ public static final int KEYCODE_TV_INPUT_VGA_1 = 251;
+ /** Key code constant: Audio description key.
+ * Toggles audio description off / on. */
+ public static final int KEYCODE_TV_AUDIO_DESCRIPTION = 252;
+ /** Key code constant: Audio description mixing volume up key.
+ * Louden audio description volume as compared with normal audio volume. */
+ public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP = 253;
+ /** Key code constant: Audio description mixing volume down key.
+ * Lessen audio description volume as compared with normal audio volume. */
+ public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN = 254;
+ /** Key code constant: Zoom mode key.
+ * Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.) */
+ public static final int KEYCODE_TV_ZOOM_MODE = 255;
+ /** Key code constant: Contents menu key.
+ * Goes to the title list. Corresponds to Contents Menu (0x0B) of CEC User Control
+ * Code */
+ public static final int KEYCODE_TV_CONTENTS_MENU = 256;
+ /** Key code constant: Media context menu key.
+ * Goes to the context menu of media contents. Corresponds to Media Context-sensitive
+ * Menu (0x11) of CEC User Control Code. */
+ public static final int KEYCODE_TV_MEDIA_CONTEXT_MENU = 257;
+ /** Key code constant: Timer programming key.
+ * Goes to the timer recording menu. Corresponds to Timer Programming (0x54) of
+ * CEC User Control Code. */
+ public static final int KEYCODE_TV_TIMER_PROGRAMMING = 258;
+ /** Key code constant: Help key. */
+ public static final int KEYCODE_HELP = 259;
- private static final int LAST_KEYCODE = KEYCODE_VOICE_ASSIST;
+ private static final int LAST_KEYCODE = KEYCODE_HELP;
// NOTE: If you add a new keycode here you must also add it to:
// isSystem()
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index ca08ecc..5d2822d 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -126,7 +126,7 @@
void destroy() {
mInitialized = false;
updateEnabledState(null);
- nDestroyCanvasAndSurface(mNativeProxy);
+ nDestroy(mNativeProxy);
}
private void updateEnabledState(Surface surface) {
@@ -488,7 +488,7 @@
private static native void nSetOpaque(long nativeProxy, boolean opaque);
private static native int nSyncAndDrawFrame(long nativeProxy,
long frameTimeNanos, long recordDuration, float density);
- private static native void nDestroyCanvasAndSurface(long nativeProxy);
+ private static native void nDestroy(long nativeProxy);
private static native void nRegisterAnimatingRenderNode(long rootRenderNode, long animatingNode);
private static native void nInvokeFunctor(long functor, boolean waitForCompletion);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index fce6f0b..21e7c6b 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4908,36 +4908,11 @@
}
onFocusChanged(true, direction, previouslyFocusedRect);
- manageFocusHotspot(true, oldFocus);
refreshDrawableState();
}
}
/**
- * Forwards focus information to the background drawable, if necessary. When
- * the view is gaining focus, <code>v</code> is the previous focus holder.
- * When the view is losing focus, <code>v</code> is the next focus holder.
- *
- * @param focused whether this view is focused
- * @param v previous or the next focus holder, or null if none
- */
- private void manageFocusHotspot(boolean focused, View v) {
- final Rect r = new Rect();
- if (v != null && mAttachInfo != null) {
- v.getHotspotBounds(r);
- final int[] location = mAttachInfo.mTmpLocation;
- getLocationOnScreen(location);
- r.offset(-location[0], -location[1]);
- } else {
- r.set(0, 0, mRight - mLeft, mBottom - mTop);
- }
-
- final float x = r.exactCenterX();
- final float y = r.exactCenterY();
- drawableHotspotChanged(x, y);
- }
-
- /**
* Populates <code>outRect</code> with the hotspot bounds. By default,
* the hotspot bounds are identical to the screen bounds.
*
@@ -5060,8 +5035,6 @@
}
onFocusChanged(false, 0, null);
-
- manageFocusHotspot(false, focused);
refreshDrawableState();
if (propagate && (!refocus || !rootViewRequestFocus())) {
diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp
index 99babac..6ec6b00 100644
--- a/core/jni/android_view_ThreadedRenderer.cpp
+++ b/core/jni/android_view_ThreadedRenderer.cpp
@@ -291,10 +291,10 @@
return proxy->syncAndDrawFrame(frameTimeNanos, recordDuration, density);
}
-static void android_view_ThreadedRenderer_destroyCanvasAndSurface(JNIEnv* env, jobject clazz,
+static void android_view_ThreadedRenderer_destroy(JNIEnv* env, jobject clazz,
jlong proxyPtr) {
RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
- proxy->destroyCanvasAndSurface();
+ proxy->destroy();
}
static void android_view_ThreadedRenderer_registerAnimatingRenderNode(JNIEnv* env, jobject clazz,
@@ -430,7 +430,7 @@
{ "nSetup", "(JIIFFFFII)V", (void*) android_view_ThreadedRenderer_setup },
{ "nSetOpaque", "(JZ)V", (void*) android_view_ThreadedRenderer_setOpaque },
{ "nSyncAndDrawFrame", "(JJJF)I", (void*) android_view_ThreadedRenderer_syncAndDrawFrame },
- { "nDestroyCanvasAndSurface", "(J)V", (void*) android_view_ThreadedRenderer_destroyCanvasAndSurface },
+ { "nDestroy", "(J)V", (void*) android_view_ThreadedRenderer_destroy },
{ "nRegisterAnimatingRenderNode", "(JJ)V", (void*) android_view_ThreadedRenderer_registerAnimatingRenderNode },
{ "nInvokeFunctor", "(JZ)V", (void*) android_view_ThreadedRenderer_invokeFunctor },
{ "nCreateDisplayListLayer", "(JII)J", (void*) android_view_ThreadedRenderer_createDisplayListLayer },
diff --git a/core/res/res/values-mcc310-mnc004/config.xml b/core/res/res/values-mcc310-mnc004/config.xml
index 423e250..2778b6e 100644
--- a/core/res/res/values-mcc310-mnc004/config.xml
+++ b/core/res/res/values-mcc310-mnc004/config.xml
@@ -34,4 +34,11 @@
</string-array>
<bool name="config_auto_attach_data_on_creation">false</bool>
+
+ <!-- Values for GPS configuration (Verizon) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>CAPABILITIES=0x31</item>
+ <item>LPP_PROFILE=3</item>
+ <item>GPS_LOCK=3</item>
+ </string-array>
</resources>
diff --git a/core/res/res/values-mcc310-mnc120/config.xml b/core/res/res/values-mcc310-mnc120/config.xml
index 62001d9..3b95db5 100644
--- a/core/res/res/values-mcc310-mnc120/config.xml
+++ b/core/res/res/values-mcc310-mnc120/config.xml
@@ -25,4 +25,10 @@
-->
<integer name="config_mobile_mtu">1422</integer>
+ <!-- Values for GPS configuration (Sprint) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>CAPABILITIES=0x31</item>
+ <item>GPS_LOCK=3</item>
+ <item>LPP_PROFILE=2</item>
+ </string-array>
</resources>
diff --git a/core/res/res/values-mcc310-mnc150/config.xml b/core/res/res/values-mcc310-mnc150/config.xml
index f1936f4..00d2db8 100644
--- a/core/res/res/values-mcc310-mnc150/config.xml
+++ b/core/res/res/values-mcc310-mnc150/config.xml
@@ -33,4 +33,10 @@
<item>315</item>
<item>316</item>
</string-array>
+ <!-- Values for GPS configuration (AT&T) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>CAPABILITIES=0x33</item>
+ <item>LPP_PROFILE=3</item>
+ <item>GPS_LOCK=1</item>
+ </string-array>
</resources>
diff --git a/core/res/res/values-mcc310-mnc260/config.xml b/core/res/res/values-mcc310-mnc260/config.xml
index 00cdaeb..2f9394a 100644
--- a/core/res/res/values-mcc310-mnc260/config.xml
+++ b/core/res/res/values-mcc310-mnc260/config.xml
@@ -25,9 +25,10 @@
-->
<integer name="config_mobile_mtu">1440</integer>
- <!-- Values for GPS configuration -->
+ <!-- Values for GPS configuration (T-Mobile) -->
<string-array translatable="false" name="config_gpsParameters">
- <item>"SUPL_PORT=7279"</item>
+ <item>CAPABILITEIS=0x33</item>
<item>GPS_LOCK=1</item>
+ <item>LPP_PROFILE=2</item>
</string-array>
</resources>
diff --git a/core/res/res/values-mcc310-mnc410/config.xml b/core/res/res/values-mcc310-mnc410/config.xml
index 9e63047..8069d13 100644
--- a/core/res/res/values-mcc310-mnc410/config.xml
+++ b/core/res/res/values-mcc310-mnc410/config.xml
@@ -40,8 +40,10 @@
<item>315</item>
<item>316</item>
</string-array>
- <!-- Values for GPS configuration -->
+ <!-- Values for GPS configuration (AT&T) -->
<string-array translatable="false" name="config_gpsParameters">
- <item>"SUPL_HOST=supl.google.com"</item>
+ <item>CAPABILITIES=0x33</item>
+ <item>GPS_LOCK=1</item>
+ <item>LPP_PROFILE=3</item>
</string-array>
</resources>
diff --git a/core/res/res/values-mcc311-mnc190/config.xml b/core/res/res/values-mcc311-mnc190/config.xml
index a6c4d1b..b4e436d 100644
--- a/core/res/res/values-mcc311-mnc190/config.xml
+++ b/core/res/res/values-mcc311-mnc190/config.xml
@@ -37,4 +37,11 @@
note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
<string translatable="false" name="config_tether_apndata">Tether,broadband.cellular1.net,,,,,,,,,311,190,,DUN</string>
+ <!-- Values for GPS configuration (Sprint) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>CAPABILITIES=0x31</item>
+ <item>GPS_LOCK=3</item>
+ <item>LPP_PROFILE=2</item>
+ </string-array>
+
</resources>
diff --git a/core/res/res/values-mcc311-mnc480/config.xml b/core/res/res/values-mcc311-mnc480/config.xml
index e5af60b..cd5d55b 100644
--- a/core/res/res/values-mcc311-mnc480/config.xml
+++ b/core/res/res/values-mcc311-mnc480/config.xml
@@ -44,4 +44,11 @@
<bool name="config_mobile_allow_volte_vt">false</bool>
<bool name="config_auto_attach_data_on_creation">false</bool>
+
+ <!-- Values for GPS configuration (Verizon) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>CAPABILITIES=0x31</item>
+ <item>GPS_LOCK=3</item>
+ <item>LPP_PROFILE=3</item>
+ </string-array>
</resources>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 9b1b7ed..3628355 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1726,6 +1726,34 @@
<enum name="KEYCODE_LAST_CHANNEL" value="229" />
<enum name="KEYCODE_TV_DATA_SERVICE" value="230" />
<enum name="KEYCODE_VOICE_ASSIST" value="231" />
+ <enum name="KEYCODE_TV_RADIO_SERVICE" value="232" />
+ <enum name="KEYCODE_TV_TELETEXT" value="233" />
+ <enum name="KEYCODE_TV_NUMBER_ENTRY" value="234" />
+ <enum name="KEYCODE_TV_TERRESTRIAL_ANALOG" value="235" />
+ <enum name="KEYCODE_TV_TERRESTRIAL_DIGITAL" value="236" />
+ <enum name="KEYCODE_TV_SATELLITE" value="237" />
+ <enum name="KEYCODE_TV_SATELLITE_BS" value="238" />
+ <enum name="KEYCODE_TV_SATELLITE_CS" value="239" />
+ <enum name="KEYCODE_TV_SATELLITE_SERVICE" value="240" />
+ <enum name="KEYCODE_TV_NETWORK" value="241" />
+ <enum name="KEYCODE_TV_ANTENNA_CABLE" value="242" />
+ <enum name="KEYCODE_TV_INPUT_HDMI_1" value="243" />
+ <enum name="KEYCODE_TV_INPUT_HDMI_2" value="244" />
+ <enum name="KEYCODE_TV_INPUT_HDMI_3" value="245" />
+ <enum name="KEYCODE_TV_INPUT_HDMI_4" value="246" />
+ <enum name="KEYCODE_TV_INPUT_COMPOSITE_1" value="247" />
+ <enum name="KEYCODE_TV_INPUT_COMPOSITE_2" value="248" />
+ <enum name="KEYCODE_TV_INPUT_COMPONENT_1" value="249" />
+ <enum name="KEYCODE_TV_INPUT_COMPONENT_2" value="250" />
+ <enum name="KEYCODE_TV_INPUT_VGA_1" value="251" />
+ <enum name="KEYCODE_TV_AUDIO_DESCRIPTION" value="252" />
+ <enum name="KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP" value="253" />
+ <enum name="KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN" value="254" />
+ <enum name="KEYCODE_TV_ZOOM_MODE" value="255" />
+ <enum name="KEYCODE_TV_CONTENTS_MENU" value="256" />
+ <enum name="KEYCODE_TV_MEDIA_CONTEXT_MENU" value="257" />
+ <enum name="KEYCODE_TV_TIMER_PROGRAMMING" value="258" />
+ <enum name="KEYCODE_HELP" value="259" />
</attr>
<!-- ***************************************************************** -->
diff --git a/graphics/java/android/graphics/drawable/RippleBackground.java b/graphics/java/android/graphics/drawable/RippleBackground.java
index ab43e01..4e68a60 100644
--- a/graphics/java/android/graphics/drawable/RippleBackground.java
+++ b/graphics/java/android/graphics/drawable/RippleBackground.java
@@ -37,10 +37,8 @@
*/
class RippleBackground {
private static final TimeInterpolator LINEAR_INTERPOLATOR = new LinearInterpolator();
- private static final TimeInterpolator DECEL_INTERPOLATOR = new LogInterpolator();
private static final float GLOBAL_SPEED = 1.0f;
- private static final float WAVE_TOUCH_DOWN_ACCELERATION = 1024.0f * GLOBAL_SPEED;
private static final float WAVE_OPACITY_DECAY_VELOCITY = 3.0f / GLOBAL_SPEED;
private static final float WAVE_OUTER_OPACITY_EXIT_VELOCITY_MAX = 4.5f * GLOBAL_SPEED;
private static final float WAVE_OUTER_OPACITY_EXIT_VELOCITY_MIN = 1.5f * GLOBAL_SPEED;
@@ -70,11 +68,6 @@
/** Screen density used to adjust pixel-based velocities. */
private float mDensity;
- private float mStartingX;
- private float mStartingY;
- private float mClampedStartingX;
- private float mClampedStartingY;
-
// Hardware rendering properties.
private CanvasProperty<Paint> mPropOuterPaint;
private CanvasProperty<Float> mPropOuterRadius;
@@ -83,8 +76,6 @@
// Software animators.
private ObjectAnimator mAnimOuterOpacity;
- private ObjectAnimator mAnimX;
- private ObjectAnimator mAnimY;
// Temporary paint used for creating canvas properties.
private Paint mTempPaint;
@@ -94,10 +85,6 @@
private float mOuterX;
private float mOuterY;
- // Values used to tween between the start and end positions.
- private float mTweenX = 0;
- private float mTweenY = 0;
-
/** Whether we should be drawing hardware animations. */
private boolean mHardwareAnimating;
@@ -110,12 +97,9 @@
/**
* Creates a new ripple.
*/
- public RippleBackground(RippleDrawable owner, Rect bounds, float startingX, float startingY) {
+ public RippleBackground(RippleDrawable owner, Rect bounds) {
mOwner = owner;
mBounds = bounds;
-
- mStartingX = startingX;
- mStartingY = startingY;
}
public void setup(int maxRadius, int color, float density) {
@@ -133,25 +117,6 @@
mOuterX = 0;
mOuterY = 0;
mDensity = density;
-
- clampStartingPosition();
- }
-
- private void clampStartingPosition() {
- final float cX = mBounds.exactCenterX();
- final float cY = mBounds.exactCenterY();
- final float dX = mStartingX - cX;
- final float dY = mStartingY - cY;
- final float r = mOuterRadius;
- if (dX * dX + dY * dY > r * r) {
- // Point is outside the circle, clamp to the circumference.
- final double angle = Math.atan2(dY, dX);
- mClampedStartingX = cX + (float) (Math.cos(angle) * r);
- mClampedStartingY = cY + (float) (Math.sin(angle) * r);
- } else {
- mClampedStartingX = mStartingX;
- mClampedStartingY = mStartingY;
- }
}
public void onHotspotBoundsChanged() {
@@ -159,8 +124,6 @@
final float halfWidth = mBounds.width() / 2.0f;
final float halfHeight = mBounds.height() / 2.0f;
mOuterRadius = (float) Math.sqrt(halfWidth * halfWidth + halfHeight * halfHeight);
-
- clampStartingPosition();
}
}
@@ -175,28 +138,6 @@
return mOuterOpacity;
}
- @SuppressWarnings("unused")
- public void setXGravity(float x) {
- mTweenX = x;
- invalidateSelf();
- }
-
- @SuppressWarnings("unused")
- public float getXGravity() {
- return mTweenX;
- }
-
- @SuppressWarnings("unused")
- public void setYGravity(float y) {
- mTweenY = y;
- invalidateSelf();
- }
-
- @SuppressWarnings("unused")
- public float getYGravity() {
- return mTweenY;
- }
-
/**
* Draws the ripple centered at (0,0) using the specified paint.
*/
@@ -270,53 +211,23 @@
}
/**
- * Specifies the starting position relative to the drawable bounds. No-op if
- * the ripple has already entered.
- */
- public void move(float x, float y) {
- mStartingX = x;
- mStartingY = y;
-
- clampStartingPosition();
- }
-
- /**
* Starts the enter animation.
*/
public void enter() {
cancel();
- final int radiusDuration = (int)
- (1000 * Math.sqrt(mOuterRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5);
final int outerDuration = (int) (1000 * 1.0f / WAVE_OUTER_OPACITY_ENTER_VELOCITY);
-
- final ObjectAnimator cX = ObjectAnimator.ofFloat(this, "xGravity", 1);
- cX.setAutoCancel(true);
- cX.setDuration(radiusDuration);
- cX.setInterpolator(LINEAR_INTERPOLATOR);
- cX.setStartDelay(RIPPLE_ENTER_DELAY);
-
- final ObjectAnimator cY = ObjectAnimator.ofFloat(this, "yGravity", 1);
- cY.setAutoCancel(true);
- cY.setDuration(radiusDuration);
- cY.setInterpolator(LINEAR_INTERPOLATOR);
- cY.setStartDelay(RIPPLE_ENTER_DELAY);
-
final ObjectAnimator outer = ObjectAnimator.ofFloat(this, "outerOpacity", 0, 1);
outer.setAutoCancel(true);
outer.setDuration(outerDuration);
outer.setInterpolator(LINEAR_INTERPOLATOR);
mAnimOuterOpacity = outer;
- mAnimX = cX;
- mAnimY = cY;
// Enter animations always run on the UI thread, since it's unlikely
// that anything interesting is happening until the user lifts their
// finger.
outer.start();
- cX.start();
- cY.start();
}
/**
@@ -352,12 +263,6 @@
private void exitHardware(int opacityDuration, int outerInflection, int inflectionOpacity) {
mPendingAnimations.clear();
- // TODO: Adjust background by starting position.
- final float startX = MathUtils.lerp(
- mClampedStartingX - mBounds.exactCenterX(), mOuterX, mTweenX);
- final float startY = MathUtils.lerp(
- mClampedStartingY - mBounds.exactCenterY(), mOuterY, mTweenY);
-
final Paint outerPaint = getTempPaint();
outerPaint.setAntiAlias(true);
outerPaint.setColor(mColor);
@@ -422,14 +327,6 @@
if (mAnimOuterOpacity != null) {
mAnimOuterOpacity.end();
}
-
- if (mAnimX != null) {
- mAnimX.end();
- }
-
- if (mAnimY != null) {
- mAnimY.end();
- }
}
private void endHardwareAnimations() {
@@ -457,16 +354,6 @@
}
private void exitSoftware(int opacityDuration, int outerInflection, int inflectionOpacity) {
- final ObjectAnimator xAnim = ObjectAnimator.ofFloat(this, "xGravity", 1);
- xAnim.setAutoCancel(true);
- xAnim.setDuration(opacityDuration);
- xAnim.setInterpolator(DECEL_INTERPOLATOR);
-
- final ObjectAnimator yAnim = ObjectAnimator.ofFloat(this, "yGravity", 1);
- yAnim.setAutoCancel(true);
- yAnim.setDuration(opacityDuration);
- yAnim.setInterpolator(DECEL_INTERPOLATOR);
-
final ObjectAnimator outerOpacityAnim;
if (outerInflection > 0) {
// Outer opacity continues to increase for a bit.
@@ -510,12 +397,8 @@
}
mAnimOuterOpacity = outerOpacityAnim;
- mAnimX = xAnim;
- mAnimY = yAnim;
outerOpacityAnim.start();
- xAnim.start();
- yAnim.start();
}
/**
@@ -531,14 +414,6 @@
if (mAnimOuterOpacity != null) {
mAnimOuterOpacity.cancel();
}
-
- if (mAnimX != null) {
- mAnimX.cancel();
- }
-
- if (mAnimY != null) {
- mAnimY.cancel();
- }
}
/**
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index e87a114..fa762b7 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -248,15 +248,14 @@
boolean pressed = false;
boolean focused = false;
- final int N = stateSet.length;
- for (int i = 0; i < N; i++) {
- if (stateSet[i] == R.attr.state_enabled) {
+ for (int state : stateSet) {
+ if (state == R.attr.state_enabled) {
enabled = true;
}
- if (stateSet[i] == R.attr.state_focused) {
+ if (state == R.attr.state_focused) {
focused = true;
}
- if (stateSet[i] == R.attr.state_pressed) {
+ if (state == R.attr.state_pressed) {
pressed = true;
}
}
@@ -478,10 +477,6 @@
if (mRipple != null) {
mRipple.move(x, y);
}
-
- if (mBackground != null) {
- mBackground.move(x, y);
- }
}
/**
@@ -489,17 +484,7 @@
*/
private void tryBackgroundEnter() {
if (mBackground == null) {
- final float x;
- final float y;
- if (mHasPending) {
- mHasPending = false;
- x = mPendingX;
- y = mPendingY;
- } else {
- x = mHotspotBounds.exactCenterX();
- y = mHotspotBounds.exactCenterY();
- }
- mBackground = new RippleBackground(this, mHotspotBounds, x, y);
+ mBackground = new RippleBackground(this, mHotspotBounds);
}
final int color = mState.mColor.getColorForState(getState(), Color.TRANSPARENT);
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 5689e17..9855f71 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -24,6 +24,7 @@
#include "Properties.h"
#include "LayerRenderer.h"
#include "ShadowTessellator.h"
+#include "RenderState.h"
namespace android {
@@ -49,7 +50,7 @@
///////////////////////////////////////////////////////////////////////////////
Caches::Caches(): Singleton<Caches>(),
- mExtensions(Extensions::getInstance()), mInitialized(false) {
+ mExtensions(Extensions::getInstance()), mInitialized(false), mRenderState(NULL) {
init();
initFont();
initConstraints();
@@ -267,8 +268,11 @@
log.appendFormat("Current memory usage / total memory usage (bytes):\n");
log.appendFormat(" TextureCache %8d / %8d\n",
textureCache.getSize(), textureCache.getMaxSize());
- log.appendFormat(" LayerCache %8d / %8d\n",
- layerCache.getSize(), layerCache.getMaxSize());
+ log.appendFormat(" LayerCache %8d / %8d (numLayers = %zu)\n",
+ layerCache.getSize(), layerCache.getMaxSize(), layerCache.getCount());
+ log.appendFormat(" Garbage layers %8zu\n", mLayerGarbage.size());
+ log.appendFormat(" Active layers %8zu\n",
+ mRenderState ? mRenderState->mActiveLayers.size() : 0);
log.appendFormat(" RenderBufferCache %8d / %8d\n",
renderBufferCache.getSize(), renderBufferCache.getMaxSize());
log.appendFormat(" GradientCache %8d / %8d\n",
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index 0482430..726b74d 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -107,6 +107,7 @@
///////////////////////////////////////////////////////////////////////////////
class RenderNode;
+class RenderState;
class ANDROID_API Caches: public Singleton<Caches> {
Caches();
@@ -132,6 +133,8 @@
*/
bool initProperties();
+ void setRenderState(RenderState* renderState) { mRenderState = renderState; }
+
/**
* Flush the cache.
*
@@ -431,6 +434,8 @@
GLuint mBoundTextures[REQUIRED_TEXTURE_UNITS_COUNT];
OverdrawColorSet mOverdrawDebugColorSet;
+
+ RenderState* mRenderState;
}; // class Caches
}; // namespace uirenderer
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 13869aa..efa30ac 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -49,6 +49,10 @@
// Size management
///////////////////////////////////////////////////////////////////////////////
+size_t LayerCache::getCount() {
+ return mCache.size();
+}
+
uint32_t LayerCache::getSize() {
return mSize;
}
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 1b0fc2c..6b93e8f 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -87,6 +87,8 @@
*/
uint32_t getSize();
+ size_t getCount();
+
/**
* Prints out the content of the cache.
*/
diff --git a/libs/hwui/RenderState.cpp b/libs/hwui/RenderState.cpp
index 50b8f39..9948b44 100644
--- a/libs/hwui/RenderState.cpp
+++ b/libs/hwui/RenderState.cpp
@@ -32,10 +32,14 @@
// This is delayed because the first access of Caches makes GL calls
mCaches = &Caches::getInstance();
mCaches->init();
+ mCaches->setRenderState(this);
}
void RenderState::onGLContextDestroyed() {
- LOG_ALWAYS_FATAL_IF(!mActiveLayers.empty(), "layers have survived gl context destruction");
+ if (CC_UNLIKELY(!mActiveLayers.empty())) {
+ mCaches->dumpMemoryUsage();
+ LOG_ALWAYS_FATAL("layers have survived gl context destruction");
+ }
}
void RenderState::setViewport(GLsizei width, GLsizei height) {
diff --git a/libs/hwui/RenderState.h b/libs/hwui/RenderState.h
index cd71c73..3915fb5 100644
--- a/libs/hwui/RenderState.h
+++ b/libs/hwui/RenderState.h
@@ -59,6 +59,7 @@
private:
friend class renderthread::RenderThread;
+ friend class Caches;
void interruptForFunctorInvoke();
void resumeFromFunctorInvoke();
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 0a17e13..967cb6f 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -51,13 +51,14 @@
}
CanvasContext::~CanvasContext() {
- destroyCanvasAndSurface();
- mRenderThread.removeFrameCallback(this);
+ destroy();
delete mAnimationContext;
- freePrefetechedLayers();
}
-void CanvasContext::destroyCanvasAndSurface() {
+void CanvasContext::destroy() {
+ stopDrawing();
+ freePrefetechedLayers();
+ destroyHardwareResources();
if (mCanvas) {
delete mCanvas;
mCanvas = 0;
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 7c27190..5984fd0 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -66,7 +66,7 @@
void processLayerUpdate(DeferredLayerUpdater* layerUpdater);
void prepareTree(TreeInfo& info);
void draw();
- void destroyCanvasAndSurface();
+ void destroy();
// IFrameCallback, Chroreographer-driven frame callback entry point
virtual void doFrame();
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 3d04316..9528874 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -194,13 +194,13 @@
return mDrawFrameTask.drawFrame(frameTimeNanos, recordDurationNanos);
}
-CREATE_BRIDGE1(destroyCanvasAndSurface, CanvasContext* context) {
- args->context->destroyCanvasAndSurface();
+CREATE_BRIDGE1(destroy, CanvasContext* context) {
+ args->context->destroy();
return NULL;
}
-void RenderProxy::destroyCanvasAndSurface() {
- SETUP_TASK(destroyCanvasAndSurface);
+void RenderProxy::destroy() {
+ SETUP_TASK(destroy);
args->context = mContext;
// destroyCanvasAndSurface() needs a fence as when it returns the
// underlying BufferQueue is going to be released from under
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 9e6bcf5..8b8d99c 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -73,7 +73,7 @@
ANDROID_API void setOpaque(bool opaque);
ANDROID_API int syncAndDrawFrame(nsecs_t frameTimeNanos, nsecs_t recordDurationNanos,
float density);
- ANDROID_API void destroyCanvasAndSurface();
+ ANDROID_API void destroy();
ANDROID_API static void invokeFunctor(Functor* functor, bool waitForCompletion);
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 1861bd7..f37cbe5 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -1286,7 +1286,7 @@
public int write(short[] audioData, int offsetInShorts, int sizeInShorts) {
- if (mState == STATE_UNINITIALIZED || mAudioFormat != AudioFormat.ENCODING_PCM_16BIT) {
+ if (mState == STATE_UNINITIALIZED || mAudioFormat == AudioFormat.ENCODING_PCM_FLOAT) {
return ERROR_INVALID_OPERATION;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 37bc7c0..dcd89ee 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1904,6 +1904,13 @@
}
protected boolean shouldInterrupt(StatusBarNotification sbn) {
+ if (mNotificationData.shouldFilterOut(sbn)) {
+ if (DEBUG) {
+ Log.d(TAG, "Skipping HUN check for " + sbn.getKey() + " since it's filtered out.");
+ }
+ return false;
+ }
+
Notification notification = sbn.getNotification();
// some predicates to make the boolean logic legible
boolean isNoisy = (notification.defaults & Notification.DEFAULT_SOUND) != 0
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 454041c..cef889c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -221,7 +221,7 @@
return mGroupsWithSummaries.contains(groupKey);
}
- private boolean shouldFilterOut(StatusBarNotification sbn) {
+ boolean shouldFilterOut(StatusBarNotification sbn) {
if (!(mEnvironment.isDeviceProvisioned() ||
showNotificationEvenIfUnprovisioned(sbn))) {
return true;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 008ec99..2e9df8a 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -8408,6 +8408,10 @@
synchronized(this) {
TaskRecord tr = recentTaskForIdLocked(taskId);
if (tr != null) {
+ if (tr == mStackSupervisor.mLockTaskModeTask) {
+ mStackSupervisor.showLockTaskToast();
+ return;
+ }
if (DEBUG_STACK) Slog.d(TAG, "moveTaskToBack: moving task=" + tr);
ActivityStack stack = tr.stack;
if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
@@ -8440,11 +8444,19 @@
enforceNotIsolatedCaller("moveActivityTaskToBack");
synchronized(this) {
final long origId = Binder.clearCallingIdentity();
- int taskId = ActivityRecord.getTaskForActivityLocked(token, !nonRoot);
- if (taskId >= 0) {
- return ActivityRecord.getStackLocked(token).moveTaskToBackLocked(taskId, null);
+ try {
+ int taskId = ActivityRecord.getTaskForActivityLocked(token, !nonRoot);
+ if (taskId >= 0) {
+ if ((mStackSupervisor.mLockTaskModeTask != null)
+ && (mStackSupervisor.mLockTaskModeTask.taskId == taskId)) {
+ mStackSupervisor.showLockTaskToast();
+ return false;
+ }
+ return ActivityRecord.getStackLocked(token).moveTaskToBackLocked(taskId, null);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(origId);
}
- Binder.restoreCallingIdentity(origId);
}
return false;
}
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 6bc1c9c..780efa1 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1262,7 +1262,7 @@
if (err == ActivityManager.START_SUCCESS) {
final int userId = aInfo != null ? UserHandle.getUserId(aInfo.applicationInfo.uid) : 0;
Slog.i(TAG, "START u" + userId + " {" + intent.toShortString(true, true, true, false)
- + "} from pid " + (callerApp != null ? callerApp.pid : callingPid)
+ + "} from uid " + callingUid
+ " on display " + (container == null ? (mFocusedStack == null ?
Display.DEFAULT_DISPLAY : mFocusedStack.mDisplayId) :
(container.mActivityDisplay == null ? Display.DEFAULT_DISPLAY :
@@ -2075,6 +2075,7 @@
}
targetStack = inTask.stack;
targetStack.moveTaskToFrontLocked(inTask, r, options);
+ targetStack.moveToFront();
mWindowManager.moveTaskToTop(inTask.taskId);
// Check whether we should actually launch the new activity in to the task,
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
index cedf573..ff319d3 100644
--- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java
+++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
@@ -16,6 +16,7 @@
package com.android.server.connectivity;
+import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -213,6 +214,7 @@
private final NetworkAgentInfo mNetworkAgentInfo;
private final TelephonyManager mTelephonyManager;
private final WifiManager mWifiManager;
+ private final AlarmManager mAlarmManager;
private String mServer;
private boolean mIsCaptivePortalCheckEnabled = false;
@@ -236,6 +238,7 @@
mNetworkAgentInfo = networkAgentInfo;
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+ mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
addState(mDefaultState);
addState(mOfflineState, mDefaultState);
@@ -500,10 +503,38 @@
}
private class LingeringState extends State {
+ private static final String ACTION_LINGER_EXPIRED = "android.net.netmon.lingerExpired";
+ private static final String EXTRA_NETID = "lingerExpiredNetId";
+ private static final String EXTRA_TOKEN = "lingerExpiredToken";
+
+ private class LingerExpiredBroadcastReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(ACTION_LINGER_EXPIRED) &&
+ Integer.parseInt(intent.getStringExtra(EXTRA_NETID)) ==
+ mNetworkAgentInfo.network.netId) {
+ sendMessage(CMD_LINGER_EXPIRED,
+ Integer.parseInt(intent.getStringExtra(EXTRA_TOKEN)));
+ }
+ }
+ }
+
+ private BroadcastReceiver mBroadcastReceiver;
+ private PendingIntent mIntent;
+
@Override
public void enter() {
- Message message = obtainMessage(CMD_LINGER_EXPIRED, ++mLingerToken, 0);
- sendMessageDelayed(message, mLingerDelayMs);
+ mBroadcastReceiver = new LingerExpiredBroadcastReceiver();
+ mContext.registerReceiver(mBroadcastReceiver, new IntentFilter(ACTION_LINGER_EXPIRED));
+
+ Intent intent = new Intent(ACTION_LINGER_EXPIRED, null);
+ intent.putExtra(EXTRA_NETID, String.valueOf(mNetworkAgentInfo.network.netId));
+ intent.putExtra(EXTRA_TOKEN, String.valueOf(++mLingerToken));
+ mIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
+ long wakeupTime = SystemClock.elapsedRealtime() + mLingerDelayMs;
+ mAlarmManager.setWindow(AlarmManager.ELAPSED_REALTIME_WAKEUP, wakeupTime,
+ // Give a specific window so we aren't subject to unknown inexactitude.
+ mLingerDelayMs / 6, mIntent);
}
@Override
@@ -524,6 +555,12 @@
return NOT_HANDLED;
}
}
+
+ @Override
+ public void exit() {
+ mAlarmManager.cancel(mIntent);
+ mContext.unregisterReceiver(mBroadcastReceiver);
+ }
}
/**
diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java
index c3bc306..30154d7 100644
--- a/services/core/java/com/android/server/job/JobSchedulerService.java
+++ b/services/core/java/com/android/server/job/JobSchedulerService.java
@@ -199,9 +199,6 @@
List<JobStatus> jobsForUser = mJobs.getJobsByUser(userHandle);
for (int i=0; i<jobsForUser.size(); i++) {
JobStatus toRemove = jobsForUser.get(i);
- if (DEBUG) {
- Slog.d(TAG, "Cancelling: " + toRemove);
- }
cancelJobLocked(toRemove);
}
}
@@ -219,9 +216,6 @@
List<JobStatus> jobsForUid = mJobs.getJobsByUid(uid);
for (int i=0; i<jobsForUid.size(); i++) {
JobStatus toRemove = jobsForUid.get(i);
- if (DEBUG) {
- Slog.d(TAG, "Cancelling: " + toRemove);
- }
cancelJobLocked(toRemove);
}
}
@@ -547,14 +541,28 @@
private void queueReadyJobsForExecutionH() {
synchronized (mJobs) {
ArraySet<JobStatus> jobs = mJobs.getJobs();
+ if (DEBUG) {
+ Slog.d(TAG, "queuing all ready jobs for execution:");
+ }
for (int i=0; i<jobs.size(); i++) {
JobStatus job = jobs.valueAt(i);
if (isReadyToBeExecutedLocked(job)) {
+ if (DEBUG) {
+ Slog.d(TAG, " queued " + job.toShortString());
+ }
mPendingJobs.add(job);
} else if (isReadyToBeCancelledLocked(job)) {
stopJobOnServiceContextLocked(job);
}
}
+ if (DEBUG) {
+ final int queuedJobs = mPendingJobs.size();
+ if (queuedJobs == 0) {
+ Slog.d(TAG, "No jobs pending.");
+ } else {
+ Slog.d(TAG, queuedJobs + " jobs queued.");
+ }
+ }
}
}
@@ -657,6 +665,9 @@
private void maybeRunPendingJobsH() {
synchronized (mJobs) {
Iterator<JobStatus> it = mPendingJobs.iterator();
+ if (DEBUG) {
+ Slog.d(TAG, "pending queue: " + mPendingJobs.size() + " jobs.");
+ }
while (it.hasNext()) {
JobStatus nextPending = it.next();
JobServiceContext availableContext = null;
diff --git a/services/core/java/com/android/server/job/JobServiceContext.java b/services/core/java/com/android/server/job/JobServiceContext.java
index 5297911..344c57b 100644
--- a/services/core/java/com/android/server/job/JobServiceContext.java
+++ b/services/core/java/com/android/server/job/JobServiceContext.java
@@ -157,6 +157,7 @@
mExecutionStartTimeElapsed = SystemClock.elapsedRealtime();
mVerb = VERB_BINDING;
+ scheduleOpTimeOut();
final Intent intent = new Intent().setComponent(job.getServiceComponent());
boolean binding = mContext.bindServiceAsUser(intent, this,
Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND,
@@ -253,8 +254,6 @@
return;
}
this.service = IJobService.Stub.asInterface(service);
- // Remove all timeouts.
- mCallbackHandler.removeMessages(MSG_TIMEOUT);
final PowerManager pm =
(PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, mRunningJob.getTag());
@@ -299,6 +298,7 @@
public void handleMessage(Message message) {
switch (message.what) {
case MSG_SERVICE_BOUND:
+ removeMessages(MSG_TIMEOUT);
handleServiceBoundH();
break;
case MSG_CALLBACK:
@@ -337,6 +337,9 @@
/** Start the job on the service. */
private void handleServiceBoundH() {
+ if (DEBUG) {
+ Slog.d(TAG, "MSG_SERVICE_BOUND for " + mRunningJob.toShortString());
+ }
if (mVerb != VERB_BINDING) {
Slog.e(TAG, "Sending onStartJob for a job that isn't pending. "
+ VERB_STRINGS[mVerb]);
@@ -456,42 +459,36 @@
/** Process MSG_TIMEOUT here. */
private void handleOpTimeoutH() {
- if (JobSchedulerService.DEBUG) {
- Slog.d(TAG, "MSG_TIMEOUT of " +
- mRunningJob.getServiceComponent().getShortClassName() + " : "
- + mParams.getJobId());
- }
-
- final int jobId = mParams.getJobId();
switch (mVerb) {
+ case VERB_BINDING:
+ Slog.e(TAG, "Time-out while trying to bind " + mRunningJob.toShortString() +
+ ", dropping.");
+ closeAndCleanupJobH(false /* needsReschedule */);
+ break;
case VERB_STARTING:
// Client unresponsive - wedged or failed to respond in time. We don't really
// know what happened so let's log it and notify the JobScheduler
// FINISHED/NO-RETRY.
Slog.e(TAG, "No response from client for onStartJob '" +
- mRunningJob.getServiceComponent().getShortClassName() + "' jId: "
- + jobId);
+ mRunningJob.toShortString());
closeAndCleanupJobH(false /* needsReschedule */);
break;
case VERB_STOPPING:
// At least we got somewhere, so fail but ask the JobScheduler to reschedule.
Slog.e(TAG, "No response from client for onStopJob, '" +
- mRunningJob.getServiceComponent().getShortClassName() + "' jId: "
- + jobId);
+ mRunningJob.toShortString());
closeAndCleanupJobH(true /* needsReschedule */);
break;
case VERB_EXECUTING:
// Not an error - client ran out of time.
Slog.i(TAG, "Client timed out while executing (no jobFinished received)." +
- " sending onStop. " +
- mRunningJob.getServiceComponent().getShortClassName() + "' jId: "
- + jobId);
+ " sending onStop. " + mRunningJob.toShortString());
sendStopMessageH();
break;
default:
- Slog.e(TAG, "Handling timeout for an unknown active job state: "
- + mRunningJob);
- return;
+ Slog.e(TAG, "Handling timeout for an invalid job state: " +
+ mRunningJob.toShortString() + ", dropping.");
+ closeAndCleanupJobH(false /* needsReschedule */);
}
}
@@ -530,7 +527,9 @@
} catch (RemoteException e) {
// Whatever.
}
- mWakeLock.release();
+ if (mWakeLock != null) {
+ mWakeLock.release();
+ }
mContext.unbindService(JobServiceContext.this);
mWakeLock = null;
mRunningJob = null;
@@ -547,25 +546,25 @@
removeMessages(MSG_SHUTDOWN_EXECUTION);
mCompletedListener.onJobCompleted(completedJob, reschedule);
}
+ }
- /**
- * Called when sending a message to the client, over whose execution we have no control. If
- * we haven't received a response in a certain amount of time, we want to give up and carry
- * on with life.
- */
- private void scheduleOpTimeOut() {
- mCallbackHandler.removeMessages(MSG_TIMEOUT);
+ /**
+ * Called when sending a message to the client, over whose execution we have no control. If
+ * we haven't received a response in a certain amount of time, we want to give up and carry
+ * on with life.
+ */
+ private void scheduleOpTimeOut() {
+ mCallbackHandler.removeMessages(MSG_TIMEOUT);
- final long timeoutMillis = (mVerb == VERB_EXECUTING) ?
- EXECUTING_TIMESLICE_MILLIS : OP_TIMEOUT_MILLIS;
- if (DEBUG) {
- Slog.d(TAG, "Scheduling time out for '" +
- mRunningJob.getServiceComponent().getShortClassName() + "' jId: " +
- mParams.getJobId() + ", in " + (timeoutMillis / 1000) + " s");
- }
- Message m = mCallbackHandler.obtainMessage(MSG_TIMEOUT);
- mCallbackHandler.sendMessageDelayed(m, timeoutMillis);
- mTimeoutElapsed = SystemClock.elapsedRealtime() + timeoutMillis;
+ final long timeoutMillis = (mVerb == VERB_EXECUTING) ?
+ EXECUTING_TIMESLICE_MILLIS : OP_TIMEOUT_MILLIS;
+ if (DEBUG) {
+ Slog.d(TAG, "Scheduling time out for '" +
+ mRunningJob.getServiceComponent().getShortClassName() + "' jId: " +
+ mParams.getJobId() + ", in " + (timeoutMillis / 1000) + " s");
}
+ Message m = mCallbackHandler.obtainMessage(MSG_TIMEOUT);
+ mCallbackHandler.sendMessageDelayed(m, timeoutMillis);
+ mTimeoutElapsed = SystemClock.elapsedRealtime() + timeoutMillis;
}
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 9554afa..5639234 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -317,6 +317,7 @@
final Context mContext;
final boolean mFactoryTest;
final boolean mOnlyCore;
+ final boolean mLazyDexOpt;
final DisplayMetrics mMetrics;
final int mDefParseFlags;
final String[] mSeparateProcesses;
@@ -1266,6 +1267,7 @@
mContext = context;
mFactoryTest = factoryTest;
mOnlyCore = onlyCore;
+ mLazyDexOpt = "eng".equals(SystemProperties.get("ro.build.type"));
mMetrics = new DisplayMetrics();
mSettings = new Settings(context);
mSettings.addSharedUserLPw("android.uid.system", Process.SYSTEM_UID,
@@ -4451,13 +4453,12 @@
if (pkgs != null) {
// Filter out packages that aren't recently used.
//
- // The exception is first boot of a non-eng device, which
+ // The exception is first boot of a non-eng device (aka !mLazyDexOpt), which
// should do a full dexopt.
- boolean eng = "eng".equals(SystemProperties.get("ro.build.type"));
- if (eng || (!isFirstBoot() && mPackageUsage.isHistoricalPackageUsageAvailable())) {
+ if (mLazyDexOpt || (!isFirstBoot() && mPackageUsage.isHistoricalPackageUsageAvailable())) {
// TODO: add a property to control this?
long dexOptLRUThresholdInMinutes;
- if (eng) {
+ if (mLazyDexOpt) {
dexOptLRUThresholdInMinutes = 30; // only last 30 minutes of apps for eng builds.
} else {
dexOptLRUThresholdInMinutes = 7 * 24 * 60; // apps used in the 7 days for users.
@@ -4523,6 +4524,9 @@
}
public boolean performDexOpt(String packageName, String instructionSet, boolean updateUsage) {
+ if (!mLazyDexOpt) {
+ return false;
+ }
PackageParser.Package p;
final String targetInstructionSet;
synchronized (mPackages) {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 564a3df..cad2772 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -40,7 +40,6 @@
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
-import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
@@ -70,7 +69,6 @@
import android.os.UserManager;
import android.provider.Settings;
import android.security.Credentials;
-import android.security.IKeyChainService;
import android.security.KeyChain;
import android.security.KeyChain.KeyChainConnection;
import android.util.Log;
@@ -2749,7 +2747,8 @@
return !"".equals(state);
}
- public boolean installCaCert(ComponentName who, byte[] certBuffer) throws RemoteException {
+ @Override
+ public void enforceCanManageCaCerts(ComponentName who) {
if (who == null) {
mContext.enforceCallingOrSelfPermission(MANAGE_CA_CERTIFICATES, null);
} else {
@@ -2757,6 +2756,11 @@
getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
}
}
+ }
+
+ @Override
+ public boolean installCaCert(ComponentName admin, byte[] certBuffer) throws RemoteException {
+ enforceCanManageCaCerts(admin);
byte[] pemCert;
try {
@@ -2791,21 +2795,15 @@
return false;
}
- private static X509Certificate parseCert(byte[] certBuffer)
- throws CertificateException, IOException {
+ private static X509Certificate parseCert(byte[] certBuffer) throws CertificateException {
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
return (X509Certificate) certFactory.generateCertificate(new ByteArrayInputStream(
certBuffer));
}
- public void uninstallCaCert(ComponentName who, String alias) {
- if (who == null) {
- mContext.enforceCallingOrSelfPermission(MANAGE_CA_CERTIFICATES, null);
- } else {
- synchronized (this) {
- getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
- }
- }
+ @Override
+ public void uninstallCaCert(ComponentName admin, String alias) {
+ enforceCanManageCaCerts(admin);
final UserHandle userHandle = new UserHandle(UserHandle.getCallingUserId());
final long id = Binder.clearCallingIdentity();
diff --git a/telecomm/java/android/telecomm/Call.java b/telecomm/java/android/telecomm/Call.java
index 7c596c1..5bf0855 100644
--- a/telecomm/java/android/telecomm/Call.java
+++ b/telecomm/java/android/telecomm/Call.java
@@ -347,14 +347,6 @@
public void onVideoCallChanged(Call call, InCallService.VideoCall videoCall) {}
/**
- * Launches an activity for this connection on top of the in-call UI.
- *
- * @param call The {@code Call} invoking this method.
- * @param intent The intent to use to start the activity.
- */
- public void onStartActivity(Call call, PendingIntent intent) {}
-
- /**
* Invoked when the {@code Call} is destroyed. Clients should refrain from cleaning
* up their UI for the {@code Call} in response to state transitions. Specifically,
* clients should not assume that a {@link #onStateChanged(Call, int)} with a state of
@@ -753,11 +745,6 @@
}
/** {@hide} */
- final void internalStartActivity(PendingIntent intent) {
- fireStartActivity(intent);
- }
-
- /** {@hide} */
final void internalSetDisconnected() {
if (mState != Call.STATE_DISCONNECTED) {
mState = Call.STATE_DISCONNECTED;
@@ -809,12 +796,6 @@
}
}
- private void fireStartActivity(PendingIntent intent) {
- for (Listener listener : mListeners) {
- listener.onStartActivity(this, intent);
- }
- }
-
private void fireCallDestroyed() {
for (Listener listener : mListeners) {
listener.onCallDestroyed(this);
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java
index f349659..4d6e267 100644
--- a/telecomm/java/android/telecomm/Connection.java
+++ b/telecomm/java/android/telecomm/Connection.java
@@ -81,7 +81,6 @@
Connection c, VideoProvider videoProvider) {}
public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) {}
public void onStatusHintsChanged(Connection c, StatusHints statusHints) {}
- public void onStartActivityFromInCall(Connection c, PendingIntent intent) {}
public void onConferenceableConnectionsChanged(
Connection c, List<Connection> conferenceableConnections) {}
public void onConferenceChanged(Connection c, Conference conference) {}
@@ -942,20 +941,6 @@
}
/**
- * Launches an activity for this connection on top of the in-call UI.
- *
- * @param intent The intent to use to start the activity.
- */
- public final void startActivityFromInCall(PendingIntent intent) {
- if (!intent.isActivity()) {
- throw new IllegalArgumentException("Activity intent required.");
- }
- for (Listener l : mListeners) {
- l.onStartActivityFromInCall(this, intent);
- }
- }
-
- /**
* Notifies this Connection that the {@link #getAudioState()} property has a new value.
*
* @param state The new call audio state.
diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java
index 19cf622..2dc6910 100644
--- a/telecomm/java/android/telecomm/ConnectionService.java
+++ b/telecomm/java/android/telecomm/ConnectionService.java
@@ -463,12 +463,6 @@
}
@Override
- public void onStartActivityFromInCall(Connection c, PendingIntent intent) {
- String id = mIdByConnection.get(c);
- mAdapter.startActivityFromInCall(id, intent);
- }
-
- @Override
public void onConferenceableConnectionsChanged(
Connection connection, List<Connection> conferenceableConnections) {
mAdapter.setConferenceableConnections(
@@ -834,24 +828,6 @@
*/
public void onConference(Connection connection1, Connection connection2) {}
- /**
- * Notifies that a connection has been added to this connection service and sent to Telecomm.
- *
- * @param connection The connection which was added.
- */
- public void onConnectionAdded(Connection connection) {}
-
- /**
- * Notified that a connection has been removed from this connection service.
- * <p>
- * TODO: Deprecate this since we can listen to the Connection onDestroyed() to determine when
- * it is destroyed. This then percolates down to the RemoteConference stuff, where we can also
- * have a callback for one being added, but we don't need one for being destroyed.
- *
- * @param connection The connection which was removed.
- */
- public void onConnectionRemoved(Connection connection) {}
-
public void onRemoteConferenceAdded(RemoteConference conference) {}
/**
@@ -879,7 +855,6 @@
mIdByConnection.put(connection, callId);
connection.addConnectionListener(mConnectionListener);
connection.setConnectionService(this);
- onConnectionAdded(connection);
}
private void removeConnection(Connection connection) {
@@ -888,7 +863,6 @@
connection.removeConnectionListener(mConnectionListener);
mConnectionById.remove(mIdByConnection.get(connection));
mIdByConnection.remove(connection);
- onConnectionRemoved(connection);
mAdapter.removeCall(id);
}
diff --git a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
index cb63646..e3dc713 100644
--- a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
@@ -346,13 +346,4 @@
}
}
}
-
- void startActivityFromInCall(String callId, PendingIntent intent) {
- for (IConnectionServiceAdapter adapter : mAdapters) {
- try {
- adapter.startActivityFromInCall(callId, intent);
- } catch (RemoteException e) {
- }
- }
- }
}
diff --git a/telecomm/java/android/telecomm/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecomm/ConnectionServiceAdapterServant.java
index 0e1c516..21e99db 100644
--- a/telecomm/java/android/telecomm/ConnectionServiceAdapterServant.java
+++ b/telecomm/java/android/telecomm/ConnectionServiceAdapterServant.java
@@ -57,8 +57,7 @@
private static final int MSG_SET_STATUS_HINTS = 17;
private static final int MSG_SET_HANDLE = 18;
private static final int MSG_SET_CALLER_DISPLAY_NAME = 19;
- private static final int MSG_START_ACTIVITY_FROM_IN_CALL = 20;
- private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 21;
+ private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
private final IConnectionServiceAdapter mDelegate;
@@ -192,16 +191,6 @@
}
break;
}
- case MSG_START_ACTIVITY_FROM_IN_CALL: {
- SomeArgs args = (SomeArgs) msg.obj;
- try {
- mDelegate.startActivityFromInCall(
- (String) args.arg1, (PendingIntent) args.arg2);
- } finally {
- args.recycle();
- }
- break;
- }
case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
SomeArgs args = (SomeArgs) msg.obj;
try {
@@ -352,14 +341,6 @@
}
@Override
- public final void startActivityFromInCall(String connectionId, PendingIntent intent) {
- SomeArgs args = SomeArgs.obtain();
- args.arg1 = connectionId;
- args.arg2 = intent;
- mHandler.obtainMessage(MSG_START_ACTIVITY_FROM_IN_CALL, args).sendToTarget();
- }
-
- @Override
public final void setConferenceableConnections(
String connectionId, List<String> conferenceableConnectionIds) {
SomeArgs args = SomeArgs.obtain();
diff --git a/telecomm/java/android/telecomm/InCallService.java b/telecomm/java/android/telecomm/InCallService.java
index 62a90bc..51cd537 100644
--- a/telecomm/java/android/telecomm/InCallService.java
+++ b/telecomm/java/android/telecomm/InCallService.java
@@ -55,7 +55,6 @@
private static final int MSG_SET_POST_DIAL_WAIT = 4;
private static final int MSG_ON_AUDIO_STATE_CHANGED = 5;
private static final int MSG_BRING_TO_FOREGROUND = 6;
- private static final int MSG_START_ACTIVITY = 7;
/** Default Handler used to consolidate binder method calls onto a single thread. */
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -89,15 +88,6 @@
case MSG_BRING_TO_FOREGROUND:
mPhone.internalBringToForeground(msg.arg1 == 1);
break;
- case MSG_START_ACTIVITY:
- SomeArgs args = (SomeArgs) msg.obj;
- try {
- mPhone.internalStartActivity(
- (String) args.arg1, (PendingIntent) args.arg2);
- } finally {
- args.recycle();
- }
- break;
default:
break;
}
@@ -143,14 +133,6 @@
public void bringToForeground(boolean showDialpad) {
mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget();
}
-
- @Override
- public void startActivity(String callId, PendingIntent intent) {
- SomeArgs args = SomeArgs.obtain();
- args.arg1 = callId;
- args.arg2 = intent;
- mHandler.obtainMessage(MSG_START_ACTIVITY, args).sendToTarget();
- }
}
private Phone mPhone;
diff --git a/telecomm/java/android/telecomm/Phone.java b/telecomm/java/android/telecomm/Phone.java
index d90d954..8831f8f 100644
--- a/telecomm/java/android/telecomm/Phone.java
+++ b/telecomm/java/android/telecomm/Phone.java
@@ -150,14 +150,6 @@
fireBringToForeground(showDialpad);
}
- /** {@hide} */
- final void internalStartActivity(String telecommId, PendingIntent intent) {
- Call call = mCallByTelecommCallId.get(telecommId);
- if (call != null) {
- call.internalStartActivity(intent);
- }
- }
-
/**
* Called to destroy the phone and cleanup any lingering calls.
* @hide
diff --git a/telecomm/java/android/telecomm/PhoneAccount.java b/telecomm/java/android/telecomm/PhoneAccount.java
index 5b46409..1d61a6e 100644
--- a/telecomm/java/android/telecomm/PhoneAccount.java
+++ b/telecomm/java/android/telecomm/PhoneAccount.java
@@ -23,7 +23,12 @@
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
+import android.text.TextUtils;
+import java.lang.String;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.MissingResourceException;
/**
@@ -77,6 +82,21 @@
*/
public static final int CAPABILITY_VIDEO_CALLING = 0x8;
+ /**
+ * URI scheme for telephone number URIs.
+ */
+ public static final String SCHEME_TEL = "tel";
+
+ /**
+ * URI scheme for voicemail URIs.
+ */
+ public static final String SCHEME_VOICEMAIL = "voicemail";
+
+ /**
+ * URI scheme for SIP URIs.
+ */
+ public static final String SCHEME_SIP = "sip";
+
private final PhoneAccountHandle mAccountHandle;
private final Uri mHandle;
private final String mSubscriptionNumber;
@@ -84,6 +104,7 @@
private final int mIconResId;
private final CharSequence mLabel;
private final CharSequence mShortDescription;
+ private final List<String> mSupportedUriSchemes;
public static class Builder {
private PhoneAccountHandle mAccountHandle;
@@ -93,6 +114,7 @@
private int mIconResId;
private CharSequence mLabel;
private CharSequence mShortDescription;
+ private List<String> mSupportedUriSchemes = new ArrayList<String>();
public Builder() {}
@@ -131,7 +153,40 @@
return this;
}
+ /**
+ * Specifies an additional URI scheme supported by the {@link PhoneAccount}.
+ *
+ * @param uriScheme The URI scheme.
+ * @return The Builder.
+ */
+ public Builder withSupportedUriScheme(String uriScheme) {
+ if (!TextUtils.isEmpty(uriScheme) && !mSupportedUriSchemes.contains(uriScheme)) {
+ this.mSupportedUriSchemes.add(uriScheme);
+ }
+ return this;
+ }
+
+ /**
+ * Specifies additional URI schemes supported by the {@link PhoneAccount}.
+ *
+ * @param uriSchemes The URI schemes.
+ * @return The Builder.
+ */
+ public Builder withSupportedUriSchemes(List<String> uriSchemes) {
+ if (uriSchemes != null && !uriSchemes.isEmpty()) {
+ for (String uriScheme : uriSchemes) {
+ withSupportedUriScheme(uriScheme);
+ }
+ }
+ return this;
+ }
+
public PhoneAccount build() {
+ // If no supported URI schemes were defined, assume "tel" is supported.
+ if (mSupportedUriSchemes.isEmpty()) {
+ withSupportedUriScheme(SCHEME_TEL);
+ }
+
return new PhoneAccount(
mAccountHandle,
mHandle,
@@ -139,7 +194,8 @@
mCapabilities,
mIconResId,
mLabel,
- mShortDescription);
+ mShortDescription,
+ mSupportedUriSchemes);
}
}
@@ -150,7 +206,8 @@
int capabilities,
int iconResId,
CharSequence label,
- CharSequence shortDescription) {
+ CharSequence shortDescription,
+ List<String> supportedUriSchemes) {
mAccountHandle = account;
mHandle = handle;
mSubscriptionNumber = subscriptionNumber;
@@ -158,6 +215,7 @@
mIconResId = iconResId;
mLabel = label;
mShortDescription = shortDescription;
+ mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
}
public static Builder builder() { return new Builder(); }
@@ -228,6 +286,36 @@
}
/**
+ * The URI schemes supported by this {@code PhoneAccount}.
+ *
+ * @return The URI schemes.
+ */
+ public List<String> getSupportedUriSchemes() {
+ return mSupportedUriSchemes;
+ }
+
+ /**
+ * Determines if the {@link PhoneAccount} supports calls to/from handles with a specified URI
+ * scheme.
+ *
+ * @param uriScheme The URI scheme to check.
+ * @return {@code True} if the {@code PhoneAccount} supports calls to/from handles with the
+ * specified URI scheme.
+ */
+ public boolean supportsUriScheme(String uriScheme) {
+ if (mSupportedUriSchemes == null || uriScheme == null) {
+ return false;
+ }
+
+ for (String scheme : mSupportedUriSchemes) {
+ if (scheme != null && scheme.equals(uriScheme)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* The icon resource ID for the icon of this {@code PhoneAccount}.
*
* @return A resource ID.
@@ -281,6 +369,7 @@
out.writeInt(mIconResId);
out.writeCharSequence(mLabel);
out.writeCharSequence(mShortDescription);
+ out.writeList(mSupportedUriSchemes);
}
public static final Creator<PhoneAccount> CREATOR
@@ -297,6 +386,8 @@
};
private PhoneAccount(Parcel in) {
+ ClassLoader classLoader = PhoneAccount.class.getClassLoader();
+
mAccountHandle = in.readParcelable(getClass().getClassLoader());
mHandle = in.readParcelable(getClass().getClassLoader());
mSubscriptionNumber = in.readString();
@@ -304,5 +395,9 @@
mIconResId = in.readInt();
mLabel = in.readCharSequence();
mShortDescription = in.readCharSequence();
+
+ List<String> supportedUriSchemes = new ArrayList<>();
+ in.readList(supportedUriSchemes, classLoader);
+ mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
}
}
diff --git a/telecomm/java/android/telecomm/RemoteConnection.java b/telecomm/java/android/telecomm/RemoteConnection.java
index b7e4b2a..31afb4b 100644
--- a/telecomm/java/android/telecomm/RemoteConnection.java
+++ b/telecomm/java/android/telecomm/RemoteConnection.java
@@ -163,16 +163,6 @@
public void onVideoStateChanged(RemoteConnection connection, int videoState) {}
/**
- * Indicates that this {@code RemoteConnection} is requesting that the in-call UI
- * launch the specified activity.
- *
- * @param connection The {@code RemoteConnection} invoking this method.
- * @param intent A {@link PendingIntent} that the {@code RemoteConnection} wishes to
- * have launched on its behalf.
- */
- public void onStartActivityFromInCall(RemoteConnection connection, PendingIntent intent) {}
-
- /**
* Indicates that this {@code RemoteConnection} has been destroyed. No further requests
* should be made to the {@code RemoteConnection}, and references to it should be cleared.
*
@@ -729,13 +719,6 @@
}
/** @hide */
- void startActivityFromInCall(PendingIntent intent) {
- for (Listener l : mListeners) {
- l.onStartActivityFromInCall(this, intent);
- }
- }
-
- /** @hide */
void setConferenceableConnections(List<RemoteConnection> conferenceableConnections) {
mConferenceableConnections.clear();
mConferenceableConnections.addAll(conferenceableConnections);
diff --git a/telecomm/java/android/telecomm/RemoteConnectionService.java b/telecomm/java/android/telecomm/RemoteConnectionService.java
index 51722fe..0b6badb 100644
--- a/telecomm/java/android/telecomm/RemoteConnectionService.java
+++ b/telecomm/java/android/telecomm/RemoteConnectionService.java
@@ -261,12 +261,6 @@
}
@Override
- public void startActivityFromInCall(String callId, PendingIntent intent) {
- findConnectionForAction(callId, "startActivityFromInCall")
- .startActivityFromInCall(intent);
- }
-
- @Override
public IBinder asBinder() {
throw new UnsupportedOperationException();
}
diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java
index 2243288..071b719 100644
--- a/telecomm/java/android/telecomm/TelecommManager.java
+++ b/telecomm/java/android/telecomm/TelecommManager.java
@@ -258,8 +258,8 @@
/**
* Return the {@link PhoneAccount} which is the user-chosen default for making outgoing phone
- * calls. This {@code PhoneAccount} will always be a member of the list which is returned from
- * calling {@link #getEnabledPhoneAccounts()}.
+ * calls with a specified URI scheme. This {@code PhoneAccount} will always be a member of the
+ * list which is returned from calling {@link #getEnabledPhoneAccounts()}.
* <p>
* Apps must be prepared for this method to return {@code null}, indicating that there currently
* exists no user-chosen default {@code PhoneAccount}. In this case, apps wishing to initiate a
@@ -272,11 +272,13 @@
* {@code Intent} with no {@link TelecommManager#EXTRA_PHONE_ACCOUNT_HANDLE} is valid, and
* subsequent steps in the phone call flow are responsible for presenting the user with an
* affordance, if necessary, to choose a {@code PhoneAccount}.
+ *
+ * @param uriScheme The URI scheme.
*/
- public PhoneAccountHandle getDefaultOutgoingPhoneAccount() {
+ public PhoneAccountHandle getDefaultOutgoingPhoneAccount(String uriScheme) {
try {
if (isServiceConnected()) {
- return getTelecommService().getDefaultOutgoingPhoneAccount();
+ return getTelecommService().getDefaultOutgoingPhoneAccount(uriScheme);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecommService#getDefaultOutgoingPhoneAccount", e);
@@ -366,6 +368,29 @@
}
/**
+ * Returns a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
+ * calls which support the specified URI scheme.
+ * <P>
+ * For example, invoking with {@code "tel"} will find all {@link PhoneAccountHandle}s which
+ * support telephone calls (e.g. URIs such as {@code tel:555-555-1212}). Invoking with
+ * {@code "sip"} will find all {@link PhoneAccountHandle}s which support SIP calls (e.g. URIs
+ * such as {@code sip:example@sipexample.com}).
+ *
+ * @param uriScheme The URI scheme.
+ * @return A list of {@code PhoneAccountHandle} objects supporting the URI scheme.
+ */
+ public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme) {
+ try {
+ if (isServiceConnected()) {
+ return getTelecommService().getPhoneAccountsSupportingScheme(uriScheme);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecommService#getPhoneAccountsSupportingScheme", e);
+ }
+ return new ArrayList<>();
+ }
+
+ /**
* Determine whether the device has more than one account registered and enabled.
*
* @return {@code true} if the device has more than one account registered and enabled and
diff --git a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
index ef1769f..610178e 100644
--- a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
@@ -76,6 +76,4 @@
void setCallerDisplayName(String callId, String callerDisplayName, int presentation);
void setConferenceableConnections(String callId, in List<String> conferenceableCallIds);
-
- void startActivityFromInCall(String callId, in PendingIntent intent);
}
diff --git a/telecomm/java/com/android/internal/telecomm/IInCallService.aidl b/telecomm/java/com/android/internal/telecomm/IInCallService.aidl
index 5d4992f..23dbaf4 100644
--- a/telecomm/java/com/android/internal/telecomm/IInCallService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IInCallService.aidl
@@ -43,6 +43,4 @@
void onAudioStateChanged(in AudioState audioState);
void bringToForeground(boolean showDialpad);
-
- void startActivity(String callId, in PendingIntent intent);
}
diff --git a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
index 131307a..a6ab3ac 100644
--- a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
@@ -37,7 +37,7 @@
/**
* @see TelecommServiceImpl#getDefaultOutgoingPhoneAccount
*/
- PhoneAccountHandle getDefaultOutgoingPhoneAccount();
+ PhoneAccountHandle getDefaultOutgoingPhoneAccount(in String uriScheme);
/**
* @see TelecommServiceImpl#setDefaultOutgoingPhoneAccount
@@ -50,7 +50,12 @@
List<PhoneAccountHandle> getOutgoingPhoneAccounts();
/**
- * @see TelecommServiceImpl#getPhoneAccount
+ * @see TelecommManager#getPhoneAccountsSupportingScheme
+ */
+ List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(in String uriScheme);
+
+ /**
+ * @see TelecommManager#getPhoneAccount
*/
PhoneAccount getPhoneAccount(in PhoneAccountHandle account);
diff --git a/telephony/java/android/telephony/SubInfoRecord.java b/telephony/java/android/telephony/SubInfoRecord.java
index ced8e2f..55781fa 100644
--- a/telephony/java/android/telephony/SubInfoRecord.java
+++ b/telephony/java/android/telephony/SubInfoRecord.java
@@ -33,34 +33,33 @@
public int mNameSource;
public int mColor;
public String mNumber;
- public int mDispalyNumberFormat;
+ public int mDisplayNumberFormat;
public int mDataRoaming;
public int[] mSimIconRes;
public SubInfoRecord() {
- this.mSubId = -1;
+ this.mSubId = SubscriptionManager.INVALID_SUB_ID;
this.mIccId = "";
- this.mSlotId = -1;
+ this.mSlotId = SubscriptionManager.INVALID_SLOT_ID;
this.mDisplayName = "";
this.mNameSource = 0;
this.mColor = 0;
this.mNumber = "";
- this.mDispalyNumberFormat = 0;
+ this.mDisplayNumberFormat = 0;
this.mDataRoaming = 0;
this.mSimIconRes = new int[2];
}
-
- public SubInfoRecord(long subId, String iccId, int slotId, String displayname, int nameSource,
- int mColor, String mNumber, int displayFormat, int roaming, int[] iconRes) {
+ public SubInfoRecord(long subId, String iccId, int slotId, String displayName,
+ int nameSource, int mColor, String mNumber, int displayFormat, int roaming, int[] iconRes) {
this.mSubId = subId;
this.mIccId = iccId;
this.mSlotId = slotId;
- this.mDisplayName = displayname;
+ this.mDisplayName = displayName;
this.mNameSource = nameSource;
this.mColor = mColor;
this.mNumber = mNumber;
- this.mDispalyNumberFormat = displayFormat;
+ this.mDisplayNumberFormat = displayFormat;
this.mDataRoaming = roaming;
this.mSimIconRes = iconRes;
}
@@ -74,13 +73,13 @@
int mNameSource = source.readInt();
int mColor = source.readInt();
String mNumber = source.readString();
- int mDispalyNumberFormat = source.readInt();
+ int mDisplayNumberFormat = source.readInt();
int mDataRoaming = source.readInt();
int[] iconRes = new int[2];
source.readIntArray(iconRes);
return new SubInfoRecord(mSubId, mIccId, mSlotId, mDisplayName, mNameSource, mColor, mNumber,
- mDispalyNumberFormat, mDataRoaming, iconRes);
+ mDisplayNumberFormat, mDataRoaming, iconRes);
}
public SubInfoRecord[] newArray(int size) {
@@ -96,7 +95,7 @@
dest.writeInt(mNameSource);
dest.writeInt(mColor);
dest.writeString(mNumber);
- dest.writeInt(mDispalyNumberFormat);
+ dest.writeInt(mDisplayNumberFormat);
dest.writeInt(mDataRoaming);
dest.writeIntArray(mSimIconRes);
}
@@ -109,7 +108,7 @@
return "{mSubId=" + mSubId + ", mIccId=" + mIccId + " mSlotId=" + mSlotId
+ " mDisplayName=" + mDisplayName + " mNameSource=" + mNameSource
+ " mColor=" + mColor + " mNumber=" + mNumber
- + " mDispalyNumberFormat=" + mDispalyNumberFormat + " mDataRoaming=" + mDataRoaming
+ + " mDisplayNumberFormat=" + mDisplayNumberFormat + " mDataRoaming=" + mDataRoaming
+ " mSimIconRes=" + mSimIconRes + "}";
}
}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 79e9fd5..f83f164 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -16,16 +16,9 @@
package android.telephony;
-import static android.Manifest.permission.READ_PHONE_STATE;
-
-import android.app.ActivityManagerNative;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
import android.content.Intent;
-import android.database.Cursor;
-import android.os.UserHandle;
import android.net.Uri;
import android.provider.BaseColumns;
import android.telephony.Rlog;
@@ -34,13 +27,7 @@
import com.android.internal.telephony.ISub;
import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.TelephonyIntents;
-
-import java.util.ArrayList;
import java.util.List;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
/**
*@hide
@@ -50,11 +37,26 @@
private static final boolean DBG = true;
private static final boolean VDBG = false;
- // An invalid subscription identifier
- public static final long INVALID_SUB_ID = Long.MAX_VALUE;
+ // An invalid phone identifier
+ public static final int INVALID_PHONE_ID = -1000;
- // The default subscription identifier
- public static final long DEFAULT_SUB_ID = Long.MAX_VALUE - 1;
+ // Indicates the caller wants the default phone id.
+ public static final int DEFAULT_PHONE_ID = Integer.MAX_VALUE;
+
+ // An invalid slot identifier
+ public static final int INVALID_SLOT_ID = -1000;
+
+ // Indicates the caller wants the default slot id.
+ public static final int DEFAULT_SLOT_ID = Integer.MAX_VALUE;
+
+ // An invalid subscription identifier
+ public static final long INVALID_SUB_ID = -1000;
+
+ // Indicates the user should be asked which sub to use.
+ public static final long ASK_USER_SUB_ID = -1001;
+
+ // Indicates the caller wants the default sub id.
+ public static final long DEFAULT_SUB_ID = Long.MAX_VALUE;
public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo");
@@ -99,11 +101,13 @@
*/
public static final String NAME_SOURCE = "name_source";
- public static final int DEFAULT_SOURCE = 0;
+ public static final int NAME_SOURCE_UNDEFINDED = -1;
- public static final int SIM_SOURCE = 1;
+ public static final int NAME_SOURCE_DEFAULT_SOURCE = 0;
- public static final int USER_INPUT = 2;
+ public static final int NAME_SOURCE_SIM_SOURCE = 1;
+
+ public static final int NAME_SOURCE_USER_INPUT = 2;
/**
* The color of a SIM.
@@ -133,7 +137,7 @@
*/
public static final String DISPLAY_NUMBER_FORMAT = "display_number_format";
- public static final int DISPALY_NUMBER_NONE = 0;
+ public static final int DISPLAY_NUMBER_NONE = 0;
public static final int DISPLAY_NUMBER_FIRST = 1;
@@ -159,9 +163,14 @@
private static final int[] sSimBackgroundDarkRes = setSimResource(RES_TYPE_BACKGROUND_DARK);
- private static final int[] sSimBackgroundLightRes = setSimResource(RES_TYPE_BACKGROUND_LIGHT);
-
- private static HashMap<Integer, Long> mSimInfo = new HashMap<Integer, Long>();
+ /**
+ * Broadcast Action: The user has changed one of the default subs related to
+ * data, phone calls, or sms</p>
+ *
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String SUB_DEFAULT_CHANGED_ACTION =
+ "android.intent.action.SUB_DEFAULT_CHANGED";
public SubscriptionManager() {
if (DBG) logd("SubscriptionManager created");
@@ -169,14 +178,12 @@
/**
* Get the SubInfoRecord according to an index
- * @param context Context provided by caller
* @param subId The unique SubInfoRecord index in database
* @return SubInfoRecord, maybe null
*/
- public static SubInfoRecord getSubInfoUsingSubId(Context context, long subId) {
- if (VDBG) logd("[getSubInfoUsingSubIdx]+ subId:" + subId);
- if (subId <= 0) {
- if (VDBG) logd("[getSubInfoUsingSubIdx]- subId <= 0");
+ public static SubInfoRecord getSubInfoUsingSubId(long subId) {
+ if (!isValidSubId(subId)) {
+ logd("[getSubInfoUsingSubIdx]- invalid subId");
return null;
}
@@ -197,11 +204,10 @@
/**
* Get the SubInfoRecord according to an IccId
- * @param context Context provided by caller
* @param iccId the IccId of SIM card
* @return SubInfoRecord, maybe null
*/
- public static List<SubInfoRecord> getSubInfoUsingIccId(Context context, String iccId) {
+ public static List<SubInfoRecord> getSubInfoUsingIccId(String iccId) {
if (VDBG) logd("[getSubInfoUsingIccId]+ iccId=" + iccId);
if (iccId == null) {
logd("[getSubInfoUsingIccId]- null iccid");
@@ -224,14 +230,13 @@
/**
* Get the SubInfoRecord according to slotId
- * @param context Context provided by caller
* @param slotId the slot which the SIM is inserted
* @return SubInfoRecord, maybe null
*/
- public static List<SubInfoRecord> getSubInfoUsingSlotId(Context context, int slotId) {
- if (VDBG) logd("[getSubInfoUsingSlotId]- slotId=" + slotId);
- if (slotId < 0) {
- logd("[getSubInfoUsingSlotId]- return null, slotId < 0");
+ public static List<SubInfoRecord> getSubInfoUsingSlotId(int slotId) {
+ // FIXME: Consider never returning null
+ if (!isValidSlotId(slotId)) {
+ logd("[getSubInfoUsingSlotId]- invalid slotId");
return null;
}
@@ -251,10 +256,9 @@
/**
* Get all the SubInfoRecord(s) in subinfo database
- * @param context Context provided by caller
* @return Array list of all SubInfoRecords in database, include thsoe that were inserted before
*/
- public static List<SubInfoRecord> getAllSubInfoList(Context context) {
+ public static List<SubInfoRecord> getAllSubInfoList() {
if (VDBG) logd("[getAllSubInfoList]+");
List<SubInfoRecord> result = null;
@@ -273,18 +277,15 @@
/**
* Get the SubInfoRecord(s) of the currently inserted SIM(s)
- * @param context Context provided by caller
* @return Array list of currently inserted SubInfoRecord(s)
*/
- public static List<SubInfoRecord> getActivatedSubInfoList(Context context) {
- if (VDBG) logd("[getActivatedSubInfoList]+");
-
+ public static List<SubInfoRecord> getActiveSubInfoList() {
List<SubInfoRecord> result = null;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getActivatedSubInfoList();
+ result = iSub.getActiveSubInfoList();
}
} catch (RemoteException ex) {
// ignore it
@@ -295,10 +296,9 @@
/**
* Get the SUB count of all SUB(s) in subinfo database
- * @param context Context provided by caller
* @return all SIM count in database, include what was inserted before
*/
- public static int getAllSubInfoCount(Context context) {
+ public static int getAllSubInfoCount() {
if (VDBG) logd("[getAllSubInfoCount]+");
int result = 0;
@@ -316,17 +316,38 @@
}
/**
+ * Get the count of active SUB(s)
+ * @return active SIM count
+ */
+ public static int getActiveSubInfoCount() {
+ int result = 0;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ result = iSub.getActiveSubInfoCount();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ return result;
+ }
+
+ /**
* Add a new SubInfoRecord to subinfo database if needed
- * @param context Context provided by caller
* @param iccId the IccId of the SIM card
* @param slotId the slot which the SIM is inserted
* @return the URL of the newly created row or the updated row
*/
- public static Uri addSubInfoRecord(Context context, String iccId, int slotId) {
+ public static Uri addSubInfoRecord(String iccId, int slotId) {
if (VDBG) logd("[addSubInfoRecord]+ iccId:" + iccId + " slotId:" + slotId);
if (iccId == null) {
logd("[addSubInfoRecord]- null iccId");
}
+ if (!isValidSlotId(slotId)) {
+ logd("[addSubInfoRecord]- invalid slotId");
+ }
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -345,15 +366,14 @@
/**
* Set SIM color by simInfo index
- * @param context Context provided by caller
* @param color the color of the SIM
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
*/
- public static int setColor(Context context, int color, long subId) {
+ public static int setColor(int color, long subId) {
if (VDBG) logd("[setColor]+ color:" + color + " subId:" + subId);
int size = sSimBackgroundDarkRes.length;
- if (subId <= 0 || color < 0 || color >= size) {
+ if (!isValidSubId(subId) || color < 0 || color >= size) {
logd("[setColor]- fail");
return -1;
}
@@ -375,26 +395,28 @@
/**
* Set display name by simInfo index
- * @param context Context provided by caller
* @param displayName the display name of SIM card
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
*/
- public static int setDisplayName(Context context, String displayName, long subId) {
- return setDisplayName(context, displayName, subId, -1);
+ public static int setDisplayName(String displayName, long subId) {
+ return setDisplayName(displayName, subId, NAME_SOURCE_UNDEFINDED);
}
/**
* Set display name by simInfo index with name source
- * @param context Context provided by caller
* @param displayName the display name of SIM card
* @param subId the unique SubInfoRecord index in database
- * @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT
- * @return the number of records updated
+ * @param nameSource 0: NAME_SOURCE_DEFAULT_SOURCE, 1: NAME_SOURCE_SIM_SOURCE,
+ * 2: NAME_SOURCE_USER_INPUT, -1 NAME_SOURCE_UNDEFINED
+ * @return the number of records updated or -1 if invalid subId
*/
- public static int setDisplayName(Context context, String displayName, long subId, long nameSource) {
- if (VDBG) logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource);
- if (subId <= 0) {
+ public static int setDisplayName(String displayName, long subId, long nameSource) {
+ if (VDBG) {
+ logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId
+ + " nameSource:" + nameSource);
+ }
+ if (!isValidSubId(subId)) {
logd("[setDisplayName]- fail");
return -1;
}
@@ -416,15 +438,13 @@
/**
* Set phone number by subId
- * @param context Context provided by caller
* @param number the phone number of the SIM
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
*/
- public static int setDispalyNumber(Context context, String number, long subId) {
- if (VDBG) logd("[setDispalyNumber]+ number:" + number + " subId:" + subId);
- if (number == null || subId <= 0) {
- logd("[setDispalyNumber]- fail");
+ public static int setDisplayNumber(String number, long subId) {
+ if (number == null || !isValidSubId(subId)) {
+ logd("[setDisplayNumber]- fail");
return -1;
}
@@ -433,7 +453,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.setDispalyNumber(number, subId);
+ result = iSub.setDisplayNumber(number, subId);
}
} catch (RemoteException ex) {
// ignore it
@@ -445,14 +465,13 @@
/**
* Set number display format. 0: none, 1: the first four digits, 2: the last four digits
- * @param context Context provided by caller
* @param format the display format of phone number
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
*/
- public static int setDisplayNumberFormat(Context context, int format, long subId) {
+ public static int setDisplayNumberFormat(int format, long subId) {
if (VDBG) logd("[setDisplayNumberFormat]+ format:" + format + " subId:" + subId);
- if (format < 0 || subId <= 0) {
+ if (format < 0 || !isValidSubId(subId)) {
logd("[setDisplayNumberFormat]- fail, return -1");
return -1;
}
@@ -474,14 +493,13 @@
/**
* Set data roaming by simInfo index
- * @param context Context provided by caller
* @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
*/
- public static int setDataRoaming(Context context, int roaming, long subId) {
+ public static int setDataRoaming(int roaming, long subId) {
if (VDBG) logd("[setDataRoaming]+ roaming:" + roaming + " subId:" + subId);
- if (roaming < 0 || subId <= 0) {
+ if (roaming < 0 || !isValidSubId(subId)) {
logd("[setDataRoaming]- fail");
return -1;
}
@@ -501,9 +519,11 @@
}
public static int getSlotId(long subId) {
- if (VDBG) logd("[getSlotId]+ subId:" + subId);
+ if (!isValidSubId(subId)) {
+ logd("[getSlotId]- fail");
+ }
- int result = 0;
+ int result = INVALID_SLOT_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -519,7 +539,10 @@
}
public static long[] getSubId(int slotId) {
- if (VDBG) logd("[getSubId]+ slotId:" + slotId);
+ if (!isValidSlotId(slotId)) {
+ logd("[getSubId]- fail");
+ return null;
+ }
long[] subId = null;
@@ -536,9 +559,12 @@
}
public static int getPhoneId(long subId) {
- if (VDBG) logd("[getPhoneId]+ subId=" + subId);
+ if (!isValidSubId(subId)) {
+ logd("[getPhoneId]- fail");
+ return INVALID_PHONE_ID;
+ }
- int result = 0;
+ int result = INVALID_PHONE_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -549,7 +575,7 @@
// ignore it
}
- if (VDBG) logd("[getPhoneId]- phonId=" + result);
+ if (VDBG) logd("[getPhoneId]- phoneId=" + result);
return result;
}
@@ -583,23 +609,13 @@
Rlog.d(LOG_TAG, "[SubManager] " + msg);
}
- public static long normalizeSubId(long subId) {
- long retVal = (subId == DEFAULT_SUB_ID) ? getDefaultSubId() : subId;
- Rlog.d(LOG_TAG, "[SubManager] normalizeSubId subId=" + retVal);
- return retVal;
- }
-
- public static boolean validSubId(long subId) {
- return (subId != DEFAULT_SUB_ID) && (subId != -1);
- }
-
/**
* @return the "system" defaultSubId on a voice capable device this
* will be getDefaultVoiceSubId() and on a data only device it will be
* getDefaultDataSubId().
*/
public static long getDefaultSubId() {
- long subId = 1;
+ long subId = INVALID_SUB_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -615,7 +631,7 @@
}
public static long getDefaultVoiceSubId() {
- long subId = 1;
+ long subId = INVALID_SUB_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -626,7 +642,7 @@
// ignore it
}
- if (VDBG) logd("getDefaultSubId, sub id = " + subId);
+ if (VDBG) logd("getDefaultVoiceSubId, sub id = " + subId);
return subId;
}
@@ -638,32 +654,68 @@
iSub.setDefaultVoiceSubId(subId);
}
} catch (RemoteException ex) {
- // ignore it
+ // ignore it
}
}
- public static long getPreferredSmsSubId() {
- // FIXME add framework support to get the preferred sub
- return getDefaultSubId();
+ public static SubInfoRecord getDefaultVoiceSubInfo() {
+ return getSubInfoUsingSubId(getDefaultVoiceSubId());
}
- public static long getPreferredDataSubId() {
- // FIXME add framework support to get the preferred sub
- return getDefaultSubId();
+ public static int getDefaultVoicePhoneId() {
+ return getPhoneId(getDefaultVoiceSubId());
}
- public static long getDefaultDataSubId() {
+ public static long getDefaultSmsSubId() {
+ long subId = INVALID_SUB_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- return iSub.getDefaultDataSubId();
- } else {
- return -1;
+ subId = iSub.getDefaultSmsSubId();
}
} catch (RemoteException ex) {
- return -1;
+ // ignore it
}
+
+ if (VDBG) logd("getDefaultSmsSubId, sub id = " + subId);
+ return subId;
+ }
+
+ public static void setDefaultSmsSubId(long subId) {
+ if (VDBG) logd("setDefaultSmsSubId sub id = " + subId);
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ iSub.setDefaultSmsSubId(subId);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ }
+
+ public static SubInfoRecord getDefaultSmsSubInfo() {
+ return getSubInfoUsingSubId(getDefaultSmsSubId());
+ }
+
+ public static int getDefaultSmsPhoneId() {
+ return getPhoneId(getDefaultSmsSubId());
+ }
+
+ public static long getDefaultDataSubId() {
+ long subId = INVALID_SUB_ID;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ subId = iSub.getDefaultDataSubId();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ if (VDBG) logd("getDefaultDataSubId, sub id = " + subId);
+ return subId;
}
public static void setDefaultDataSubId(long subId) {
@@ -674,14 +726,19 @@
iSub.setDefaultDataSubId(subId);
}
} catch (RemoteException ex) {
- // ignore it
+ // ignore it
}
}
- public static void clearSubInfo()
- {
- if (VDBG) logd("[clearSubInfo]+");
+ public static SubInfoRecord getDefaultDataSubInfo() {
+ return getSubInfoUsingSubId(getDefaultDataSubId());
+ }
+ public static int getDefaultDataPhoneId() {
+ return getPhoneId(getDefaultDataSubId());
+ }
+
+ public static void clearSubInfo() {
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
@@ -694,10 +751,53 @@
return;
}
+ //FIXME this is vulnerable to race conditions
+ public static boolean allDefaultsSelected() {
+ if (getDefaultDataSubId() == INVALID_SUB_ID) {
+ return false;
+ }
+ if (getDefaultSmsSubId() == INVALID_SUB_ID) {
+ return false;
+ }
+ if (getDefaultVoiceSubId() == INVALID_SUB_ID) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * If a default is set to subscription which is not active, this will reset that default back to
+ * INVALID_SUB_ID.
+ */
+ public static void clearDefaultsForInactiveSubIds() {
+ if (VDBG) logd("clearDefaultsForInactiveSubIds");
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ iSub.clearDefaultsForInactiveSubIds();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ }
+
+ public static boolean isValidSubId(long subId) {
+ return subId > INVALID_SUB_ID ;
+ }
+
+ public static boolean isValidSlotId(int slotId) {
+ return slotId > INVALID_SLOT_ID && slotId < TelephonyManager.getDefault().getSimCount();
+ }
+
+ public static boolean isValidPhoneId(int phoneId) {
+ return phoneId > INVALID_PHONE_ID
+ && phoneId < TelephonyManager.getDefault().getPhoneCount();
+ }
+
public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId) {
- long [] subId = SubscriptionManager.getSubId(phoneId);
- if ((subId != null) && (subId.length >= 1)) {
- putPhoneIdAndSubIdExtra(intent, phoneId, subId[0]);
+ long[] subIds = SubscriptionManager.getSubId(phoneId);
+ if (subIds != null && subIds.length > 0) {
+ putPhoneIdAndSubIdExtra(intent, phoneId, subIds[0]);
} else {
logd("putPhoneIdAndSubIdExtra: no valid subs");
}
@@ -705,8 +805,35 @@
public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, long subId) {
if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
- intent.putExtra(PhoneConstants.SLOT_KEY, phoneId); //FIXME: RENAME TO PHONE_ID_KEY ??
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
+ intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
+ //FIXME this is using phoneId and slotId interchangeably
+ //Eventually, this should be removed as it is not the slot id
+ intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
+ }
+
+ /**
+ * @return the list of subId's that are active,
+ * is never null but the length maybe 0.
+ */
+ public static long[] getActiveSubIdList() {
+ long[] subId = null;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ subId = iSub.getActiveSubIdList();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ if (subId == null) {
+ subId = new long[0];
+ }
+
+ return subId;
+
}
}
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index 6021ccf..e3b7d59 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -56,7 +56,7 @@
* @param context Context provided by caller
* @return Array list of currently inserted SubInfoRecord(s)
*/
- List<SubInfoRecord> getActivatedSubInfoList();
+ List<SubInfoRecord> getActiveSubInfoList();
/**
* Get the SUB count of all SUB(s) in subinfo database
@@ -66,6 +66,13 @@
int getAllSubInfoCount();
/**
+ * Get the count of active SUB(s)
+ * @param context Context provided by caller
+ * @return active SIM count
+ */
+ int getActiveSubInfoCount();
+
+ /**
* Add a new SubInfoRecord to subinfo database if needed
* @param context Context provided by caller
* @param iccId the IccId of the SIM card
@@ -109,7 +116,7 @@
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
*/
- int setDispalyNumber(String number, long subId);
+ int setDisplayNumber(String number, long subId);
/**
* Set number display format. 0: none, 1: the first four digits, 2: the last four digits
@@ -150,4 +157,12 @@
long getDefaultVoiceSubId();
void setDefaultVoiceSubId(long subId);
+
+ long getDefaultSmsSubId();
+
+ void setDefaultSmsSubId(long subId);
+
+ void clearDefaultsForInactiveSubIds();
+
+ long[] getActiveSubIdList();
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index b4b1ea5..62b5596 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -136,14 +136,6 @@
/** APN type for IA Emergency PDN */
public static final String APN_TYPE_EMERGENCY = "emergency";
- // FIXME: This looks to be used as default phoneId, rename
- // or use SubscriptionManager.DEFAULT_SUB_ID
- public static final int DEFAULT_SUBSCRIPTION = 0;
-
- // FIXME: This looks to be used as invalid phoneId, rename
- // or use SubscriptionManager.INVALID_SUB_ID
- public static final int INVALID_SUBSCRIPTION = -1;
-
public static final int RIL_CARD_MAX_APPS = 8;
public static final int DEFAULT_CARD_INDEX = 0;
@@ -154,10 +146,14 @@
public static final int MAX_PHONE_COUNT_TRI_SIM = 3;
- public static final String SUBSCRIPTION_KEY = "subscription";
+ public static final String PHONE_KEY = "phone";
public static final String SLOT_KEY = "slot";
+ // FIXME: This is used to pass a subId via intents, we need to look at its usage, which is
+ // FIXME: extensive, and see if this should be an array of all active subId's or ...?
+ public static final String SUBSCRIPTION_KEY = "subscription";
+
public static final String SUB_SETTING = "subSettings";
public static final int SUB1 = 0;
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index 85ceefd..e7aca90 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -391,4 +391,14 @@
*/
public static final String ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED
= "android.intent.action.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED";
+
+ /**
+ * Broadcast Action: The default sms subscription has changed. This has the following
+ * extra values:</p>
+ * <ul>
+ * <li><em>subscription</em> - A int, the current sms default subscription.</li>
+ * </ul>
+ */
+ public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED
+ = "android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED";
}