diff --git a/api/current.txt b/api/current.txt index c45cc3dbbf47e..913985b6f5797 100644 --- a/api/current.txt +++ b/api/current.txt @@ -26976,7 +26976,10 @@ package android.provider { public static final class Telephony.Sms.Intents { method public static android.telephony.SmsMessage[] getMessagesFromIntent(android.content.Intent); field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.provider.Telephony.ACTION_CHANGE_DEFAULT"; + field public static final java.lang.String ACTION_DEFAULT_SMS_PACKAGE_CHANGED = "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED"; + field public static final java.lang.String ACTION_EXTERNAL_PROVIDER_CHANGE = "android.provider.action.EXTERNAL_PROVIDER_CHANGE"; field public static final java.lang.String DATA_SMS_RECEIVED_ACTION = "android.intent.action.DATA_SMS_RECEIVED"; + field public static final java.lang.String EXTRA_IS_DEFAULT_SMS_APP = "android.provider.extra.IS_DEFAULT_SMS_APP"; field public static final java.lang.String EXTRA_PACKAGE_NAME = "package"; field public static final int RESULT_SMS_DUPLICATED = 5; // 0x5 field public static final int RESULT_SMS_GENERIC_ERROR = 2; // 0x2 @@ -30558,6 +30561,7 @@ package android.telephony { field public static final java.lang.String KEY_AUTO_RETRY_ENABLED_BOOL = "auto_retry_enabled_bool"; field public static final java.lang.String KEY_CARRIER_ALLOW_TURNOFF_IMS_BOOL = "carrier_allow_turnoff_ims_bool"; field public static final java.lang.String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool"; + field public static final java.lang.String KEY_CARRIER_USE_IMS_FIRST_FOR_EMERGENCY_BOOL = "carrier_use_ims_first_for_emergency_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL = "carrier_volte_provisioning_required_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool"; diff --git a/api/system-current.txt b/api/system-current.txt index 1e7b94e883e4c..9401676fb666b 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -29036,7 +29036,10 @@ package android.provider { public static final class Telephony.Sms.Intents { method public static android.telephony.SmsMessage[] getMessagesFromIntent(android.content.Intent); field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.provider.Telephony.ACTION_CHANGE_DEFAULT"; + field public static final java.lang.String ACTION_DEFAULT_SMS_PACKAGE_CHANGED = "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED"; + field public static final java.lang.String ACTION_EXTERNAL_PROVIDER_CHANGE = "android.provider.action.EXTERNAL_PROVIDER_CHANGE"; field public static final java.lang.String DATA_SMS_RECEIVED_ACTION = "android.intent.action.DATA_SMS_RECEIVED"; + field public static final java.lang.String EXTRA_IS_DEFAULT_SMS_APP = "android.provider.extra.IS_DEFAULT_SMS_APP"; field public static final java.lang.String EXTRA_PACKAGE_NAME = "package"; field public static final int RESULT_SMS_DUPLICATED = 5; // 0x5 field public static final int RESULT_SMS_GENERIC_ERROR = 2; // 0x2 @@ -32799,6 +32802,7 @@ package android.telephony { field public static final java.lang.String KEY_AUTO_RETRY_ENABLED_BOOL = "auto_retry_enabled_bool"; field public static final java.lang.String KEY_CARRIER_ALLOW_TURNOFF_IMS_BOOL = "carrier_allow_turnoff_ims_bool"; field public static final java.lang.String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool"; + field public static final java.lang.String KEY_CARRIER_USE_IMS_FIRST_FOR_EMERGENCY_BOOL = "carrier_use_ims_first_for_emergency_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL = "carrier_volte_provisioning_required_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool"; diff --git a/core/java/android/content/pm/UserInfo.java b/core/java/android/content/pm/UserInfo.java index c03be32f2f010..4d9c17693fab9 100644 --- a/core/java/android/content/pm/UserInfo.java +++ b/core/java/android/content/pm/UserInfo.java @@ -37,8 +37,8 @@ public class UserInfo implements Parcelable { */ /** - * Primary user. Only one user can have this flag set. Meaning of this - * flag TBD. + * Primary user. Only one user can have this flag set. It identifies the first human user + * on a device. */ public static final int FLAG_PRIMARY = 0x00000001; diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl index 64877aa69c4d5..364c0eb4f3264 100644 --- a/core/java/android/os/IUserManager.aidl +++ b/core/java/android/os/IUserManager.aidl @@ -40,6 +40,7 @@ interface IUserManager { void setUserName(int userHandle, String name); void setUserIcon(int userHandle, in Bitmap icon); ParcelFileDescriptor getUserIcon(int userHandle); + UserInfo getPrimaryUser(); List getUsers(boolean excludeDying); List getProfiles(int userHandle, boolean enabledOnly); boolean canAddMoreManagedProfiles(); diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java index bfca719555f93..48ede4f015858 100644 --- a/core/java/android/os/UserHandle.java +++ b/core/java/android/os/UserHandle.java @@ -55,12 +55,26 @@ public final class UserHandle implements Parcelable { /** @hide An undefined user id */ public static final int USER_NULL = -10000; - /** @hide A user id constant to indicate the "owner" user of the device */ + /** + * @hide A user id constant to indicate the "owner" user of the device + * @deprecated Consider using either USER_SYSTEM constant or + * UserInfo.isPrimary(). + */ public static final int USER_OWNER = 0; - /** @hide A user handle to indicate the primary/owner user of the device */ + /** + * @hide A user handle to indicate the primary/owner user of the device + * @deprecated Consider using either SYSTEM constant or + * UserInfo.isPrimary(). + */ public static final UserHandle OWNER = new UserHandle(USER_OWNER); + /** @hide A user id constant to indicate the "system" user of the device */ + public static final int USER_SYSTEM = 0; + + /** @hide A user handle to indicate the "system" user of the device */ + public static final UserHandle SYSTEM = new UserHandle(USER_SYSTEM); + /** * @hide Enable multi-user related side effects. Set this to false if * there are problems with single user use-cases. @@ -120,7 +134,7 @@ public final class UserHandle implements Parcelable { if (MU_ENABLED) { return uid / PER_USER_RANGE; } else { - return 0; + return UserHandle.USER_SYSTEM; } } diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 045c1e88ec010..e2cf08e5039e4 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -562,6 +562,18 @@ public class UserManager { .isPackageAvailable("com.coffeestainstudios.goatsimulator"); } + /** + * Used to check if this process is running under the primary user. The primary user + * is the first human user on a device. + * + * @return whether this process is running under the primary user. + * @hide + */ + public boolean isPrimaryUser() { + UserInfo user = getUserInfo(UserHandle.myUserId()); + return user != null ? user.isPrimary() : false; + } + /** * Used to check if this process is running under the system user. The system user * is the initial user that is implicitly created on first boot and hosts most of the @@ -570,9 +582,8 @@ public class UserManager { * @return whether this process is running under the system user. */ public boolean isSystemUser() { - return UserHandle.myUserId() == UserHandle.USER_OWNER; + return UserHandle.myUserId() == UserHandle.USER_SYSTEM; } - /** * @hide * Returns whether the caller is running as an admin user. There can be more than one admin @@ -970,6 +981,22 @@ public class UserManager { } } + /** + * Returns information for Primary user. + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * + * @return the Primary user, null if not found. + * @hide + */ + public UserInfo getPrimaryUser() { + try { + return mService.getPrimaryUser(); + } catch (RemoteException re) { + Log.w(TAG, "Could not get Primary user", re); + return null; + } + } + /** * Checks whether it's possible to add more users. Caller must hold the MANAGE_USERS * permission. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 746e11066d9b5..6a64817564af3 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -7497,6 +7497,18 @@ public final class Settings { public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL = "sms_short_codes_metadata_url"; + /** + * URL for apn_db updates + * @hide + */ + public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url"; + + /** + * URL for apn_db update metadata + * @hide + */ + public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url"; + /** * URL for cert pinlist updates * @hide @@ -7653,13 +7665,22 @@ public final class Settings { public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt"; /** - * Whether the Volte/VT is enabled + * Whether the Volte is enabled *

* Type: int (0 for false, 1 for true) * @hide */ public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled"; + /** + * Whether VT (Video Telephony over IMS) is enabled + *

+ * Type: int (0 for false, 1 for true) + * + * @hide + */ + public static final String VT_IMS_ENABLED = "vt_ims_enabled"; + /** * Whether WFC is enabled *

diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java index b6240e48a1fdc..9253ebbb4b2e2 100644 --- a/core/java/com/android/internal/logging/MetricsLogger.java +++ b/core/java/com/android/internal/logging/MetricsLogger.java @@ -27,6 +27,7 @@ import android.view.View; */ public class MetricsLogger implements MetricsConstants { // Temporary constants go here, to await migration to MetricsConstants. + // next value is 239; public static final int ACTION_ASSIST_LONG_PRESS = 239; public static final int FINGERPRINT_ENROLLING = 240; @@ -46,6 +47,7 @@ public class MetricsLogger implements MetricsConstants { public static final int ACTION_FINGERPRINT_RENAME = 254; public static final int ACTION_DOUBLE_TAP_POWER_CAMERA_GESTURE = 255; public static final int ACTION_WIGGLE_CAMERA_GESTURE = 256; + public static final int ACTION_DEFAULT_SMS_APP_CHANGED = 264; public static void visible(Context context, int category) throws IllegalArgumentException { if (Build.IS_DEBUGGABLE && category == VIEW_UNKNOWN) { diff --git a/core/java/com/android/internal/util/StateMachine.java b/core/java/com/android/internal/util/StateMachine.java index 447292c9f3575..be78a129aada1 100644 --- a/core/java/com/android/internal/util/StateMachine.java +++ b/core/java/com/android/internal/util/StateMachine.java @@ -1878,6 +1878,33 @@ public class StateMachine { } } + /** + * Check if there are any pending messages with code 'what' in deferred messages queue. + */ + protected final boolean hasDeferredMessages(int what) { + SmHandler smh = mSmHandler; + if (smh == null) return false; + + Iterator iterator = smh.mDeferredMessages.iterator(); + while (iterator.hasNext()) { + Message msg = iterator.next(); + if (msg.what == what) return true; + } + + return false; + } + + /** + * Check if there are any pending posts of messages with code 'what' in + * the message queue. This does NOT check messages in deferred message queue. + */ + protected final boolean hasMessages(int what) { + SmHandler smh = mSmHandler; + if (smh == null) return false; + + return smh.hasMessages(what); + } + /** * Validate that the message was sent by * {@link StateMachine#quit} or {@link StateMachine#quitNow}. diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 28933e1045ac8..7f25d67268305 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2845,6 +2845,14 @@ + + + + + + + diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 392e503ea4ef8..618b9907a4b7e 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2085,10 +2085,6 @@ IMS service implementation will do both.i.e.hold followed by merge. --> true - - true - diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index cbccd19122045..e45527b2dbc8a 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2163,7 +2163,6 @@ - diff --git a/services/core/java/com/android/server/location/GpsLocationProvider.java b/services/core/java/com/android/server/location/GpsLocationProvider.java index 4f42f83042002..9216f071929e8 100644 --- a/services/core/java/com/android/server/location/GpsLocationProvider.java +++ b/services/core/java/com/android/server/location/GpsLocationProvider.java @@ -499,6 +499,12 @@ public class GpsLocationProvider implements LocationProviderInterface { private void checkSmsSuplInit(Intent intent) { SmsMessage[] messages = Intents.getMessagesFromIntent(intent); + + if (messages == null) { + Log.e(TAG, "Message does not exist in the intent."); + return; + } + for (int i=0; i getUsers(boolean excludeDying) { checkManageUsersPermission("query users"); @@ -836,22 +850,23 @@ public class UserManagerService extends IUserManager.Stub { } private void fallbackToSingleUserLocked() { - // Create the primary user - UserInfo primary = new UserInfo(UserHandle.USER_OWNER, + // Create the system user + // TODO: UserInfo.FLAG_PRIMARY flag should be set on the first human user. + UserInfo system = new UserInfo(UserHandle.USER_SYSTEM, mContext.getResources().getString(com.android.internal.R.string.owner_name), null, UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY | UserInfo.FLAG_INITIALIZED); - mUsers.put(0, primary); + mUsers.put(system.id, system); mNextSerialNumber = MIN_USER_ID; mUserVersion = USER_VERSION; Bundle restrictions = new Bundle(); - mUserRestrictions.append(UserHandle.USER_OWNER, restrictions); + mUserRestrictions.append(UserHandle.USER_SYSTEM, restrictions); updateUserIdsLocked(); initDefaultGuestRestrictions(); writeUserListLocked(); - writeUserLocked(primary); + writeUserLocked(system); } private void scheduleWriteUserLocked(UserInfo userInfo) { diff --git a/services/core/java/com/android/server/updates/ApnDbInstallReceiver.java b/services/core/java/com/android/server/updates/ApnDbInstallReceiver.java new file mode 100644 index 0000000000000..3b6f9d6c135c5 --- /dev/null +++ b/services/core/java/com/android/server/updates/ApnDbInstallReceiver.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.updates; + +import android.content.ContentResolver; +import android.content.ContentUris; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.provider.Telephony; + +public class ApnDbInstallReceiver extends ConfigUpdateInstallReceiver { + + private static final Uri UPDATE_APN_DB = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, + "update_db"); + + public ApnDbInstallReceiver() { + super("/data/misc/", "apns-conf.xml", "metadata/", "version"); + } + + @Override + protected void postInstall(Context context, Intent intent) { + ContentResolver resolver = context.getContentResolver(); + resolver.delete(UPDATE_APN_DB, null, null); + } +} diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 0e475b0d2eb97..0619d76e2e037 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -432,6 +432,7 @@ public final class SystemServer { NsdService serviceDiscovery= null; WindowManagerService wm = null; UsbService usb = null; + BluetoothManagerService bluetooth = null; SerialService serial = null; NetworkTimeUpdateService networkTimeUpdater = null; CommonTimeManagementService commonTimeMgmtService = null; @@ -441,7 +442,6 @@ public final class SystemServer { AudioService audioService = null; MmsServiceBroker mmsService = null; EntropyMixer entropyMixer = null; - CameraService cameraService = null; boolean disableStorage = SystemProperties.getBoolean("config.disable_storage", false); boolean disableBluetooth = SystemProperties.getBoolean("config.disable_bluetooth", false); @@ -1333,7 +1333,7 @@ public final class SystemServer { intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); //Slog.d(TAG, "Starting service: " + intent); - context.startServiceAsUser(intent, UserHandle.OWNER); + context.startServiceAsUser(intent, UserHandle.SYSTEM); } private static void traceBeginAndSlog(String name) { diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index 77fdb65f638f2..094b3a94bd7b6 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -65,6 +65,7 @@ public abstract class Conference extends Conferenceable { private final List mUnmodifiableConferenceableConnections = Collections.unmodifiableList(mConferenceableConnections); + private String mTelecomCallId; private PhoneAccountHandle mPhoneAccount; private CallAudioState mCallAudioState; private int mState = Connection.STATE_NEW; @@ -93,6 +94,26 @@ public abstract class Conference extends Conferenceable { mPhoneAccount = phoneAccount; } + /** + * Returns the telecom internal call ID associated with this conference. + * + * @return The telecom call ID. + * @hide + */ + public final String getTelecomCallId() { + return mTelecomCallId; + } + + /** + * Sets the telecom internal call ID associated with this conference. + * + * @param telecomCallId The telecom call ID. + * @hide + */ + public final void setTelecomCallId(String telecomCallId) { + mTelecomCallId = telecomCallId; + } + /** * Returns the {@link PhoneAccountHandle} the conference call is being placed through. * diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 430760a892b7c..41157565bfddc 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -1074,6 +1074,8 @@ public abstract class Connection extends Conferenceable { private final List mUnmodifiableConferenceables = Collections.unmodifiableList(mConferenceables); + // The internal telecom call ID associated with this connection. + private String mTelecomCallId; private int mState = STATE_NEW; private CallAudioState mCallAudioState; private Uri mAddress; @@ -1097,6 +1099,17 @@ public abstract class Connection extends Conferenceable { */ public Connection() {} + /** + * Returns the Telecom internal call ID associated with this connection. Should only be used + * for debugging and tracing purposes. + * + * @return The Telecom call ID. + * @hide + */ + public final String getTelecomCallId() { + return mTelecomCallId; + } + /** * @return The address (e.g., phone number) to which this Connection is currently communicating. */ @@ -1258,6 +1271,17 @@ public abstract class Connection extends Conferenceable { return mDisconnectCause; } + /** + * Sets the telecom call ID associated with this Connection. The Telecom Call ID should be used + * ONLY for debugging purposes. + * + * @param callId The telecom call ID. + * @hide + */ + public void setTelecomCallId(String callId) { + mTelecomCallId = callId; + } + /** * Inform this Connection that the state of its audio output has been changed externally. * diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java index 686321476bd18..aba38fe8a376e 100644 --- a/telecomm/java/android/telecom/ConnectionRequest.java +++ b/telecomm/java/android/telecom/ConnectionRequest.java @@ -32,6 +32,7 @@ public final class ConnectionRequest implements Parcelable { private final Uri mAddress; private final Bundle mExtras; private final int mVideoState; + private final String mTelecomCallId; /** * @param accountHandle The accountHandle which should be used to place the call. @@ -42,7 +43,7 @@ public final class ConnectionRequest implements Parcelable { PhoneAccountHandle accountHandle, Uri handle, Bundle extras) { - this(accountHandle, handle, extras, VideoProfile.STATE_AUDIO_ONLY); + this(accountHandle, handle, extras, VideoProfile.STATE_AUDIO_ONLY, null); } /** @@ -56,10 +57,28 @@ public final class ConnectionRequest implements Parcelable { Uri handle, Bundle extras, int videoState) { + this(accountHandle, handle, extras, videoState, null); + } + + /** + * @param accountHandle The accountHandle which should be used to place the call. + * @param handle The handle (e.g., phone number) to which the {@link Connection} is to connect. + * @param extras Application-specific extra data. + * @param videoState Determines the video state for the connection. + * @param telecomCallId The telecom call ID. + * @hide + */ + public ConnectionRequest( + PhoneAccountHandle accountHandle, + Uri handle, + Bundle extras, + int videoState, + String telecomCallId) { mAccountHandle = accountHandle; mAddress = handle; mExtras = extras; mVideoState = videoState; + mTelecomCallId = telecomCallId; } private ConnectionRequest(Parcel in) { @@ -67,6 +86,7 @@ public final class ConnectionRequest implements Parcelable { mAddress = in.readParcelable(getClass().getClassLoader()); mExtras = in.readParcelable(getClass().getClassLoader()); mVideoState = in.readInt(); + mTelecomCallId = in.readString(); } /** @@ -99,6 +119,16 @@ public final class ConnectionRequest implements Parcelable { return mVideoState; } + /** + * Returns the internal Telecom ID associated with the connection request. + * + * @return The Telecom ID. + * @hide + */ + public String getTelecomCallId() { + return mTelecomCallId; + } + @Override public String toString() { return String.format("ConnectionRequest %s %s", @@ -134,5 +164,6 @@ public final class ConnectionRequest implements Parcelable { destination.writeParcelable(mAddress, 0); destination.writeParcelable(mExtras, 0); destination.writeInt(mVideoState); + destination.writeString(mTelecomCallId); } } diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 4e330bdbf67d9..62234958517d9 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -116,6 +116,8 @@ public abstract class ConnectionService extends Service { private boolean mAreAccountsInitialized = false; private Conference sNullConference; + private Object mIdSyncRoot = new Object(); + private int mId = 0; private final IBinder mBinder = new IConnectionService.Stub() { @Override @@ -629,7 +631,8 @@ public abstract class ConnectionService extends Service { boolean isIncoming, boolean isUnknown) { Log.d(this, "createConnection, callManagerAccount: %s, callId: %s, request: %s, " + - "isIncoming: %b, isUnknown: %b", callManagerAccount, callId, request, isIncoming, + "isIncoming: %b, isUnknown: %b", callManagerAccount, callId, request, + isIncoming, isUnknown); Connection connection = isUnknown ? onCreateUnknownConnection(callManagerAccount, request) @@ -641,6 +644,7 @@ public abstract class ConnectionService extends Service { new DisconnectCause(DisconnectCause.ERROR)); } + connection.setTelecomCallId(callId); if (connection.getState() != Connection.STATE_DISCONNECTED) { addConnection(callId, connection); } @@ -953,6 +957,7 @@ public abstract class ConnectionService extends Service { connectionIds.add(mIdByConnection.get(connection)); } } + conference.setTelecomCallId(id); ParcelableConference parcelableConference = new ParcelableConference( conference.getPhoneAccountHandle(), conference.getState(), @@ -989,7 +994,7 @@ public abstract class ConnectionService extends Service { public final void addExistingConnection(PhoneAccountHandle phoneAccountHandle, Connection connection) { - String id = addExistingConnectionInternal(connection); + String id = addExistingConnectionInternal(phoneAccountHandle, connection); if (id != null) { List emptyList = new ArrayList<>(0); @@ -1151,18 +1156,29 @@ public abstract class ConnectionService extends Service { } /** - * Adds an existing connection to the list of connections, identified by a new UUID. + * Adds an existing connection to the list of connections, identified by a new call ID unique + * to this connection service. * * @param connection The connection. - * @return The UUID of the connection (e.g. the call-id). + * @return The ID of the connection (e.g. the call-id). */ - private String addExistingConnectionInternal(Connection connection) { - String id = UUID.randomUUID().toString(); + private String addExistingConnectionInternal(PhoneAccountHandle handle, Connection connection) { + String id; + if (handle == null) { + // If no phone account handle was provided, we cannot be sure the call ID is unique, + // so just use a random UUID. + id = UUID.randomUUID().toString(); + } else { + // Phone account handle was provided, so use the ConnectionService class name as a + // prefix for a unique incremental call ID. + id = handle.getComponentName().getClassName() + "@" + getNextCallId(); + } addConnection(id, connection); return id; } private void addConnection(String callId, Connection connection) { + connection.setTelecomCallId(callId); mConnectionById.put(callId, connection); mIdByConnection.put(connection, callId); connection.addConnectionListener(mConnectionListener); @@ -1183,6 +1199,9 @@ public abstract class ConnectionService extends Service { if (mIdByConference.containsKey(conference)) { Log.w(this, "Re-adding an existing conference: %s.", conference); } else if (conference != null) { + // Conferences do not (yet) have a PhoneAccountHandle associated with them, so we + // cannot determine a ConnectionService class name to associate with the ID, so use + // a unique UUID (for now). String id = UUID.randomUUID().toString(); mConferenceById.put(id, conference); mIdByConference.put(conference, id); @@ -1284,4 +1303,15 @@ public abstract class ConnectionService extends Service { conference.onDisconnect(); } } + + /** + * Retrieves the next call ID as maintainted by the connection service. + * + * @return The call ID. + */ + private int getNextCallId() { + synchronized(mIdSyncRoot) { + return ++mId; + } + } } diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 29e54a32a4801..5392a5a3f43a3 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -282,6 +282,13 @@ public class CarrierConfigManager { public static final String KEY_CARRIER_INSTANT_LETTERING_AVAILABLE_BOOL = "carrier_instant_lettering_available_bool"; + /* + * Flag specifying whether IMS should be the first phone attempted for E911 even if the + * phone is not in service. + */ + public static final String KEY_CARRIER_USE_IMS_FIRST_FOR_EMERGENCY_BOOL + = "carrier_use_ims_first_for_emergency_bool"; + /** * When IMS instant lettering is available for a carrier (see * {@link #KEY_CARRIER_INSTANT_LETTERING_AVAILABLE_BOOL}), determines the list of characters @@ -514,6 +521,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_CARRIER_INSTANT_LETTERING_AVAILABLE_BOOL, false); sDefaults.putString(KEY_CARRIER_INSTANT_LETTERING_INVALID_CHARS_STRING, ""); sDefaults.putString(KEY_CARRIER_INSTANT_LETTERING_ESCAPED_CHARS_STRING, ""); + sDefaults.putBoolean(KEY_CARRIER_USE_IMS_FIRST_FOR_EMERGENCY_BOOL, true); sDefaults.putBoolean(KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL, false); sDefaults.putBoolean(KEY_DTMF_TYPE_ENABLED_BOOL, false); sDefaults.putBoolean(KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL, true); diff --git a/telephony/java/android/telephony/CellLocation.java b/telephony/java/android/telephony/CellLocation.java index f9a222f22640a..5bcaa6e745313 100644 --- a/telephony/java/android/telephony/CellLocation.java +++ b/telephony/java/android/telephony/CellLocation.java @@ -80,6 +80,12 @@ public abstract class CellLocation { */ public abstract boolean isEmpty(); + /** + * Invalidate this object. The location area code and the cell id are set to -1. + * @hide + */ + public abstract void setStateInvalid(); + /** * Return a new CellLocation object representing an unknown * location, or null for unknown/none phone radio types. diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index b430340a89634..553221d579ec5 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -2354,7 +2354,7 @@ public class PhoneNumberUtils tempDialStr = postDialStr.substring(dialableIndex); } else { // Non-dialable character such as P/W should not be at the end of - // the dial string after P/W processing in CdmaConnection.java + // the dial string after P/W processing in GsmCdmaConnection.java // Set the postDialStr to "" to break out of the loop if (dialableIndex < 0) { postDialStr = ""; diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 13374879f09b9..8537f9cf2f860 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -906,7 +906,7 @@ public class ServiceState implements Parcelable { /** * In CDMA, mOperatorAlphaLong can be set from the ERI text. - * This is done from the CDMAPhone and not from the CdmaServiceStateTracker. + * This is done from the GsmCdmaPhone and not from the ServiceStateTracker. * * @hide */ diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 32b7383ff9a54..36407e195ac64 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -75,7 +75,7 @@ public class SubscriptionManager { /** * Indicates the caller wants the default phone id. - * Used in SubscriptionController and PhoneBase but do we really need it??? + * Used in SubscriptionController and Phone but do we really need it??? * @hide */ public static final int DEFAULT_PHONE_INDEX = Integer.MAX_VALUE; diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 6b1b6296262a3..3b281e222bd80 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -4848,4 +4848,21 @@ public class TelephonyManager { } return null; } -} + + /** + * Returns the service state information on specified subscription. Callers require + * either READ_PRIVILEGED_PHONE_STATE or READ_PHONE_STATE to retrieve the information. + * @hide + */ + public ServiceState getServiceStateForSubscriber(int subId) { + try { + ITelephony service = getITelephony(); + if (service != null) { + return service.getServiceStateForSubscriber(subId, getOpPackageName()); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#getServiceStateForSubscriber", e); + } + return null; + } +} \ No newline at end of file diff --git a/telephony/java/android/telephony/cdma/CdmaCellLocation.java b/telephony/java/android/telephony/cdma/CdmaCellLocation.java index 6cfae6a79b4e5..7c10569f33769 100644 --- a/telephony/java/android/telephony/cdma/CdmaCellLocation.java +++ b/telephony/java/android/telephony/cdma/CdmaCellLocation.java @@ -123,6 +123,7 @@ public class CdmaCellLocation extends CellLocation { /** * Invalidate this object. The cell location data is set to invalid values. */ + @Override public void setStateInvalid() { this.mBaseStationId = -1; this.mBaseStationLatitude = INVALID_LAT_LONG; @@ -134,7 +135,7 @@ public class CdmaCellLocation extends CellLocation { /** * Set the cell location data. */ - public void setCellLocationData(int baseStationId, int baseStationLatitude, + public void setCellLocationData(int baseStationId, int baseStationLatitude, int baseStationLongitude) { // The following values have to be written in the correct sequence this.mBaseStationId = baseStationId; diff --git a/telephony/java/android/telephony/gsm/GsmCellLocation.java b/telephony/java/android/telephony/gsm/GsmCellLocation.java index a3889b223b52c..171780239edfd 100644 --- a/telephony/java/android/telephony/gsm/GsmCellLocation.java +++ b/telephony/java/android/telephony/gsm/GsmCellLocation.java @@ -72,6 +72,7 @@ public class GsmCellLocation extends CellLocation { /** * Invalidate this object. The location area code and the cell id are set to -1. */ + @Override public void setStateInvalid() { mLac = -1; mCid = -1; diff --git a/telephony/java/com/android/internal/telephony/GsmAlphabet.java b/telephony/java/com/android/internal/telephony/GsmAlphabet.java index ef39a6c263897..478516952c1ac 100644 --- a/telephony/java/com/android/internal/telephony/GsmAlphabet.java +++ b/telephony/java/com/android/internal/telephony/GsmAlphabet.java @@ -1012,7 +1012,7 @@ public class GsmAlphabet { * * @param tables the new list of enabled single shift tables */ - static synchronized void setEnabledSingleShiftTables(int[] tables) { + public static synchronized void setEnabledSingleShiftTables(int[] tables) { sEnabledSingleShiftTables = tables; sDisableCountryEncodingCheck = true; @@ -1030,7 +1030,7 @@ public class GsmAlphabet { * * @param tables the new list of enabled locking shift tables */ - static synchronized void setEnabledLockingShiftTables(int[] tables) { + public static synchronized void setEnabledLockingShiftTables(int[] tables) { sEnabledLockingShiftTables = tables; sDisableCountryEncodingCheck = true; } @@ -1042,7 +1042,7 @@ public class GsmAlphabet { * * @return the list of enabled single shift tables */ - static synchronized int[] getEnabledSingleShiftTables() { + public static synchronized int[] getEnabledSingleShiftTables() { return sEnabledSingleShiftTables; } @@ -1053,7 +1053,7 @@ public class GsmAlphabet { * * @return the list of enabled locking shift tables */ - static synchronized int[] getEnabledLockingShiftTables() { + public static synchronized int[] getEnabledLockingShiftTables() { return sEnabledLockingShiftTables; } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index dcece26d6c27c..8172e94c9c901 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -21,9 +21,10 @@ import android.os.Bundle; import android.telecom.PhoneAccount; import android.telephony.CellInfo; import android.telephony.IccOpenLogicalChannelResponse; +import android.telephony.ModemActivityInfo; import android.telephony.NeighboringCellInfo; import android.telephony.RadioAccessFamily; -import android.telephony.ModemActivityInfo; +import android.telephony.ServiceState; import com.android.internal.telephony.CellNetworkScanResult; import com.android.internal.telephony.OperatorInfo; import java.util.List; @@ -1005,4 +1006,12 @@ interface ITelephony { * Return the modem activity info. */ ModemActivityInfo getModemActivityInfo(); + + /** + * Get the service state on specified subscription + * @param subId Subscription id + * @param callingPackage The package making the call + * @return Service state on specified subscription. + */ + ServiceState getServiceStateForSubscriber(int subId, String callingPackage); } diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index 572cc6fb4bb9f..a183de5c73963 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -59,6 +59,9 @@ public class PhoneConstants { public static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE; public static final int PHONE_TYPE_THIRD_PARTY = RILConstants.THIRD_PARTY_PHONE; public static final int PHONE_TYPE_IMS = RILConstants.IMS_PHONE; + // Currently this is used only to differentiate CDMA and CDMALTE Phone in GsmCdma* files. For + // anything outside of that, a cdma + lte phone is still CDMA_PHONE + public static final int PHONE_TYPE_CDMA_LTE = RILConstants.CDMA_LTE_PHONE; // Modes for LTE_ON_CDMA public static final int LTE_ON_CDMA_UNKNOWN = RILConstants.LTE_ON_CDMA_UNKNOWN; diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 7088be8284083..3c4c04b36ae90 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -118,6 +118,7 @@ public interface RILConstants { int SIP_PHONE = 3; int THIRD_PARTY_PHONE = 4; int IMS_PHONE = 5; + int CDMA_LTE_PHONE = 6; int LTE_ON_CDMA_UNKNOWN = -1; int LTE_ON_CDMA_FALSE = 0;