diff options
59 files changed, 1279 insertions, 335 deletions
diff --git a/Android.mk b/Android.mk index 623ceba9c65f..620b7a51ddde 100644 --- a/Android.mk +++ b/Android.mk @@ -432,10 +432,10 @@ LOCAL_SRC_FILES += \ telecomm/java/com/android/internal/telecom/IInCallService.aidl \ telecomm/java/com/android/internal/telecom/ITelecomService.aidl \ telecomm/java/com/android/internal/telecom/RemoteServiceCallback.aidl \ - telephony/java/android/telephony/mbms/IMbmsDownloadManagerListener.aidl \ - telephony/java/android/telephony/mbms/IMbmsStreamingManagerListener.aidl \ - telephony/java/android/telephony/mbms/IDownloadListener.aidl \ - telephony/java/android/telephony/mbms/IStreamingServiceListener.aidl \ + telephony/java/android/telephony/mbms/IMbmsDownloadManagerCallback.aidl \ + telephony/java/android/telephony/mbms/IMbmsStreamingManagerCallback.aidl \ + telephony/java/android/telephony/mbms/IDownloadCallback.aidl \ + telephony/java/android/telephony/mbms/IStreamingServiceCallback.aidl \ telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl \ telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl \ telephony/java/com/android/ims/internal/IImsCallSession.aidl \ diff --git a/api/current.txt b/api/current.txt index ad77f1f5e76d..79141f6565ea 100644 --- a/api/current.txt +++ b/api/current.txt @@ -7503,7 +7503,7 @@ package android.bluetooth.le { method public void setAdvertisingData(android.bluetooth.le.AdvertiseData); method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters); method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData); - method public void setPeriodicAdvertisingEnable(boolean); + method public void setPeriodicAdvertisingEnabled(boolean); method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters); method public void setScanResponseData(android.bluetooth.le.AdvertiseData); } @@ -7673,8 +7673,10 @@ package android.bluetooth.le { field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR; field public static final int DATA_COMPLETE = 0; // 0x0 field public static final int DATA_TRUNCATED = 2; // 0x2 + field public static final int PERIODIC_INTERVAL_NOT_PRESENT = 0; // 0x0 field public static final int PHY_UNUSED = 0; // 0x0 field public static final int SID_NOT_PRESENT = 255; // 0xff + field public static final int TX_POWER_NOT_PRESENT = 127; // 0x7f } public final class ScanSettings implements android.os.Parcelable { @@ -33781,6 +33783,8 @@ package android.provider { public static final class VoicemailContract.Voicemails implements android.provider.BaseColumns android.provider.OpenableColumns { method public static android.net.Uri buildSourceUri(java.lang.String); + field public static final java.lang.String ARCHIVED = "archived"; + field public static final java.lang.String BACKED_UP = "backed_up"; field public static final android.net.Uri CONTENT_URI; field public static final java.lang.String DATE = "date"; field public static final java.lang.String DELETED = "deleted"; @@ -33788,6 +33792,7 @@ package android.provider { field public static final java.lang.String DIR_TYPE = "vnd.android.cursor.dir/voicemails"; field public static final java.lang.String DURATION = "duration"; field public static final java.lang.String HAS_CONTENT = "has_content"; + field public static final java.lang.String IS_OMTP_VOICEMAIL = "is_omtp_voicemail"; field public static final java.lang.String IS_READ = "is_read"; field public static final java.lang.String ITEM_TYPE = "vnd.android.cursor.item/voicemail"; field public static final java.lang.String LAST_MODIFIED = "last_modified"; @@ -33795,6 +33800,7 @@ package android.provider { field public static final java.lang.String NUMBER = "number"; field public static final java.lang.String PHONE_ACCOUNT_COMPONENT_NAME = "subscription_component_name"; field public static final java.lang.String PHONE_ACCOUNT_ID = "subscription_id"; + field public static final java.lang.String RESTORED = "restored"; field public static final java.lang.String SOURCE_DATA = "source_data"; field public static final java.lang.String SOURCE_PACKAGE = "source_package"; field public static final java.lang.String TRANSCRIPTION = "transcription"; @@ -38119,7 +38125,6 @@ package android.telephony { method public android.os.PersistableBundle getCarrierConfig(); method public deprecated android.telephony.CellLocation getCellLocation(); method public int getDataActivity(); - method public boolean getDataEnabled(); method public int getDataNetworkType(); method public int getDataState(); method public deprecated java.lang.String getDeviceId(); @@ -38151,6 +38156,7 @@ package android.telephony { method public int getSimState(); method public int getSimState(int); method public java.lang.String getSubscriberId(); + method public java.lang.String getVisualVoicemailPackageName(); method public java.lang.String getVoiceMailAlphaTag(); method public java.lang.String getVoiceMailNumber(); method public int getVoiceNetworkType(); @@ -38164,6 +38170,7 @@ package android.telephony { method public java.lang.String iccTransmitApduBasicChannel(int, int, int, int, int, java.lang.String); method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String); method public boolean isConcurrentVoiceAndDataAllowed(); + method public boolean isDataEnabled(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isNetworkRoaming(); method public boolean isSmsCapable(); @@ -38174,7 +38181,6 @@ package android.telephony { method public void listen(android.telephony.PhoneStateListener, int); method public java.lang.String sendEnvelopeWithStatus(java.lang.String); method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler); - method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler); method public void setDataEnabled(boolean); method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String); method public boolean setOperatorBrandOverride(java.lang.String); @@ -38285,9 +38291,6 @@ package android.telephony { method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.telephony.VisualVoicemailSmsFilterSettings> CREATOR; - field public static final java.lang.String DEFAULT_CLIENT_PREFIX = "//VVM"; - field public static final int DEFAULT_DESTINATION_PORT = -1; // 0xffffffff - field public static final java.util.List<java.lang.String> DEFAULT_ORIGINATING_NUMBERS; field public static final int DESTINATION_PORT_ANY = -1; // 0xffffffff field public static final int DESTINATION_PORT_DATA_SMS = -2; // 0xfffffffe field public final java.lang.String clientPrefix; diff --git a/api/system-current.txt b/api/system-current.txt index fce33e5e705a..e4f3f6d3848a 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7808,7 +7808,7 @@ package android.bluetooth.le { method public void setAdvertisingData(android.bluetooth.le.AdvertiseData); method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters); method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData); - method public void setPeriodicAdvertisingEnable(boolean); + method public void setPeriodicAdvertisingEnabled(boolean); method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters); method public void setScanResponseData(android.bluetooth.le.AdvertiseData); } @@ -7991,8 +7991,10 @@ package android.bluetooth.le { field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR; field public static final int DATA_COMPLETE = 0; // 0x0 field public static final int DATA_TRUNCATED = 2; // 0x2 + field public static final int PERIODIC_INTERVAL_NOT_PRESENT = 0; // 0x0 field public static final int PHY_UNUSED = 0; // 0x0 field public static final int SID_NOT_PRESENT = 255; // 0xff + field public static final int TX_POWER_NOT_PRESENT = 127; // 0x7f } public final class ScanSettings implements android.os.Parcelable { @@ -36623,6 +36625,8 @@ package android.provider { public static final class VoicemailContract.Voicemails implements android.provider.BaseColumns android.provider.OpenableColumns { method public static android.net.Uri buildSourceUri(java.lang.String); + field public static final java.lang.String ARCHIVED = "archived"; + field public static final java.lang.String BACKED_UP = "backed_up"; field public static final android.net.Uri CONTENT_URI; field public static final java.lang.String DATE = "date"; field public static final java.lang.String DELETED = "deleted"; @@ -36630,6 +36634,7 @@ package android.provider { field public static final java.lang.String DIR_TYPE = "vnd.android.cursor.dir/voicemails"; field public static final java.lang.String DURATION = "duration"; field public static final java.lang.String HAS_CONTENT = "has_content"; + field public static final java.lang.String IS_OMTP_VOICEMAIL = "is_omtp_voicemail"; field public static final java.lang.String IS_READ = "is_read"; field public static final java.lang.String ITEM_TYPE = "vnd.android.cursor.item/voicemail"; field public static final java.lang.String LAST_MODIFIED = "last_modified"; @@ -36637,6 +36642,7 @@ package android.provider { field public static final java.lang.String NUMBER = "number"; field public static final java.lang.String PHONE_ACCOUNT_COMPONENT_NAME = "subscription_component_name"; field public static final java.lang.String PHONE_ACCOUNT_ID = "subscription_id"; + field public static final java.lang.String RESTORED = "restored"; field public static final java.lang.String SOURCE_DATA = "source_data"; field public static final java.lang.String SOURCE_PACKAGE = "source_package"; field public static final java.lang.String TRANSCRIPTION = "transcription"; @@ -41330,8 +41336,8 @@ package android.telephony { method public int getCurrentPhoneType(); method public int getCurrentPhoneType(int); method public int getDataActivity(); - method public boolean getDataEnabled(); - method public boolean getDataEnabled(int); + method public deprecated boolean getDataEnabled(); + method public deprecated boolean getDataEnabled(int); method public int getDataNetworkType(); method public int getDataState(); method public deprecated java.lang.String getDeviceId(); @@ -41364,6 +41370,7 @@ package android.telephony { method public int getSimState(int); method public java.lang.String getSubscriberId(); method public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms(); + method public java.lang.String getVisualVoicemailPackageName(); method public java.lang.String getVoiceMailAlphaTag(); method public java.lang.String getVoiceMailNumber(); method public int getVoiceNetworkType(); @@ -41380,6 +41387,7 @@ package android.telephony { method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String); method public boolean isConcurrentVoiceAndDataAllowed(); method public boolean isDataConnectivityPossible(); + method public boolean isDataEnabled(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isIdle(); method public boolean isNetworkRoaming(); @@ -41397,7 +41405,6 @@ package android.telephony { method public boolean needsOtaServiceProvisioning(); method public java.lang.String sendEnvelopeWithStatus(java.lang.String); method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler); - method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler); method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method public void setDataEnabled(boolean); method public void setDataEnabled(int, boolean); @@ -41529,9 +41536,6 @@ package android.telephony { method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.telephony.VisualVoicemailSmsFilterSettings> CREATOR; - field public static final java.lang.String DEFAULT_CLIENT_PREFIX = "//VVM"; - field public static final int DEFAULT_DESTINATION_PORT = -1; // 0xffffffff - field public static final java.util.List<java.lang.String> DEFAULT_ORIGINATING_NUMBERS; field public static final int DESTINATION_PORT_ANY = -1; // 0xffffffff field public static final int DESTINATION_PORT_DATA_SMS = -2; // 0xfffffffe field public final java.lang.String clientPrefix; diff --git a/api/test-current.txt b/api/test-current.txt index 0cd5a852abce..d27aaacd74e6 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -7512,7 +7512,7 @@ package android.bluetooth.le { method public void setAdvertisingData(android.bluetooth.le.AdvertiseData); method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters); method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData); - method public void setPeriodicAdvertisingEnable(boolean); + method public void setPeriodicAdvertisingEnabled(boolean); method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters); method public void setScanResponseData(android.bluetooth.le.AdvertiseData); } @@ -7682,8 +7682,10 @@ package android.bluetooth.le { field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR; field public static final int DATA_COMPLETE = 0; // 0x0 field public static final int DATA_TRUNCATED = 2; // 0x2 + field public static final int PERIODIC_INTERVAL_NOT_PRESENT = 0; // 0x0 field public static final int PHY_UNUSED = 0; // 0x0 field public static final int SID_NOT_PRESENT = 255; // 0xff + field public static final int TX_POWER_NOT_PRESENT = 127; // 0x7f } public final class ScanSettings implements android.os.Parcelable { @@ -33863,6 +33865,8 @@ package android.provider { public static final class VoicemailContract.Voicemails implements android.provider.BaseColumns android.provider.OpenableColumns { method public static android.net.Uri buildSourceUri(java.lang.String); + field public static final java.lang.String ARCHIVED = "archived"; + field public static final java.lang.String BACKED_UP = "backed_up"; field public static final android.net.Uri CONTENT_URI; field public static final java.lang.String DATE = "date"; field public static final java.lang.String DELETED = "deleted"; @@ -33870,6 +33874,7 @@ package android.provider { field public static final java.lang.String DIR_TYPE = "vnd.android.cursor.dir/voicemails"; field public static final java.lang.String DURATION = "duration"; field public static final java.lang.String HAS_CONTENT = "has_content"; + field public static final java.lang.String IS_OMTP_VOICEMAIL = "is_omtp_voicemail"; field public static final java.lang.String IS_READ = "is_read"; field public static final java.lang.String ITEM_TYPE = "vnd.android.cursor.item/voicemail"; field public static final java.lang.String LAST_MODIFIED = "last_modified"; @@ -33877,6 +33882,7 @@ package android.provider { field public static final java.lang.String NUMBER = "number"; field public static final java.lang.String PHONE_ACCOUNT_COMPONENT_NAME = "subscription_component_name"; field public static final java.lang.String PHONE_ACCOUNT_ID = "subscription_id"; + field public static final java.lang.String RESTORED = "restored"; field public static final java.lang.String SOURCE_DATA = "source_data"; field public static final java.lang.String SOURCE_PACKAGE = "source_package"; field public static final java.lang.String TRANSCRIPTION = "transcription"; @@ -38218,7 +38224,6 @@ package android.telephony { method public android.os.PersistableBundle getCarrierConfig(); method public deprecated android.telephony.CellLocation getCellLocation(); method public int getDataActivity(); - method public boolean getDataEnabled(); method public int getDataNetworkType(); method public int getDataState(); method public deprecated java.lang.String getDeviceId(); @@ -38250,6 +38255,7 @@ package android.telephony { method public int getSimState(); method public int getSimState(int); method public java.lang.String getSubscriberId(); + method public java.lang.String getVisualVoicemailPackageName(); method public java.lang.String getVoiceMailAlphaTag(); method public java.lang.String getVoiceMailNumber(); method public int getVoiceNetworkType(); @@ -38263,6 +38269,7 @@ package android.telephony { method public java.lang.String iccTransmitApduBasicChannel(int, int, int, int, int, java.lang.String); method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String); method public boolean isConcurrentVoiceAndDataAllowed(); + method public boolean isDataEnabled(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isNetworkRoaming(); method public boolean isSmsCapable(); @@ -38273,7 +38280,6 @@ package android.telephony { method public void listen(android.telephony.PhoneStateListener, int); method public java.lang.String sendEnvelopeWithStatus(java.lang.String); method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler); - method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler); method public void setDataEnabled(boolean); method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String); method public boolean setOperatorBrandOverride(java.lang.String); @@ -38384,9 +38390,6 @@ package android.telephony { method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.telephony.VisualVoicemailSmsFilterSettings> CREATOR; - field public static final java.lang.String DEFAULT_CLIENT_PREFIX = "//VVM"; - field public static final int DEFAULT_DESTINATION_PORT = -1; // 0xffffffff - field public static final java.util.List<java.lang.String> DEFAULT_ORIGINATING_NUMBERS; field public static final int DESTINATION_PORT_ANY = -1; // 0xffffffff field public static final int DESTINATION_PORT_DATA_SMS = -2; // 0xfffffffe field public final java.lang.String clientPrefix; diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 735d84e72b67..ff52f27447c0 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -1032,28 +1032,6 @@ public final class BluetoothAdapter { } /** - * enable or disable Bluetooth HCI snoop log. - * - * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_ADMIN} - * permission - * - * @return true to indicate configure HCI log successfully, or false on - * immediate error - * @hide - */ - public boolean configHciSnoopLog(boolean enable) { - try { - mServiceLock.readLock().lock(); - if (mService != null) return mService.configHciSnoopLog(enable); - } catch (RemoteException e) { - Log.e(TAG, "", e); - } finally { - mServiceLock.readLock().unlock(); - } - return false; - } - - /** * Factory reset bluetooth settings. * * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java index 7806e31c418e..40f10a8edd22 100644 --- a/core/java/android/bluetooth/BluetoothGatt.java +++ b/core/java/android/bluetooth/BluetoothGatt.java @@ -159,8 +159,10 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onConnectionStateChange(BluetoothGatt.this, GATT_FAILURE, - BluetoothProfile.STATE_DISCONNECTED); + if (mCallback != null) { + mCallback.onConnectionStateChange(BluetoothGatt.this, GATT_FAILURE, + BluetoothProfile.STATE_DISCONNECTED); + } } }); @@ -192,7 +194,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onPhyUpdate(BluetoothGatt.this, txPhy, rxPhy, status); + if (mCallback != null) { + mCallback.onPhyUpdate(BluetoothGatt.this, txPhy, rxPhy, status); + } } }); } @@ -212,7 +216,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onPhyRead(BluetoothGatt.this, txPhy, rxPhy, status); + if (mCallback != null) { + mCallback.onPhyRead(BluetoothGatt.this, txPhy, rxPhy, status); + } } }); } @@ -235,7 +241,10 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onConnectionStateChange(BluetoothGatt.this, status, profileState); + if (mCallback != null) { + mCallback.onConnectionStateChange(BluetoothGatt.this, status, + profileState); + } } }); @@ -294,7 +303,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onServicesDiscovered(BluetoothGatt.this, status); + if (mCallback != null) { + mCallback.onServicesDiscovered(BluetoothGatt.this, status); + } } }); } @@ -344,7 +355,10 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onCharacteristicRead(BluetoothGatt.this, characteristic, status); + if (mCallback != null) { + mCallback.onCharacteristicRead(BluetoothGatt.this, characteristic, + status); + } } }); } @@ -390,7 +404,10 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onCharacteristicWrite(BluetoothGatt.this, characteristic, status); + if (mCallback != null) { + mCallback.onCharacteristicWrite(BluetoothGatt.this, characteristic, + status); + } } }); } @@ -416,7 +433,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onCharacteristicChanged(BluetoothGatt.this, characteristic); + if (mCallback != null) { + mCallback.onCharacteristicChanged(BluetoothGatt.this, characteristic); + } } }); } @@ -461,7 +480,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onDescriptorRead(BluetoothGatt.this, descriptor, status); + if (mCallback != null) { + mCallback.onDescriptorRead(BluetoothGatt.this, descriptor, status); + } } }); } @@ -505,7 +526,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onDescriptorWrite(BluetoothGatt.this, descriptor, status); + if (mCallback != null) { + mCallback.onDescriptorWrite(BluetoothGatt.this, descriptor, status); + } } }); } @@ -529,7 +552,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onReliableWriteCompleted(BluetoothGatt.this, status); + if (mCallback != null) { + mCallback.onReliableWriteCompleted(BluetoothGatt.this, status); + } } }); } @@ -548,7 +573,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onReadRemoteRssi(BluetoothGatt.this, rssi, status); + if (mCallback != null) { + mCallback.onReadRemoteRssi(BluetoothGatt.this, rssi, status); + } } }); } @@ -568,7 +595,9 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onMtuChanged(BluetoothGatt.this, mtu, status); + if (mCallback != null) { + mCallback.onMtuChanged(BluetoothGatt.this, mtu, status); + } } }); } @@ -590,8 +619,10 @@ public final class BluetoothGatt implements BluetoothProfile { mHandler.post(new Runnable() { @Override public void run() { - mCallback.onConnectionUpdated(BluetoothGatt.this, interval, latency, - timeout, status); + if (mCallback != null) { + mCallback.onConnectionUpdated(BluetoothGatt.this, interval, latency, + timeout, status); + } } }); } diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl index b33781729b62..43c5ae4407c9 100644 --- a/core/java/android/bluetooth/IBluetooth.aidl +++ b/core/java/android/bluetooth/IBluetooth.aidl @@ -97,7 +97,6 @@ interface IBluetooth ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in ParcelUuid uuid, int port, int flag); ParcelFileDescriptor createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag); - boolean configHciSnoopLog(boolean enable); boolean factoryReset(); boolean isMultiAdvertisementSupported(); diff --git a/core/java/android/bluetooth/le/AdvertisingSet.java b/core/java/android/bluetooth/le/AdvertisingSet.java index 3021be1f8c02..1bc211cb83a2 100644 --- a/core/java/android/bluetooth/le/AdvertisingSet.java +++ b/core/java/android/bluetooth/le/AdvertisingSet.java @@ -172,7 +172,7 @@ public final class AdvertisingSet { * * @param enable whether the periodic advertising should be enabled (true), or disabled (false). */ - public void setPeriodicAdvertisingEnable(boolean enable) { + public void setPeriodicAdvertisingEnabled(boolean enable) { try { gatt.setPeriodicAdvertisingEnable(this.advertiserId, enable); } catch (RemoteException e) { diff --git a/core/java/android/bluetooth/le/AdvertisingSetCallback.java b/core/java/android/bluetooth/le/AdvertisingSetCallback.java index 2c46e856db4a..c3c16a479e71 100644 --- a/core/java/android/bluetooth/le/AdvertisingSetCallback.java +++ b/core/java/android/bluetooth/le/AdvertisingSetCallback.java @@ -135,7 +135,7 @@ public abstract class AdvertisingSetCallback { int status) {} /** - * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnable} + * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnabled} * indicating result of the operation. * * @param advertisingSet The advertising set. diff --git a/core/java/android/bluetooth/le/AdvertisingSetParameters.java b/core/java/android/bluetooth/le/AdvertisingSetParameters.java index 31d8f482090d..71c4484a9474 100644 --- a/core/java/android/bluetooth/le/AdvertisingSetParameters.java +++ b/core/java/android/bluetooth/le/AdvertisingSetParameters.java @@ -242,7 +242,7 @@ public final class AdvertisingSetParameters implements Parcelable { * non-connectable. * Legacy advertisements can be both connectable and scannable. Non-legacy * advertisements can be only scannable or only connectable. - * @param connectable Controls whether the advertisment type will be + * @param connectable Controls whether the advertisement type will be * connectable (true) or non-connectable (false). */ public Builder setConnectable(boolean connectable) { @@ -254,7 +254,7 @@ public final class AdvertisingSetParameters implements Parcelable { * Set whether the advertisement type should be scannable. * Legacy advertisements can be both connectable and scannable. Non-legacy * advertisements can be only scannable or only connectable. - * @param scannable Controls whether the advertisment type will be + * @param scannable Controls whether the advertisement type will be * scannable (true) or non-scannable (false). */ public Builder setScannable(boolean scannable) { @@ -386,6 +386,7 @@ public final class AdvertisingSetParameters implements Parcelable { /** * Build the {@link AdvertisingSetParameters} object. + * @throws IllegalStateException if invalid combination of parameters is used. */ public AdvertisingSetParameters build() { if (isLegacy) { @@ -394,22 +395,22 @@ public final class AdvertisingSetParameters implements Parcelable { } if (connectable == true && scannable == false) { - throw new IllegalArgumentException( + throw new IllegalStateException( "Legacy advertisement can't be connectable and non-scannable"); } if (includeTxPower) { - throw new IllegalArgumentException( + throw new IllegalStateException( "Legacy advertising can't include TX power level in header"); } } else { if (connectable && scannable) { - throw new IllegalArgumentException( + throw new IllegalStateException( "Advertising can't be both connectable and scannable"); } if (isAnonymous && connectable) { - throw new IllegalArgumentException( + throw new IllegalStateException( "Advertising can't be both connectable and anonymous"); } } diff --git a/core/java/android/bluetooth/le/ScanResult.java b/core/java/android/bluetooth/le/ScanResult.java index 5b2fa406cd3f..e552398e9e26 100644 --- a/core/java/android/bluetooth/le/ScanResult.java +++ b/core/java/android/bluetooth/le/ScanResult.java @@ -52,6 +52,16 @@ public final class ScanResult implements Parcelable { public static final int SID_NOT_PRESENT = 0xFF; /** + * TX power is not present in the packet. + */ + public static final int TX_POWER_NOT_PRESENT = 0x7F; + + /** + * Periodic advertising interval is not present in the packet. + */ + public static final int PERIODIC_INTERVAL_NOT_PRESENT = 0x00; + + /** * Mask for checking whether event type represents legacy advertisement. */ private static final int ET_LEGACY_MASK = 0x10; @@ -265,15 +275,16 @@ public final class ScanResult implements Parcelable { /** * Returns the transmit power in dBm. - * Valid range is [-127, 126]. A value of 127 indicates that the - * advertisement did not indicate TX power. + * Valid range is [-127, 126]. A value of {@link ScanResult#TX_POWER_NOT_PRESENT} + * indicates that the TX power is not present. */ public int getTxPower() { return mTxPower; } /** * Returns the periodic advertising interval in units of 1.25ms. - * Valid range is 6 (7.5ms) to 65536 (81918.75ms). A value of 0 means - * periodic advertising is not used for this scan result. + * Valid range is 6 (7.5ms) to 65536 (81918.75ms). A value of + * {@link ScanResult#PERIODIC_INTERVAL_NOT_PRESENT} means periodic + * advertising interval is not present. */ public int getPeriodicAdvertisingInterval() { return mPeriodicAdvertisingInterval; diff --git a/core/java/android/hardware/radio/RadioManager.java b/core/java/android/hardware/radio/RadioManager.java index 14bb923767ed..f079647a63d0 100644 --- a/core/java/android/hardware/radio/RadioManager.java +++ b/core/java/android/hardware/radio/RadioManager.java @@ -755,8 +755,9 @@ public class RadioManager { if (!(obj instanceof BandConfig)) return false; BandConfig other = (BandConfig) obj; - if (mDescriptor != other.getDescriptor()) - return false; + BandDescriptor otherDesc = other.getDescriptor(); + if ((mDescriptor == null) != (otherDesc == null)) return false; + if (mDescriptor != null && !mDescriptor.equals(otherDesc)) return false; return true; } } diff --git a/core/java/android/os/HwParcel.java b/core/java/android/os/HwParcel.java index 94fd5b074b82..4ba1144742db 100644 --- a/core/java/android/os/HwParcel.java +++ b/core/java/android/os/HwParcel.java @@ -209,10 +209,11 @@ public class HwParcel { public native final IHwBinder readStrongBinder(); // Handle is stored as part of the blob. - public native final HwBlob readBuffer(); + public native final HwBlob readBuffer(long expectedSize); public native final HwBlob readEmbeddedBuffer( - long parentHandle, long offset, boolean nullable); + long expectedSize, long parentHandle, long offset, + boolean nullable); public native final void writeBuffer(HwBlob blob); diff --git a/core/java/android/os/VintfRuntimeInfo.java b/core/java/android/os/VintfRuntimeInfo.java new file mode 100644 index 000000000000..29698b9fa684 --- /dev/null +++ b/core/java/android/os/VintfRuntimeInfo.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2017 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 android.os; + +/** + * Java API for ::android::vintf::RuntimeInfo. Methods return null / 0 on any error. + * + * @hide + */ +public class VintfRuntimeInfo { + + private VintfRuntimeInfo() {} + + /** + * @return /sys/fs/selinux/policyvers, via security_policyvers() native call + */ + public static native long getKernelSepolicyVersion(); + /** + * @return content of /proc/cpuinfo + */ + public static native String getCpuInfo(); + /** + * @return os name extracted from uname() native call + */ + public static native String getOsName(); + /** + * @return node name extracted from uname() native call + */ + public static native String getNodeName(); + /** + * @return os release extracted from uname() native call + */ + public static native String getOsRelease(); + /** + * @return os version extracted from uname() native call + */ + public static native String getOsVersion(); + /** + * @return hardware id extracted from uname() native call + */ + public static native String getHardwareId(); + /** + * @return kernel version extracted from uname() native call. Format is + * {@code x.y.z}. + */ + public static native String getKernelVersion(); + /** + * @return libavb version in OS. Format is {@code x.y}. + */ + public static native String getBootAvbVersion(); + /** + * @return libavb version in bootloader. Format is {@code x.y}. + */ + public static native String getBootVbmetaAvbVersion(); + +} diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 3f3f8590abc0..35a3c0c0d8c1 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -4720,13 +4720,6 @@ public final class Settings { public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service"; /** - * bluetooth HCI snoop log configuration - * @hide - */ - public static final String BLUETOOTH_HCI_LOG = - "bluetooth_hci_log"; - - /** * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead */ @Deprecated diff --git a/core/java/android/provider/VoicemailContract.java b/core/java/android/provider/VoicemailContract.java index e48a0d08de7d..a8b094eab0a2 100644 --- a/core/java/android/provider/VoicemailContract.java +++ b/core/java/android/provider/VoicemailContract.java @@ -284,8 +284,6 @@ public class VoicemailContract { * not. * * <P>Type: INTEGER (boolean)</P> - * - * @hide */ public static final String BACKED_UP = "backed_up"; @@ -294,8 +292,6 @@ public class VoicemailContract { * restored, 0 if not. * * <P>Type: INTEGER (boolean)</P> - * - * @hide */ public static final String RESTORED = "restored"; @@ -305,19 +301,19 @@ public class VoicemailContract { * if not. * * <P>Type: INTEGER (boolean)</P> - * - * @hide */ public static final String ARCHIVED = "archived"; /** * Flag to indicate the voicemail is a OMTP voicemail handled by the {@link * android.telephony.VisualVoicemailService}. The UI should only show OMTP voicemails from - * the current visual voicemail package. + * the current visual voicemail package. For example, the selection could be + * {@code WHERE (IS_OMTP_VOICEMAIL == 0) OR ( IS_OMTP_VOICEMAIL == 1 AND SOURCE_PACKAGE == + * "current.vvm.package")} * * <P>Type: INTEGER (boolean)</P> * - * @hide + * @see android.telephony.TelephonyManager#getVisualVoicemailPackageName */ public static final String IS_OMTP_VOICEMAIL = "is_omtp_voicemail"; diff --git a/core/java/android/util/Log.java b/core/java/android/util/Log.java index d857bf712bfe..951aa8df9ea3 100644 --- a/core/java/android/util/Log.java +++ b/core/java/android/util/Log.java @@ -89,8 +89,9 @@ public final class Log { /** * Exception class used to capture a stack trace in {@link #wtf}. + * @hide */ - private static class TerribleFailure extends Exception { + public static class TerribleFailure extends Exception { TerribleFailure(String msg, Throwable cause) { super(msg, cause); } } diff --git a/core/jni/Android.mk b/core/jni/Android.mk index 08346259191d..7e867d71f523 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -91,6 +91,7 @@ LOCAL_SRC_FILES:= \ android_os_Trace.cpp \ android_os_UEventObserver.cpp \ android_os_VintfObject.cpp \ + android_os_VintfRuntimeInfo.cpp \ android_net_LocalSocketImpl.cpp \ android_net_NetUtils.cpp \ android_net_TrafficStats.cpp \ diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 9f6ea9fa29c1..2b5c0d6c735a 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -165,6 +165,7 @@ extern int register_android_os_MessageQueue(JNIEnv* env); extern int register_android_os_Parcel(JNIEnv* env); extern int register_android_os_SELinux(JNIEnv* env); extern int register_android_os_VintfObject(JNIEnv *env); +extern int register_android_os_VintfRuntimeInfo(JNIEnv *env); extern int register_android_os_seccomp(JNIEnv* env); extern int register_android_os_SystemProperties(JNIEnv *env); extern int register_android_os_SystemClock(JNIEnv* env); @@ -605,6 +606,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote) { JavaVMInitArgs initArgs; char propBuf[PROPERTY_VALUE_MAX]; + char stackTraceDirBuf[sizeof("-Xstacktracedir:")-1 + PROPERTY_VALUE_MAX]; char stackTraceFileBuf[sizeof("-Xstacktracefile:")-1 + PROPERTY_VALUE_MAX]; char jniOptsBuf[sizeof("-Xjniopts:")-1 + PROPERTY_VALUE_MAX]; char heapstartsizeOptsBuf[sizeof("-Xms")-1 + PROPERTY_VALUE_MAX]; @@ -682,7 +684,12 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote) executionMode = kEMJitCompiler; } - parseRuntimeOption("dalvik.vm.stack-trace-file", stackTraceFileBuf, "-Xstacktracefile:"); + // If dalvik.vm.stack-trace-dir is set, it enables the "new" stack trace + // dump scheme and a new file is created for each stack dump. If it isn't set, + // the old scheme is enabled. + if (!parseRuntimeOption("dalvik.vm.stack-trace-dir", stackTraceDirBuf, "-Xstacktracedir:")) { + parseRuntimeOption("dalvik.vm.stack-trace-file", stackTraceFileBuf, "-Xstacktracefile:"); + } strcpy(jniOptsBuf, "-Xjniopts:"); if (parseRuntimeOption("dalvik.vm.jniopts", jniOptsBuf, "-Xjniopts:")) { @@ -1308,6 +1315,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_os_HwParcel), REG_JNI(register_android_os_HwRemoteBinder), REG_JNI(register_android_os_VintfObject), + REG_JNI(register_android_os_VintfRuntimeInfo), REG_JNI(register_android_nio_utils), REG_JNI(register_android_graphics_Canvas), REG_JNI(register_android_graphics_Graphics), diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp index 678041f85d17..b21ea828f2a4 100644 --- a/core/jni/android_os_HwParcel.cpp +++ b/core/jni/android_os_HwParcel.cpp @@ -574,7 +574,7 @@ static jstring JHwParcel_native_readString(JNIEnv *env, jobject thiz) { size_t parentHandle; const hidl_string *s; - status_t err = parcel->readBuffer(&parentHandle, + status_t err = parcel->readBuffer(sizeof(*s), &parentHandle, reinterpret_cast<const void**>(&s)); if (err != OK) { @@ -583,7 +583,7 @@ static jstring JHwParcel_native_readString(JNIEnv *env, jobject thiz) { } err = ::android::hardware::readEmbeddedFromParcel( - const_cast<hidl_string *>(s), + const_cast<hidl_string &>(*s), *parcel, parentHandle, 0 /* parentOffset */); if (err != OK) { @@ -602,7 +602,7 @@ static Type ## Array JHwParcel_native_read ## Suffix ## Vector( \ size_t parentHandle; \ \ const hidl_vec<Type> *vec; \ - status_t err = parcel->readBuffer(&parentHandle, \ + status_t err = parcel->readBuffer(sizeof(*vec), &parentHandle, \ reinterpret_cast<const void**>(&vec)); \ \ if (err != OK) { \ @@ -613,7 +613,7 @@ static Type ## Array JHwParcel_native_read ## Suffix ## Vector( \ size_t childHandle; \ \ err = ::android::hardware::readEmbeddedFromParcel( \ - const_cast<hidl_vec<Type> *>(vec), \ + const_cast<hidl_vec<Type> &>(*vec), \ *parcel, \ parentHandle, \ 0 /* parentOffset */, \ @@ -645,7 +645,7 @@ static jbooleanArray JHwParcel_native_readBoolVector( size_t parentHandle; const hidl_vec<bool> *vec; - status_t err = parcel->readBuffer(&parentHandle, + status_t err = parcel->readBuffer(sizeof(*vec), &parentHandle, reinterpret_cast<const void**>(&vec)); if (err != OK) { @@ -656,7 +656,7 @@ static jbooleanArray JHwParcel_native_readBoolVector( size_t childHandle; err = ::android::hardware::readEmbeddedFromParcel( - const_cast<hidl_vec<bool> *>(vec), + const_cast<hidl_vec<bool> &>(*vec), *parcel, parentHandle, 0 /* parentOffset */, @@ -709,7 +709,7 @@ static jobjectArray JHwParcel_native_readStringVector( size_t parentHandle; const string_vec *vec; - status_t err = parcel->readBuffer(&parentHandle, + status_t err = parcel->readBuffer(sizeof(*vec), &parentHandle, reinterpret_cast<const void **>(&vec)); if (err != OK) { @@ -719,16 +719,15 @@ static jobjectArray JHwParcel_native_readStringVector( size_t childHandle; err = ::android::hardware::readEmbeddedFromParcel( - const_cast<string_vec *>(vec), + const_cast<string_vec &>(*vec), *parcel, parentHandle, 0 /* parentOffset */, &childHandle); for (size_t i = 0; (err == OK) && (i < vec->size()); ++i) { err = android::hardware::readEmbeddedFromParcel( - const_cast<hidl_vec<hidl_string> *>(vec), + const_cast<hidl_string &>((*vec)[i]), *parcel, childHandle, - i * sizeof(hidl_string), - nullptr /* childHandle */); + i * sizeof(hidl_string) /* parentOffset */); } if (err != OK) { @@ -810,13 +809,20 @@ static jobject JHwParcel_native_readStrongBinder(JNIEnv *env, jobject thiz) { return JHwRemoteBinder::NewObject(env, binder); } -static jobject JHwParcel_native_readBuffer(JNIEnv *env, jobject thiz) { +static jobject JHwParcel_native_readBuffer(JNIEnv *env, jobject thiz, + jlong expectedSize) { hardware::Parcel *parcel = JHwParcel::GetNativeContext(env, thiz)->getParcel(); size_t handle; const void *ptr; - status_t status = parcel->readBuffer(&handle, &ptr); + + if (expectedSize < 0) { + jniThrowException(env, "java/lang/IllegalArgumentException", NULL); + return nullptr; + } + + status_t status = parcel->readBuffer(expectedSize, &handle, &ptr); if (status != OK) { jniThrowException(env, "java/util/NoSuchElementException", NULL); @@ -827,8 +833,8 @@ static jobject JHwParcel_native_readBuffer(JNIEnv *env, jobject thiz) { } static jobject JHwParcel_native_readEmbeddedBuffer( - JNIEnv *env, jobject thiz, jlong parentHandle, jlong offset, - jboolean nullable) { + JNIEnv *env, jobject thiz, jlong expectedSize, + jlong parentHandle, jlong offset, jboolean nullable) { hardware::Parcel *parcel = JHwParcel::GetNativeContext(env, thiz)->getParcel(); @@ -836,8 +842,13 @@ static jobject JHwParcel_native_readEmbeddedBuffer( const void *ptr; status_t status = - parcel->readNullableEmbeddedBuffer(&childHandle, parentHandle, offset, - &ptr); + parcel->readNullableEmbeddedBuffer(expectedSize, + &childHandle, parentHandle, offset, &ptr); + + if (expectedSize < 0) { + jniThrowException(env, "java/lang/IllegalArgumentException", NULL); + return nullptr; + } if (status != OK) { jniThrowException(env, "java/util/NoSuchElementException", NULL); @@ -952,10 +963,10 @@ static JNINativeMethod gMethods[] = { { "send", "()V", (void *)JHwParcel_native_send }, - { "readBuffer", "()L" PACKAGE_PATH "/HwBlob;", + { "readBuffer", "(J)L" PACKAGE_PATH "/HwBlob;", (void *)JHwParcel_native_readBuffer }, - { "readEmbeddedBuffer", "(JJZ)L" PACKAGE_PATH "/HwBlob;", + { "readEmbeddedBuffer", "(JJJZ)L" PACKAGE_PATH "/HwBlob;", (void *)JHwParcel_native_readEmbeddedBuffer }, { "writeBuffer", "(L" PACKAGE_PATH "/HwBlob;)V", diff --git a/core/jni/android_os_VintfRuntimeInfo.cpp b/core/jni/android_os_VintfRuntimeInfo.cpp new file mode 100644 index 000000000000..ecb685435a97 --- /dev/null +++ b/core/jni/android_os_VintfRuntimeInfo.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2017 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. + */ + +#define LOG_TAG "VintfRuntimeInfo" +//#define LOG_NDEBUG 0 + +#include <JNIHelp.h> +#include <vintf/VintfObject.h> +#include <vintf/parse_string.h> +#include <vintf/parse_xml.h> + +#include "core_jni_helpers.h" + +namespace android { + +using vintf::RuntimeInfo; +using vintf::VintfObject; + +#define MAP_STRING_METHOD(javaMethod, cppString) \ + static jstring android_os_VintfRuntimeInfo_##javaMethod(JNIEnv* env, jclass clazz) \ + { \ + const RuntimeInfo *info = VintfObject::GetRuntimeInfo(); \ + if (info == nullptr) return nullptr; \ + return env->NewStringUTF((cppString).c_str()); \ + } \ + +MAP_STRING_METHOD(getCpuInfo, info->cpuInfo()); +MAP_STRING_METHOD(getOsName, info->osName()); +MAP_STRING_METHOD(getNodeName, info->nodeName()); +MAP_STRING_METHOD(getOsRelease, info->osRelease()); +MAP_STRING_METHOD(getOsVersion, info->osVersion()); +MAP_STRING_METHOD(getHardwareId, info->hardwareId()); +MAP_STRING_METHOD(getKernelVersion, vintf::to_string(info->kernelVersion())); +MAP_STRING_METHOD(getBootAvbVersion, vintf::to_string(info->bootAvbVersion())); +MAP_STRING_METHOD(getBootVbmetaAvbVersion, vintf::to_string(info->bootVbmetaAvbVersion())); + + +static jlong android_os_VintfRuntimeInfo_getKernelSepolicyVersion(JNIEnv *env, jclass clazz) +{ + const RuntimeInfo *info = VintfObject::GetRuntimeInfo(); + if (info == nullptr) return 0; + return static_cast<jlong>(info->kernelSepolicyVersion()); +} + +// ---------------------------------------------------------------------------- + +static const JNINativeMethod gVintfRuntimeInfoMethods[] = { + {"getKernelSepolicyVersion", "()J", (void*)android_os_VintfRuntimeInfo_getKernelSepolicyVersion}, + {"getCpuInfo", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getCpuInfo}, + {"getOsName", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getOsName}, + {"getNodeName", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getNodeName}, + {"getOsRelease", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getOsRelease}, + {"getOsVersion", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getOsVersion}, + {"getHardwareId", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getHardwareId}, + {"getKernelVersion", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getKernelVersion}, + {"getBootAvbVersion", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getBootAvbVersion}, + {"getBootVbmetaAvbVersion", "()Ljava/lang/String;", (void*)android_os_VintfRuntimeInfo_getBootVbmetaAvbVersion}, +}; + +const char* const kVintfRuntimeInfoPathName = "android/os/VintfRuntimeInfo"; + +int register_android_os_VintfRuntimeInfo(JNIEnv* env) +{ + return RegisterMethodsOrDie(env, kVintfRuntimeInfoPathName, gVintfRuntimeInfoMethods, NELEM(gVintfRuntimeInfoMethods)); +} + +}; diff --git a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java index 411a3f894965..37b2a50ed670 100644 --- a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java +++ b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java @@ -72,8 +72,6 @@ public class BluetoothInstrumentation extends Instrumentation { getAddress(); } else if ("getBondedDevices".equals(command)) { getBondedDevices(); - } else if ("enableBtSnoop".equals(command)) { - enableBtSnoop(); } else { finish(null); } @@ -116,12 +114,6 @@ public class BluetoothInstrumentation extends Instrumentation { finish(mSuccessResult); } - public void enableBtSnoop() { - Assert.assertTrue("failed to enable snoop log", - getBluetoothAdapter().configHciSnoopLog(true)); - finish(mSuccessResult); - } - public void finish(Bundle result) { if (result == null) { result = new Bundle(); diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp index 2132c2b171dc..9c253c42cd8f 100644 --- a/libs/hwui/JankTracker.cpp +++ b/libs/hwui/JankTracker.cpp @@ -265,7 +265,6 @@ void JankTracker::addFrame(const FrameInfo& frame) { / kSlowFrameBucketIntervalMs; framebucket = std::min(framebucket, static_cast<uint32_t>(mData->slowFrameCounts.size() - 1)); - framebucket = std::max(framebucket, 0u); mData->slowFrameCounts[framebucket]++; } diff --git a/packages/CarrierDefaultApp/AndroidManifest.xml b/packages/CarrierDefaultApp/AndroidManifest.xml index e450283312c3..2ef1cf59ffc5 100644 --- a/packages/CarrierDefaultApp/AndroidManifest.xml +++ b/packages/CarrierDefaultApp/AndroidManifest.xml @@ -33,6 +33,7 @@ <receiver android:name="com.android.carrierdefaultapp.CarrierDefaultBroadcastReceiver"> <intent-filter> <action android:name="com.android.internal.telephony.CARRIER_SIGNAL_REDIRECTED" /> + <action android:name="com.android.internal.telephony.CARRIER_SIGNAL_RESET" /> </intent-filter> </receiver> <service android:name="com.android.carrierdefaultapp.ProvisionObserver" diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java index e1125d9d503a..d5d0b7926c83 100644 --- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java +++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java @@ -91,6 +91,10 @@ public class CustomConfigLoader { arg1 = intent.getStringExtra(TelephonyIntents.EXTRA_APN_TYPE_KEY); arg2 = intent.getStringExtra(TelephonyIntents.EXTRA_ERROR_CODE_KEY); break; + case TelephonyIntents.ACTION_CARRIER_SIGNAL_RESET: + configs = b.getStringArray(CarrierConfigManager + .KEY_CARRIER_DEFAULT_ACTIONS_ON_RESET); + break; default: Rlog.e(TAG, "load carrier config failure with un-configured key: " + intent.getAction()); diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 5eb4db408a67..1262d88be8e1 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -1496,16 +1496,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (mGetNameAddressOnly) return; } - try { - boolean enableHciSnoopLog = (Settings.Secure.getInt(mContentResolver, - Settings.Secure.BLUETOOTH_HCI_LOG, 0) == 1); - if (!mBluetooth.configHciSnoopLog(enableHciSnoopLog)) { - Slog.e(TAG,"IBluetooth.configHciSnoopLog return false"); - } - } catch (RemoteException e) { - Slog.e(TAG,"Unable to call configHciSnoopLog", e); - } - //Register callback object try { mBluetooth.registerCallback(mBluetoothCallback); diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index e667680d49fc..9edc35e20564 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -219,6 +219,10 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering return (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); } + private WifiManager getWifiManager() { + return (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); + } + private void updateConfiguration() { mConfig = new TetheringConfiguration(mContext); } @@ -409,16 +413,21 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering } private int setWifiTethering(final boolean enable) { - synchronized (mPublicSync) { - mWifiTetherRequested = enable; - final WifiManager wifiManager = - (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); - if ((enable && wifiManager.startSoftAp(null /* use existing wifi config */)) || - (!enable && wifiManager.stopSoftAp())) { - return ConnectivityManager.TETHER_ERROR_NO_ERROR; + int rval = ConnectivityManager.TETHER_ERROR_MASTER_ERROR; + final long ident = Binder.clearCallingIdentity(); + try { + synchronized (mPublicSync) { + mWifiTetherRequested = enable; + final WifiManager mgr = getWifiManager(); + if ((enable && mgr.startSoftAp(null /* use existing wifi config */)) || + (!enable && mgr.stopSoftAp())) { + rval = ConnectivityManager.TETHER_ERROR_NO_ERROR; + } } - return ConnectivityManager.TETHER_ERROR_MASTER_ERROR; + } finally { + Binder.restoreCallingIdentity(ident); } + return rval; } private void setBluetoothTethering(final boolean enable, final ResultReceiver receiver) { @@ -1334,12 +1343,37 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering } else { mForwardedDownstreams.remove(who); } + + // If this is a Wi-Fi interface, notify WifiManager of the active serving state. + if (who.interfaceType() == ConnectivityManager.TETHERING_WIFI) { + final WifiManager mgr = getWifiManager(); + final String iface = who.interfaceName(); + switch (mode) { + case IControlsTethering.STATE_TETHERED: + mgr.updateInterfaceIpState(iface, WifiManager.IFACE_IP_MODE_TETHERED); + break; + case IControlsTethering.STATE_LOCAL_ONLY: + mgr.updateInterfaceIpState(iface, WifiManager.IFACE_IP_MODE_LOCAL_ONLY); + break; + default: + Log.wtf(TAG, "Unknown active serving mode: " + mode); + break; + } + } } private void handleInterfaceServingStateInactive(TetherInterfaceStateMachine who) { mNotifyList.remove(who); mIPv6TetheringCoordinator.removeActiveDownstream(who); mForwardedDownstreams.remove(who); + + // If this is a Wi-Fi interface, tell WifiManager of any errors. + if (who.interfaceType() == ConnectivityManager.TETHERING_WIFI) { + if (who.lastError() != ConnectivityManager.TETHER_ERROR_NO_ERROR) { + getWifiManager().updateInterfaceIpState( + who.interfaceName(), WifiManager.IFACE_IP_MODE_CONFIGURATION_ERROR); + } + } } class InitialState extends State { @@ -1661,7 +1695,7 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering public void notifyInterfaceStateChange(String iface, TetherInterfaceStateMachine who, int state, int error) { synchronized (mPublicSync) { - TetherState tetherState = mTetherStates.get(iface); + final TetherState tetherState = mTetherStates.get(iface); if (tetherState != null && tetherState.stateMachine.equals(who)) { tetherState.lastState = state; tetherState.lastError = error; diff --git a/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java b/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java index e21349af8649..d3cfd875faae 100644 --- a/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java +++ b/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java @@ -117,9 +117,11 @@ public class TetherInterfaceStateMachine extends StateMachine { setInitialState(mInitialState); } - public int interfaceType() { - return mInterfaceType; - } + public String interfaceName() { return mIfaceName; } + + public int interfaceType() { return mInterfaceType; } + + public int lastError() { return mLastError; } // configured when we start tethering and unconfig'd on error or conclusion private boolean configureIfaceIp(boolean enabled) { diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index c42a8352a68a..5530cb7b53e1 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -43,6 +43,15 @@ public final class PhoneAccount implements Parcelable { /** * {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which determines the + * sort order for {@link PhoneAccount}s from the same + * {@link android.telecom.ConnectionService}. + * @hide + */ + public static final String EXTRA_SORT_ORDER = + "android.telecom.extra.SORT_ORDER"; + + /** + * {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which determines the * maximum permitted length of a call subject specified via the * {@link TelecomManager#EXTRA_CALL_SUBJECT} extra on an * {@link android.content.Intent#ACTION_CALL} intent. Ultimately a {@link ConnectionService} is diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 1b22c0ea5434..e1239d08b57f 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -984,6 +984,20 @@ public class CarrierConfigManager { "carrier_default_actions_on_dcfailure_string_array"; /** + * Defines carrier-specific actions which act upon + * com.android.internal.telephony.CARRIER_SIGNAL_RESET, used for customization of the + * default carrier app + * Format: "CARRIER_ACTION_IDX, ..." + * Where {@code CARRIER_ACTION_IDX} is an integer defined in + * {@link com.android.carrierdefaultapp.CarrierActionUtils CarrierActionUtils} + * Example: + * {@link com.android.carrierdefaultapp.CarrierActionUtils + * #CARRIER_ACTION_CANCEL_ALL_NOTIFICATIONS clear all notifications on reset} + * @hide + */ + public static final String KEY_CARRIER_DEFAULT_ACTIONS_ON_RESET = + "carrier_default_actions_on_reset_string_array"; + /** * Defines a list of acceptable redirection url for default carrier app * @hides */ @@ -1504,7 +1518,8 @@ public class CarrierConfigManager { sDefaults.putStringArray(KEY_CARRIER_APP_WAKE_SIGNAL_CONFIG_STRING_ARRAY, new String[]{ "com.android.carrierdefaultapp/.CarrierDefaultBroadcastReceiver:" + - "com.android.internal.telephony.CARRIER_SIGNAL_REDIRECTED" + "com.android.internal.telephony.CARRIER_SIGNAL_REDIRECTED," + + "com.android.internal.telephony.CARRIER_SIGNAL_RESET" }); sDefaults.putStringArray(KEY_CARRIER_APP_NO_WAKE_SIGNAL_CONFIG_STRING_ARRAY, null); @@ -1515,6 +1530,9 @@ public class CarrierConfigManager { //4: CARRIER_ACTION_DISABLE_METERED_APNS //1: CARRIER_ACTION_SHOW_PORTAL_NOTIFICATION }); + sDefaults.putStringArray(KEY_CARRIER_DEFAULT_ACTIONS_ON_RESET, new String[]{ + "6" //6: CARRIER_ACTION_CANCEL_ALL_NOTIFICATIONS + }); sDefaults.putStringArray(KEY_CARRIER_DEFAULT_REDIRECTION_URL_STRING_ARRAY, null); // Rat families: {GPRS, EDGE}, {EVDO, EVDO_A, EVDO_B}, {UMTS, HSPA, HSDPA, HSUPA, HSPAP}, diff --git a/telephony/java/android/telephony/MbmsDownloadManager.java b/telephony/java/android/telephony/MbmsDownloadManager.java index bb4bf1e838fb..862c91942d60 100644 --- a/telephony/java/android/telephony/MbmsDownloadManager.java +++ b/telephony/java/android/telephony/MbmsDownloadManager.java @@ -16,14 +16,16 @@ package android.telephony; -import android.app.PendingIntent; import android.content.Context; import android.net.Uri; -import android.telephony.mbms.DownloadListener; +import android.os.RemoteException; +import android.telephony.mbms.DownloadCallback; import android.telephony.mbms.DownloadRequest; import android.telephony.mbms.DownloadStatus; -import android.telephony.mbms.FileServiceInfo; -import android.telephony.mbms.IMbmsDownloadManagerListener; +import android.telephony.mbms.IMbmsDownloadManagerCallback; +import android.telephony.mbms.MbmsInitializationException; +import android.telephony.mbms.vendor.IMbmsDownloadService; +import android.util.Log; import java.util.List; @@ -31,9 +33,135 @@ import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; /** @hide */ public class MbmsDownloadManager { + private static final String LOG_TAG = MbmsDownloadManager.class.getSimpleName(); + + /** + * The MBMS middleware should send this when a download of single file has completed or + * failed. Mandatory extras are + * {@link #EXTRA_RESULT} + * {@link #EXTRA_INFO} + * {@link #EXTRA_REQUEST} + * {@link #EXTRA_TEMP_LIST} + * {@link #EXTRA_FINAL_URI} + * + * TODO: future systemapi + */ + public static final String ACTION_DOWNLOAD_RESULT_INTERNAL = + "android.telephony.mbms.action.DOWNLOAD_RESULT_INTERNAL"; + + /** + * The MBMS middleware should send this when it wishes to request {@code content://} URIs to + * serve as temp files for downloads or when it wishes to resume paused downloads. Mandatory + * extras are + * {@link #EXTRA_REQUEST} + * + * Optional extras are + * {@link #EXTRA_FD_COUNT} (0 if not present) + * {@link #EXTRA_PAUSED_LIST} (empty if not present) + * + * TODO: future systemapi + */ + public static final String ACTION_FILE_DESCRIPTOR_REQUEST = + "android.telephony.mbms.action.FILE_DESCRIPTOR_REQUEST"; + + /** + * The MBMS middleware should send this when it wishes to clean up temp files in the app's + * filesystem. Mandatory extras are: + * {@link #EXTRA_TEMP_FILES_IN_USE} + * + * TODO: future systemapi + */ + public static final String ACTION_CLEANUP = + "android.telephony.mbms.action.CLEANUP"; + + /** + * Integer extra indicating the result code of the download. + * TODO: put in link to error list + * TODO: future systemapi (here and and all extras) + */ + public static final String EXTRA_RESULT = "android.telephony.mbms.extra.RESULT"; + + /** + * Extra containing the {@link android.telephony.mbms.FileInfo} for which the download result + * is for. Must not be null. + */ + public static final String EXTRA_INFO = "android.telephony.mbms.extra.INFO"; + + /** + * Extra containing the {@link DownloadRequest} for which the download result or file + * descriptor request is for. Must not be null. + */ + public static final String EXTRA_REQUEST = "android.telephony.mbms.extra.REQUEST"; + + /** + * Extra containing a {@link List} of {@link Uri}s that were used as temp files for this + * completed file. These {@link Uri}s should have scheme {@code file://}, and the temp + * files will be deleted upon receipt of the intent. + * May be null. + */ + public static final String EXTRA_TEMP_LIST = "android.telephony.mbms.extra.TEMP_LIST"; + + /** + * Extra containing a single {@link Uri} indicating the path to the temp file in which the + * decoded downloaded file resides. Must not be null. + */ + public static final String EXTRA_FINAL_URI = "android.telephony.mbms.extra.FINAL_URI"; + + /** + * Extra containing an integer indicating the number of temp files requested. + */ + public static final String EXTRA_FD_COUNT = "android.telephony.mbms.extra.FD_COUNT"; + + /** + * Extra containing a list of {@link Uri}s that the middleware is requesting access to via + * {@link #ACTION_FILE_DESCRIPTOR_REQUEST} in order to resume downloading. These {@link Uri}s + * should have scheme {@code file://}. + */ + public static final String EXTRA_PAUSED_LIST = "android.telephony.mbms.extra.PAUSED_LIST"; + + /** + * Extra containing a list of {@link android.telephony.mbms.UriPathPair}s, used in the + * response to {@link #ACTION_FILE_DESCRIPTOR_REQUEST}. These are temp files that are meant + * to be used for new file downloads. + */ + public static final String EXTRA_FREE_URI_LIST = "android.telephony.mbms.extra.FREE_URI_LIST"; + + /** + * Extra containing a list of {@link android.telephony.mbms.UriPathPair}s, used in the + * response to {@link #ACTION_FILE_DESCRIPTOR_REQUEST}. These + * {@link android.telephony.mbms.UriPathPair}s contain {@code content://} URIs that provide + * access to previously paused downloads. + */ + public static final String EXTRA_PAUSED_URI_LIST = + "android.telephony.mbms.extra.PAUSED_URI_LIST"; + + /** + * Extra containing a list of {@link Uri}s indicating temp files which the middleware is + * still using. + */ + public static final String EXTRA_TEMP_FILES_IN_USE = + "android.telephony.mbms.extra.TEMP_FILES_IN_USE"; + + public static final int RESULT_SUCCESSFUL = 1; + public static final int RESULT_CANCELLED = 2; + public static final int RESULT_EXPIRED = 3; + // TODO - more results! + private final Context mContext; private int mSubId = INVALID_SUBSCRIPTION_ID; + private IMbmsDownloadService mService; + private final IMbmsDownloadManagerCallback mCallback; + private final String mDownloadAppName; + + private MbmsDownloadManager(Context context, IMbmsDownloadManagerCallback callback, + String downloadAppName, int subId) { + mContext = context; + mCallback = callback; + mDownloadAppName = downloadAppName; + mSubId = subId; + } + /** * Create a new MbmsDownloadManager using the system default data subscription ID. * @@ -42,9 +170,13 @@ public class MbmsDownloadManager { * * @hide */ - public MbmsDownloadManager(Context context, IMbmsDownloadManagerListener listener, - String downloadAppName) { - mContext = context; + public static MbmsDownloadManager createManager(Context context, + IMbmsDownloadManagerCallback listener, String downloadAppName) + throws MbmsInitializationException{ + MbmsDownloadManager mdm = new MbmsDownloadManager(context, listener, downloadAppName, + SubscriptionManager.getDefaultSubscriptionId()); + mdm.bindAndInitialize(); + return mdm; } /** @@ -55,9 +187,23 @@ public class MbmsDownloadManager { * * @hide */ - public MbmsDownloadManager(Context context, IMbmsDownloadManagerListener listener, - String downloadAppName, int subId) { - mContext = context; + + public static MbmsDownloadManager createManager(Context context, + IMbmsDownloadManagerCallback listener, String downloadAppName, int subId) + throws MbmsInitializationException { + MbmsDownloadManager mdm = new MbmsDownloadManager(context, listener, downloadAppName, + subId); + mdm.bindAndInitialize(); + return mdm; + } + + private void bindAndInitialize() throws MbmsInitializationException { + // TODO: bind + try { + mService.initialize(mDownloadAppName, mSubId, mCallback); + } catch (RemoteException e) { + throw new MbmsInitializationException(0); // TODO: proper error code + } } /** @@ -84,31 +230,9 @@ public class MbmsDownloadManager { } - public static final String EXTRA_REQUEST = "extraRequest"; - - public static final int RESULT_SUCCESSFUL = 1; - public static final int RESULT_CANCELLED = 2; - public static final int RESULT_EXPIRED = 3; - // TODO - more results! - - public static final String EXTRA_RESULT = "extraResult"; - public static final String EXTRA_URI = "extraDownloadedUri"; - /** * Requests a future download. * returns a token which may be used to cancel a download. - * fileServiceInfo indicates what FileService to download from - * source indicates which file to download from the given FileService. This is - * an optional field - it may be null or empty to indicate download everything from - * the FileService. - * destination is a file URI for where in the apps accessible storage locations to write - * the content. This URI may be used to store temporary data and should not be - * accessed until the PendingIntent is called indicating success. - * resultIntent is sent when each file is completed and when the request is concluded - * either via TTL expiration, cancel or error. - * This intent is sent with three extras: a {@link DownloadRequest} typed extra called - * {@link #EXTRA_REQUEST}, an Integer called {@link #EXTRA_RESULT} for the result code - * and a {@link Uri} called {@link #EXTRA_URI} to the resulting file (if successful). * downloadListener is an optional callback object which can be used to get progress reports * of a currently occuring download. Note this can only run while the calling app * is running, so future downloads will simply result in resultIntents being sent @@ -118,7 +242,7 @@ public class MbmsDownloadManager { * * Asynchronous errors through the listener include any of the errors */ - public DownloadRequest download(DownloadRequest downloadRequest, DownloadListener listener) { + public DownloadRequest download(DownloadRequest downloadRequest, DownloadCallback listener) { return null; } @@ -168,7 +292,7 @@ public class MbmsDownloadManager { } /** - * Resets middleware knowldge regarding this download request. + * Resets middleware knowledge regarding this download request. * * This state consists of knowledge of what files have already been downloaded. * Normally the middleware won't download files who's hash matches previously downloaded @@ -187,5 +311,15 @@ public class MbmsDownloadManager { } public void dispose() { + try { + if (mService != null) { + mService.dispose(mDownloadAppName, mSubId); + } else { + Log.i(LOG_TAG, "Service already dead"); + } + } catch (RemoteException e) { + // Ignore + Log.i(LOG_TAG, "Remote exception while disposing of service"); + } } } diff --git a/telephony/java/android/telephony/MbmsStreamingManager.java b/telephony/java/android/telephony/MbmsStreamingManager.java index 9a2ba6de93de..770a04a8881a 100644 --- a/telephony/java/android/telephony/MbmsStreamingManager.java +++ b/telephony/java/android/telephony/MbmsStreamingManager.java @@ -17,10 +17,13 @@ package android.telephony; import android.content.Context; -import android.telephony.mbms.IMbmsStreamingManagerListener; -import android.telephony.mbms.IStreamingServiceListener; +import android.os.RemoteException; +import android.telephony.mbms.IMbmsStreamingManagerCallback; +import android.telephony.mbms.IStreamingServiceCallback; +import android.telephony.mbms.MbmsInitializationException; import android.telephony.mbms.StreamingService; import android.telephony.mbms.StreamingServiceInfo; +import android.telephony.mbms.vendor.IMbmsStreamingService; import android.util.Log; import java.util.List; @@ -31,30 +34,60 @@ import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; public class MbmsStreamingManager { private static final String LOG_TAG = "MbmsStreamingManager"; private static final boolean DEBUG = true; + private IMbmsStreamingService mService; + private IMbmsStreamingManagerCallback mCallbackToApp; + private final String mAppName; private final Context mContext; - private int mSubId = INVALID_SUBSCRIPTION_ID; + private int mSubscriptionId = INVALID_SUBSCRIPTION_ID; + + /** @hide */ + private MbmsStreamingManager(Context context, IMbmsStreamingManagerCallback listener, + String streamingAppName, int subscriptionId) { + mContext = context; + mAppName = streamingAppName; + mCallbackToApp = listener; + mSubscriptionId = subscriptionId; + } /** - * Create a new MbmsStreamingManager using the system default data subscription ID. + * Create a new MbmsStreamingManager using the given subscription ID. * * Note that this call will bind a remote service and that may take a bit. This * may throw an IllegalArgumentException or RemoteException. + * TODO: document this and add exceptions that can be thrown for synchronous + * initialization/bind errors + * + * @param context + * @param listener + * @param streamingAppName + * @param subscriptionId + * @return */ - public MbmsStreamingManager(Context context, IMbmsStreamingManagerListener listener, - String streamingAppName) { - mContext = context; + public static MbmsStreamingManager create(Context context, + IMbmsStreamingManagerCallback listener, String streamingAppName, int subscriptionId) + throws MbmsInitializationException { + MbmsStreamingManager manager = new MbmsStreamingManager(context, listener, + streamingAppName, subscriptionId); + manager.bindAndInitialize(); + return manager; } /** - * Create a new MbmsStreamingManager using the given subscription ID. + * Create a new MbmsStreamingManager using the system default data subscription ID. * * Note that this call will bind a remote service and that may take a bit. This * may throw an IllegalArgumentException or RemoteException. */ - public MbmsStreamingManager(Context context, IMbmsStreamingManagerListener listener, - String streamingAppName, int subId) { - mContext = context; + public static MbmsStreamingManager create(Context context, + IMbmsStreamingManagerCallback listener, String streamingAppName) + throws MbmsInitializationException { + // TODO: get default sub id + int subId = INVALID_SUBSCRIPTION_ID; + MbmsStreamingManager manager = new MbmsStreamingManager(context, listener, + streamingAppName, subId); + manager.bindAndInitialize(); + return manager; } /** @@ -97,7 +130,7 @@ public class MbmsStreamingManager { * Asynchronous errors through the listener include any of the errors */ public StreamingService startStreaming(StreamingServiceInfo serviceInfo, - IStreamingServiceListener listener) { + IStreamingServiceCallback listener) { return null; } @@ -125,4 +158,20 @@ public class MbmsStreamingManager { private void logd(String str) { Log.d(LOG_TAG, str); } + + private boolean isServiceConnected() { + return mService != null; + } + + private void bindAndInitialize() throws MbmsInitializationException { + // TODO: bind to the service + try { + int returnCode = mService.initialize(mCallbackToApp, mAppName, mSubscriptionId); + if (returnCode != 0) { + throw new MbmsInitializationException(returnCode); + } + } catch (RemoteException e) { + throw new MbmsInitializationException(/* some error */ 0); + } + } } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 5a848d956f5d..59858133a6fa 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -24,6 +24,8 @@ import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.annotation.WorkerThread; +import android.annotation.SystemApi; import android.app.ActivityThread; import android.app.PendingIntent; import android.content.ContentResolver; @@ -883,7 +885,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getDeviceSoftwareVersion() { - return getDeviceSoftwareVersion(getDefaultSim()); + return getDeviceSoftwareVersion(getSlotIndex()); } /** @@ -969,7 +971,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getImei() { - return getImei(getDefaultSim()); + return getImei(getSlotIndex()); } /** @@ -1001,7 +1003,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getMeid() { - return getMeid(getDefaultSim()); + return getMeid(getSlotIndex()); } /** @@ -1031,7 +1033,7 @@ public class TelephonyManager { */ /** {@hide}*/ public String getNai() { - return getNai(getDefaultSim()); + return getNai(getSlotIndex()); } /** @@ -1275,7 +1277,7 @@ public class TelephonyManager { } private int getPhoneTypeFromProperty() { - return getPhoneTypeFromProperty(getDefaultPhone()); + return getPhoneTypeFromProperty(getPhoneId()); } /** {@hide} */ @@ -1289,7 +1291,7 @@ public class TelephonyManager { } private int getPhoneTypeFromNetworkType() { - return getPhoneTypeFromNetworkType(getDefaultPhone()); + return getPhoneTypeFromNetworkType(getPhoneId()); } /** {@hide} */ @@ -1472,7 +1474,7 @@ public class TelephonyManager { * on a CDMA network). */ public String getNetworkOperator() { - return getNetworkOperatorForPhone(getDefaultPhone()); + return getNetworkOperatorForPhone(getPhoneId()); } /** @@ -1508,18 +1510,23 @@ public class TelephonyManager { /** - * Returns the network specifier of the subscription ID pinned to the TelephonyManager. + * Returns the network specifier of the subscription ID pinned to the TelephonyManager. The + * network specifier is used by {@link + * android.net.NetworkRequest.Builder#setNetworkSpecifier(String)} to create a {@link + * android.net.NetworkRequest} that connects through the subscription. * * @see android.net.NetworkRequest.Builder#setNetworkSpecifier(String) * @see #createForSubscriptionId(int) * @see #createForPhoneAccountHandle(PhoneAccountHandle) */ public String getNetworkSpecifier() { - return String.valueOf(mSubId); + return String.valueOf(getSubId()); } /** - * Returns the carrier config of the subscription ID pinned to the TelephonyManager. + * Returns the carrier config of the subscription ID pinned to the TelephonyManager. If an + * invalid subscription ID is pinned to the TelephonyManager, the returned config will contain + * default values. * * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE * READ_PHONE_STATE} @@ -1528,10 +1535,11 @@ public class TelephonyManager { * @see #createForSubscriptionId(int) * @see #createForPhoneAccountHandle(PhoneAccountHandle) */ + @WorkerThread public PersistableBundle getCarrierConfig() { CarrierConfigManager carrierConfigManager = mContext .getSystemService(CarrierConfigManager.class); - return carrierConfigManager.getConfigForSubId(mSubId); + return carrierConfigManager.getConfigForSubId(getSubId()); } /** @@ -1568,7 +1576,7 @@ public class TelephonyManager { * on a CDMA network). */ public String getNetworkCountryIso() { - return getNetworkCountryIsoForPhone(getDefaultPhone()); + return getNetworkCountryIsoForPhone(getPhoneId()); } /** @@ -1714,6 +1722,9 @@ public class TelephonyManager { * Returns a constant indicating the radio technology (network type) * currently in use on the device for data transmission. * + * If this object has been created with {@link #createForSubscriptionId}, applies to the given + * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} + * * <p> * Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} @@ -1738,7 +1749,7 @@ public class TelephonyManager { * @see #NETWORK_TYPE_HSPAP */ public int getDataNetworkType() { - return getDataNetworkType(getSubId()); + return getDataNetworkType(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } /** @@ -1962,7 +1973,7 @@ public class TelephonyManager { * @return true if a ICC card is present */ public boolean hasIccCard() { - return hasIccCard(getDefaultSim()); + return hasIccCard(getSlotIndex()); } /** @@ -2003,7 +2014,7 @@ public class TelephonyManager { * @see #SIM_STATE_CARD_RESTRICTED */ public int getSimState() { - int slotIndex = getDefaultSim(); + int slotIndex = getSlotIndex(); // slotIndex may be invalid due to sim being absent. In that case query all slots to get // sim state if (slotIndex < 0) { @@ -2132,7 +2143,7 @@ public class TelephonyManager { * @see #getSimState */ public String getSimOperatorName() { - return getSimOperatorNameForPhone(getDefaultPhone()); + return getSimOperatorNameForPhone(getPhoneId()); } /** @@ -2164,7 +2175,7 @@ public class TelephonyManager { * Returns the ISO country code equivalent for the SIM provider's country code. */ public String getSimCountryIso() { - return getSimCountryIsoForPhone(getDefaultPhone()); + return getSimCountryIsoForPhone(getPhoneId()); } /** @@ -2712,6 +2723,33 @@ public class TelephonyManager { return false; } + + /** + * Returns the package responsible of processing visual voicemail for the subscription ID pinned + * to the TelephonyManager. Returns {@code null} when there is no package responsible for + * processing visual voicemail for the subscription. + * + * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE + * READ_PHONE_STATE} + * + * @see #createForSubscriptionId(int) + * @see #createForPhoneAccountHandle(PhoneAccountHandle) + * @see VisualVoicemailService + */ + @Nullable + public String getVisualVoicemailPackageName() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony + .getVisualVoicemailPackageName(mContext.getOpPackageName(), getSubId()); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; + } + /** * Enables the visual voicemail SMS filter for a phone account. When the filter is * enabled, Incoming SMS messages matching the OMTP VVM SMS interface will be redirected to the @@ -3982,35 +4020,67 @@ public class TelephonyManager { * subId is returned. Otherwise, the default subId will be returned. */ private int getSubId() { - if (mSubId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) { - return getDefaultSubscription(); + if (SubscriptionManager.isUsableSubIdValue(mSubId)) { + return mSubId; } - return mSubId; + return SubscriptionManager.getDefaultSubscriptionId(); + } + + /** + * Return an appropriate subscription ID for any situation. + * + * If this object has been created with {@link #createForSubscriptionId}, then the provided + * subId is returned. Otherwise, the preferred subId which is based on caller's context is + * returned. + * {@see SubscriptionManager#getDefaultDataSubscriptionId()} + * {@see SubscriptionManager#getDefaultVoiceSubscriptionId()} + * {@see SubscriptionManager#getDefaultSmsSubscriptionId()} + */ + private int getSubId(int preferredSubId) { + if (SubscriptionManager.isUsableSubIdValue(mSubId)) { + return mSubId; + } + return preferredSubId; } /** - * Returns Default subscription. + * Return an appropriate phone ID for any situation. + * + * If this object has been created with {@link #createForSubscriptionId}, then the phoneId + * associated with the provided subId is returned. Otherwise, the default phoneId associated + * with the default subId will be returned. */ - private static int getDefaultSubscription() { - return SubscriptionManager.getDefaultSubscriptionId(); + private int getPhoneId() { + return SubscriptionManager.getPhoneId(getSubId()); } /** - * Returns Default phone. + * Return an appropriate phone ID for any situation. + * + * If this object has been created with {@link #createForSubscriptionId}, then the phoneId + * associated with the provided subId is returned. Otherwise, return the phoneId associated + * with the preferred subId based on caller's context. + * {@see SubscriptionManager#getDefaultDataSubscriptionId()} + * {@see SubscriptionManager#getDefaultVoiceSubscriptionId()} + * {@see SubscriptionManager#getDefaultSmsSubscriptionId()} */ - private static int getDefaultPhone() { - return SubscriptionManager.getPhoneId(SubscriptionManager.getDefaultSubscriptionId()); + private int getPhoneId(int preferredSubId) { + return SubscriptionManager.getPhoneId(getSubId(preferredSubId)); } /** - * @return default SIM's slot index. If SIM is not inserted, return default SIM slot index. + * Return an appropriate slot index for any situation. + * + * if this object has been created with {@link #createForSubscriptionId}, then the slot index + * associated with the provided subId is returned. Otherwise, return the slot index associated + * with the default subId. + * If SIM is not inserted, return default SIM slot index. * * {@hide} */ @VisibleForTesting - public int getDefaultSim() { - int slotIndex = SubscriptionManager.getSlotIndex( - SubscriptionManager.getDefaultSubscriptionId()); + public int getSlotIndex() { + int slotIndex = SubscriptionManager.getSlotIndex(getSubId()); if (slotIndex == SubscriptionManager.SIM_NOT_INSERTED) { slotIndex = SubscriptionManager.DEFAULT_SIM_SLOT_INDEX; } @@ -4827,7 +4897,7 @@ public class TelephonyManager { /** @hide */ @SystemApi public List<String> getCarrierPackageNamesForIntent(Intent intent) { - return getCarrierPackageNamesForIntentAndPhone(intent, getDefaultPhone()); + return getCarrierPackageNamesForIntentAndPhone(intent, getPhoneId()); } /** @hide */ @@ -5035,26 +5105,21 @@ public class TelephonyManager { public void onReceiveUssdResponseFailed(String request, int failureCode) {}; } - /* <p>Requires permission: - * @link android.Manifest.permission#CALL_PHONE} + /** + * Sends an Unstructured Supplementary Service Data (USSD) request to the cellular network and + * informs the caller of the response via {@code callback}. + * <p>Carriers define USSD codes which can be sent by the user to request information such as + * the user's current data balance or minutes balance. + * <p>Requires permission: + * {@link android.Manifest.permission#CALL_PHONE} * @param ussdRequest the USSD command to be executed. - * @param wrappedCallback receives a callback result. + * @param callback called by the framework to inform the caller of the result of executing the + * USSD request (see {@link OnReceiveUssdResponseCallback}). + * @param handler the {@link Handler} to run the request on. */ @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void sendUssdRequest(String ussdRequest, final OnReceiveUssdResponseCallback callback, Handler handler) { - sendUssdRequest(ussdRequest, getSubId(), callback, handler); - } - - /* <p>Requires permission: - * @link android.Manifest.permission#CALL_PHONE} - * @param subId The subscription to use. - * @param ussdRequest the USSD command to be executed. - * @param wrappedCallback receives a callback result. - */ - @RequiresPermission(android.Manifest.permission.CALL_PHONE) - public void sendUssdRequest(String ussdRequest, int subId, - final OnReceiveUssdResponseCallback callback, Handler handler) { checkNotNull(callback, "OnReceiveUssdResponseCallback cannot be null."); ResultReceiver wrappedCallback = new ResultReceiver(handler) { @@ -5076,7 +5141,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - telephony.handleUssdRequest(subId, ussdRequest, wrappedCallback); + telephony.handleUssdRequest(getSubId(), ussdRequest, wrappedCallback); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#sendUSSDCode", e); @@ -5094,7 +5159,8 @@ public class TelephonyManager { public boolean isConcurrentVoiceAndDataAllowed() { try { ITelephony telephony = getITelephony(); - return (telephony == null ? false : telephony.isConcurrentVoiceAndDataAllowed(mSubId)); + return (telephony == null ? false : telephony.isConcurrentVoiceAndDataAllowed( + getSubId())); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isConcurrentVoiceAndDataAllowed", e); } @@ -5231,6 +5297,8 @@ public class TelephonyManager { /** * Turns mobile data on or off. + * If this object has been created with {@link #createForSubscriptionId}, applies to the given + * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the @@ -5241,7 +5309,7 @@ public class TelephonyManager { * @see #hasCarrierPrivileges */ public void setDataEnabled(boolean enable) { - setDataEnabled(getSubId(), enable); + setDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId()), enable); } /** @hide */ @@ -5257,23 +5325,45 @@ public class TelephonyManager { } } + + /** + * @deprecated use {@link #isDataEnabled()} instead. + * @hide + */ + @SystemApi + @Deprecated + public boolean getDataEnabled() { + return isDataEnabled(); + } + /** * Returns whether mobile data is enabled or not. * - * <p>Requires Permission: - * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE}, - * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the - * calling app has carrier privileges. + * If this object has been created with {@link #createForSubscriptionId}, applies to the given + * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} + * + * <p>Requires one of the following permissions: + * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE}, + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the + * calling app has carrier privileges. + * + * <p>Note that this does not take into account any data restrictions that may be present on the + * calling app. Such restrictions may be inspected with + * {@link ConnectivityManager#getRestrictBackgroundStatus}. * * @return true if mobile data is enabled. * * @see #hasCarrierPrivileges */ - public boolean getDataEnabled() { - return getDataEnabled(getSubId()); + @SuppressWarnings("deprecation") + public boolean isDataEnabled() { + return getDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } - /** @hide */ + /** + * @deprecated use {@link #isDataEnabled(int)} instead. + * @hide + */ @SystemApi public boolean getDataEnabled(int subId) { boolean retVal = false; @@ -5517,7 +5607,7 @@ public class TelephonyManager { * @hide */ public void setSimOperatorNumeric(String numeric) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setSimOperatorNumericForPhone(phoneId, numeric); } @@ -5537,7 +5627,7 @@ public class TelephonyManager { * @hide */ public void setSimOperatorName(String name) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setSimOperatorNameForPhone(phoneId, name); } @@ -5557,7 +5647,7 @@ public class TelephonyManager { * @hide */ public void setSimCountryIso(String iso) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setSimCountryIsoForPhone(phoneId, iso); } @@ -5577,7 +5667,7 @@ public class TelephonyManager { * @hide */ public void setSimState(String state) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setSimStateForPhone(phoneId, state); } @@ -5602,7 +5692,7 @@ public class TelephonyManager { * @hide **/ public void setSimPowerState(boolean powerUp) { - setSimPowerStateForSlot(getDefaultSim(), powerUp); + setSimPowerStateForSlot(getSlotIndex(), powerUp); } /** @@ -5636,7 +5726,7 @@ public class TelephonyManager { * @hide */ public void setBasebandVersion(String version) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setBasebandVersionForPhone(phoneId, version); } @@ -5663,7 +5753,7 @@ public class TelephonyManager { * @hide */ public void setPhoneType(int type) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setPhoneType(phoneId, type); } @@ -5691,7 +5781,7 @@ public class TelephonyManager { * @hide */ public String getOtaSpNumberSchema(String defaultValue) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); return getOtaSpNumberSchemaForPhone(phoneId, defaultValue); } @@ -5722,7 +5812,7 @@ public class TelephonyManager { * @hide */ public boolean getSmsReceiveCapable(boolean defaultValue) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); return getSmsReceiveCapableForPhone(phoneId, defaultValue); } @@ -5753,7 +5843,7 @@ public class TelephonyManager { * @hide */ public boolean getSmsSendCapable(boolean defaultValue) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); return getSmsSendCapableForPhone(phoneId, defaultValue); } @@ -5781,7 +5871,7 @@ public class TelephonyManager { * @hide */ public void setNetworkOperatorName(String name) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setNetworkOperatorNameForPhone(phoneId, name); } @@ -5803,7 +5893,7 @@ public class TelephonyManager { * @hide */ public void setNetworkOperatorNumeric(String numeric) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setNetworkOperatorNumericForPhone(phoneId, numeric); } @@ -5823,7 +5913,7 @@ public class TelephonyManager { * @hide */ public void setNetworkRoaming(boolean isRoaming) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setNetworkRoamingForPhone(phoneId, isRoaming); } @@ -5847,7 +5937,7 @@ public class TelephonyManager { * @hide */ public void setNetworkCountryIso(String iso) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(); setNetworkCountryIsoForPhone(phoneId, iso); } @@ -5867,11 +5957,15 @@ public class TelephonyManager { /** * Set the network type currently in use on the device for data transmission. + * + * If this object has been created with {@link #createForSubscriptionId}, applies to the + * phoneId associated with the given subId. Otherwise, applies to the phoneId associated with + * {@link SubscriptionManager#getDefaultDataSubscriptionId()} * @param type the network type currently in use on the device for data transmission * @hide */ public void setDataNetworkType(int type) { - int phoneId = getDefaultPhone(); + int phoneId = getPhoneId(SubscriptionManager.getDefaultDataSubscriptionId()); setDataNetworkTypeForPhone(phoneId, type); } @@ -6043,7 +6137,7 @@ public class TelephonyManager { * @hide */ public String getAidForAppType(int appType) { - return getAidForAppType(getDefaultSubscription(), appType); + return getAidForAppType(getSubId(), appType); } /** @@ -6077,7 +6171,7 @@ public class TelephonyManager { * @hide */ public String getEsn() { - return getEsn(getDefaultSubscription()); + return getEsn(getSubId()); } /** @@ -6110,7 +6204,7 @@ public class TelephonyManager { * @hide */ public String getCdmaPrlVersion() { - return getCdmaPrlVersion(getDefaultSubscription()); + return getCdmaPrlVersion(getSubId()); } /** diff --git a/telephony/java/android/telephony/VisualVoicemailSms.java b/telephony/java/android/telephony/VisualVoicemailSms.java index 6235c10ab12a..1e6ea4bfa001 100644 --- a/telephony/java/android/telephony/VisualVoicemailSms.java +++ b/telephony/java/android/telephony/VisualVoicemailSms.java @@ -63,7 +63,8 @@ public final class VisualVoicemailSms implements Parcelable { /** * The key-value pairs sent by the SMS, or {@code null} if the framework cannot parse the SMS as - * voicemail but the carrier pattern indicates it is. + * voicemail but the carrier pattern indicates it is. The interpretation of the fields is + * carrier dependent. */ public Bundle getFields() { return mFields; diff --git a/telephony/java/android/telephony/VisualVoicemailSmsFilterSettings.java b/telephony/java/android/telephony/VisualVoicemailSmsFilterSettings.java index 9d19d0860407..56a8c6255824 100644 --- a/telephony/java/android/telephony/VisualVoicemailSmsFilterSettings.java +++ b/telephony/java/android/telephony/VisualVoicemailSmsFilterSettings.java @@ -16,7 +16,6 @@ package android.telephony; import android.content.Context; -import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; @@ -55,8 +54,17 @@ public final class VisualVoicemailSmsFilterSettings implements Parcelable { */ public static final int DESTINATION_PORT_DATA_SMS = -2; + /** + * @hide + */ public static final String DEFAULT_CLIENT_PREFIX = "//VVM"; + /** + * @hide + */ public static final List<String> DEFAULT_ORIGINATING_NUMBERS = Collections.emptyList(); + /** + * @hide + */ public static final int DEFAULT_DESTINATION_PORT = DESTINATION_PORT_ANY; /** diff --git a/telephony/java/android/telephony/ims/ImsServiceProxy.java b/telephony/java/android/telephony/ims/ImsServiceProxy.java index 38ea6e6ff9a0..a75cd86dcf07 100644 --- a/telephony/java/android/telephony/ims/ImsServiceProxy.java +++ b/telephony/java/android/telephony/ims/ImsServiceProxy.java @@ -120,7 +120,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur public int startSession(PendingIntent incomingCallIntent, IImsRegistrationListener listener) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).startSession(mSlotId, mSupportedFeature, incomingCallIntent, listener); } @@ -129,7 +129,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public void endSession(int sessionId) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); getServiceInterface(mBinder).endSession(mSlotId, mSupportedFeature, sessionId); } } @@ -138,7 +138,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur public boolean isConnected(int callServiceType, int callType) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).isConnected(mSlotId, mSupportedFeature, callServiceType, callType); } @@ -147,7 +147,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public boolean isOpened() throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).isOpened(mSlotId, mSupportedFeature); } } @@ -156,7 +156,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur public void addRegistrationListener(IImsRegistrationListener listener) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); getServiceInterface(mBinder).addRegistrationListener(mSlotId, mSupportedFeature, listener); } @@ -166,7 +166,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur public void removeRegistrationListener(IImsRegistrationListener listener) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); getServiceInterface(mBinder).removeRegistrationListener(mSlotId, mSupportedFeature, listener); } @@ -176,7 +176,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur public ImsCallProfile createCallProfile(int sessionId, int callServiceType, int callType) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).createCallProfile(mSlotId, mSupportedFeature, sessionId, callServiceType, callType); } @@ -186,7 +186,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur public IImsCallSession createCallSession(int sessionId, ImsCallProfile profile, IImsCallSessionListener listener) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).createCallSession(mSlotId, mSupportedFeature, sessionId, profile, listener); } @@ -196,7 +196,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur public IImsCallSession getPendingCallSession(int sessionId, String callId) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).getPendingCallSession(mSlotId, mSupportedFeature, sessionId, callId); } @@ -205,7 +205,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public IImsUt getUtInterface() throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).getUtInterface(mSlotId, mSupportedFeature); } } @@ -213,7 +213,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public IImsConfig getConfigInterface() throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).getConfigInterface(mSlotId, mSupportedFeature); } } @@ -221,7 +221,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public void turnOnIms() throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); getServiceInterface(mBinder).turnOnIms(mSlotId, mSupportedFeature); } } @@ -229,7 +229,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public void turnOffIms() throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); getServiceInterface(mBinder).turnOffIms(mSlotId, mSupportedFeature); } } @@ -237,7 +237,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public IImsEcbm getEcbmInterface() throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).getEcbmInterface(mSlotId, mSupportedFeature); } } @@ -246,7 +246,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur public void setUiTTYMode(int uiTtyMode, Message onComplete) throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); getServiceInterface(mBinder).setUiTTYMode(mSlotId, mSupportedFeature, uiTtyMode, onComplete); } @@ -255,7 +255,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public IImsMultiEndpoint getMultiEndpointInterface() throws RemoteException { synchronized (mLock) { - checkBinderConnection(); + checkServiceIsReady(); return getServiceInterface(mBinder).getMultiEndpointInterface(mSlotId, mSupportedFeature); } @@ -264,7 +264,8 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur @Override public int getFeatureStatus() { synchronized (mLock) { - if (mFeatureStatusCached != null) { + if (isBinderAlive() && mFeatureStatusCached != null) { + Log.i(LOG_TAG, "getFeatureStatus - returning cached: " + mFeatureStatusCached); return mFeatureStatusCached; } } @@ -277,6 +278,7 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur // Cache only non-null value for feature status. mFeatureStatusCached = status; } + Log.i(LOG_TAG, "getFeatureStatus - returning " + status); return status; } @@ -301,10 +303,28 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur mStatusCallback = c; } + /** + * @return Returns true if the ImsService is ready to take commands, false otherwise. If this + * method returns false, it doesn't mean that the Binder connection is not available (use + * {@link #isBinderReady()} to check that), but that the ImsService is not accepting commands + * at this time. + * + * For example, for DSDS devices, only one slot can be {@link ImsFeature#STATE_READY} to take + * commands at a time, so the other slot must stay at {@link ImsFeature#STATE_NOT_AVAILABLE}. + */ + public boolean isBinderReady() { + return isBinderAlive() && getFeatureStatus() == ImsFeature.STATE_READY; + } + @Override public boolean isBinderAlive() { - return mIsAvailable && getFeatureStatus() == ImsFeature.STATE_READY && mBinder != null && - mBinder.isBinderAlive(); + return mIsAvailable && mBinder != null && mBinder.isBinderAlive(); + } + + protected void checkServiceIsReady() throws RemoteException { + if (!isBinderReady()) { + throw new RemoteException("ImsServiceProxy is not ready to accept commands."); + } } private IImsServiceController getServiceInterface(IBinder b) { diff --git a/telephony/java/android/telephony/ims/feature/ImsFeature.java b/telephony/java/android/telephony/ims/feature/ImsFeature.java index 988dd588ecad..395f1ccc7a29 100644 --- a/telephony/java/android/telephony/ims/feature/ImsFeature.java +++ b/telephony/java/android/telephony/ims/feature/ImsFeature.java @@ -150,7 +150,7 @@ public abstract class ImsFeature { private void notifyFeatureState(@ImsState int state) { if (mStatusCallback != null) { try { - Log.i(LOG_TAG, "notifying ImsFeatureState"); + Log.i(LOG_TAG, "notifying ImsFeatureState=" + state); mStatusCallback.notifyImsFeatureStatus(state); } catch (RemoteException e) { mStatusCallback = null; diff --git a/telephony/java/android/telephony/mbms/DownloadListener.java b/telephony/java/android/telephony/mbms/DownloadCallback.java index 8d1bd024a5db..0c6fec4b9c75 100644 --- a/telephony/java/android/telephony/mbms/DownloadListener.java +++ b/telephony/java/android/telephony/mbms/DownloadCallback.java @@ -20,7 +20,7 @@ package android.telephony.mbms; * A optional listener class used by download clients to track progress. * @hide */ -public class DownloadListener extends IDownloadListener.Stub { +public class DownloadCallback extends IDownloadCallback.Stub { /** * Gives process callbacks for a given DownloadRequest. * request indicates which download is being referenced. diff --git a/telephony/java/android/telephony/mbms/DownloadRequest.java b/telephony/java/android/telephony/mbms/DownloadRequest.java index 42a82da94d31..dbaf10bb68eb 100644 --- a/telephony/java/android/telephony/mbms/DownloadRequest.java +++ b/telephony/java/android/telephony/mbms/DownloadRequest.java @@ -16,44 +16,101 @@ package android.telephony.mbms; -import android.app.PendingIntent; +import android.content.Intent; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; +import java.net.URISyntaxException; + /** * A Parcelable class describing a pending Cell-Broadcast download request * @hide */ public class DownloadRequest implements Parcelable { - public DownloadRequest(int id, FileServiceInfo serviceInfo, Uri source, Uri dest, - PendingIntent resultPI, int sub) { + /** @hide */ + public static class Builder { + private int id; + private FileServiceInfo serviceInfo; + private Uri source; + private Uri dest; + private int sub; + private String appIntent; + + public Builder setId(int id) { + this.id = id; + return this; + } + + public Builder setServiceInfo(FileServiceInfo serviceInfo) { + this.serviceInfo = serviceInfo; + return this; + } + + public Builder setSource(Uri source) { + this.source = source; + return this; + } + + public Builder setDest(Uri dest) { + this.dest = dest; + return this; + } + + public Builder setSub(int sub) { + this.sub = sub; + return this; + } + + public Builder setAppIntent(Intent intent) { + this.appIntent = intent.toUri(0); + return this; + } + + public DownloadRequest build() { + return new DownloadRequest(id, serviceInfo, source, dest, sub, appIntent); + } + } + + private final int downloadId; + private final FileServiceInfo fileServiceInfo; + private final Uri sourceUri; + private final Uri destinationUri; + private final int subId; + private final String serializedResultIntentForApp; + + private DownloadRequest(int id, FileServiceInfo serviceInfo, + Uri source, Uri dest, + int sub, String appIntent) { downloadId = id; fileServiceInfo = serviceInfo; sourceUri = source; destinationUri = dest; subId = sub; + serializedResultIntentForApp = appIntent; } - /** @hide */ - public DownloadRequest(DownloadRequest dr, PendingIntent fdRequestPI, PendingIntent cleanupPI) { + public static DownloadRequest copy(DownloadRequest other) { + return new DownloadRequest(other); + } + + private DownloadRequest(DownloadRequest dr) { downloadId = dr.downloadId; fileServiceInfo = dr.fileServiceInfo; sourceUri = dr.sourceUri; destinationUri = dr.destinationUri; subId = dr.subId; - /* - * resultPI = new PI - * fileDescriptorRequstPI = fdRequestPI; - * this.cleanupPI = cleanupPI; - */ + serializedResultIntentForApp = dr.serializedResultIntentForApp; } - public final int downloadId; - public final FileServiceInfo fileServiceInfo; - public final Uri sourceUri; - public final Uri destinationUri; - public final int subId; + private DownloadRequest(Parcel in) { + downloadId = in.readInt(); + fileServiceInfo = in.readParcelable(getClass().getClassLoader()); + sourceUri = in.readParcelable(getClass().getClassLoader()); + destinationUri = in.readParcelable(getClass().getClassLoader()); + subId = in.readInt(); + serializedResultIntentForApp = in.readString(); + } public int describeContents() { return 0; @@ -65,14 +122,35 @@ public class DownloadRequest implements Parcelable { out.writeParcelable(sourceUri, flags); out.writeParcelable(destinationUri, flags); out.writeInt(subId); + out.writeString(serializedResultIntentForApp); } - private DownloadRequest(Parcel in) { - downloadId = in.readInt(); - fileServiceInfo = in.readParcelable(null); - sourceUri = in.readParcelable(null); - destinationUri = in.readParcelable(null); - subId = in.readInt(); + public int getDownloadId() { + return downloadId; + } + + public FileServiceInfo getFileServiceInfo() { + return fileServiceInfo; + } + + public Uri getSourceUri() { + return sourceUri; + } + + public Uri getDestinationUri() { + return destinationUri; + } + + public int getSubId() { + return subId; + } + + public Intent getIntentForApp() { + try { + return Intent.parseUri(serializedResultIntentForApp, 0); + } catch (URISyntaxException e) { + return null; + } } public static final Parcelable.Creator<DownloadRequest> CREATOR = diff --git a/telephony/java/android/telephony/mbms/IDownloadListener.aidl b/telephony/java/android/telephony/mbms/IDownloadCallback.aidl index 9838682f2bb8..a6bd7e5f84f9 100755 --- a/telephony/java/android/telephony/mbms/IDownloadListener.aidl +++ b/telephony/java/android/telephony/mbms/IDownloadCallback.aidl @@ -23,7 +23,7 @@ import android.telephony.mbms.FileInfo; * The optional interface used by download clients to track progress. * @hide */ -interface IDownloadListener +interface IDownloadCallback { /** * Gives progress callbacks for a given DownloadRequest. Includes a FileInfo diff --git a/telephony/java/android/telephony/mbms/IMbmsDownloadManagerListener.aidl b/telephony/java/android/telephony/mbms/IMbmsDownloadManagerCallback.aidl index 6b5c0217f1fc..03227d0d9f5a 100755 --- a/telephony/java/android/telephony/mbms/IMbmsDownloadManagerListener.aidl +++ b/telephony/java/android/telephony/mbms/IMbmsDownloadManagerCallback.aidl @@ -24,7 +24,7 @@ import java.util.List; * The interface the clients top-level file download listener will satisfy. * @hide */ -interface IMbmsDownloadManagerListener +interface IMbmsDownloadManagerCallback { void error(int errorCode, String message); diff --git a/telephony/java/android/telephony/mbms/IMbmsStreamingManagerListener.aidl b/telephony/java/android/telephony/mbms/IMbmsStreamingManagerCallback.aidl index 80176bfa55e4..cbf0fca461f0 100755 --- a/telephony/java/android/telephony/mbms/IMbmsStreamingManagerListener.aidl +++ b/telephony/java/android/telephony/mbms/IMbmsStreamingManagerCallback.aidl @@ -24,7 +24,7 @@ import java.util.List; * The interface the clients top-level streaming listener will satisfy. * @hide */ -interface IMbmsStreamingManagerListener +interface IMbmsStreamingManagerCallback { void error(int errorCode, String message); diff --git a/telephony/java/android/telephony/mbms/IStreamingServiceListener.aidl b/telephony/java/android/telephony/mbms/IStreamingServiceCallback.aidl index a41aca30a191..7b4ecf25ea9c 100755 --- a/telephony/java/android/telephony/mbms/IStreamingServiceListener.aidl +++ b/telephony/java/android/telephony/mbms/IStreamingServiceCallback.aidl @@ -18,13 +18,14 @@ package android.telephony.mbms; import android.net.Uri; import android.telephony.SignalStrength; +import android.telephony.mbms.StreamingService; /** * @hide */ -oneway interface IStreamingServiceListener { +oneway interface IStreamingServiceCallback { void error(int errorCode, String message); - void stateUpdated(int state); + void streamStateChanged(in StreamingService service, int state); void uriUpdated(in Uri uri); void signalStrengthUpdated(in SignalStrength signalStrength); } diff --git a/telephony/java/android/telephony/mbms/MbmsDownloadManagerListener.java b/telephony/java/android/telephony/mbms/MbmsDownloadManagerCallback.java index 04c2f9ac5dbd..16fafe415b0f 100644 --- a/telephony/java/android/telephony/mbms/MbmsDownloadManagerListener.java +++ b/telephony/java/android/telephony/mbms/MbmsDownloadManagerCallback.java @@ -22,7 +22,7 @@ import java.util.List; * A Parcelable class with Cell-Broadcast service information. * @hide */ -public class MbmsDownloadManagerListener extends IMbmsDownloadManagerListener.Stub { +public class MbmsDownloadManagerCallback extends IMbmsDownloadManagerCallback.Stub { public final static int ERROR_CARRIER_NOT_SUPPORTED = 1; public final static int ERROR_UNABLE_TO_INITIALIZE = 2; diff --git a/telephony/java/android/telephony/mbms/MbmsInitializationException.java b/telephony/java/android/telephony/mbms/MbmsInitializationException.java new file mode 100644 index 000000000000..1612bc9cc1b3 --- /dev/null +++ b/telephony/java/android/telephony/mbms/MbmsInitializationException.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 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 android.telephony.mbms; + +/** @hide */ +public class MbmsInitializationException extends Exception { + private final int mErrorCode; + + /** @hide */ + public MbmsInitializationException(int errorCode) { + super(); + mErrorCode = errorCode; + } + + public int getErrorCode() { + return mErrorCode; + } +} diff --git a/telephony/java/android/telephony/mbms/MbmsStreamingManagerListener.java b/telephony/java/android/telephony/mbms/MbmsStreamingManagerCallback.java index c64ad440ed18..b3bc8146275e 100644 --- a/telephony/java/android/telephony/mbms/MbmsStreamingManagerListener.java +++ b/telephony/java/android/telephony/mbms/MbmsStreamingManagerCallback.java @@ -22,7 +22,7 @@ import java.util.List; * A Parcelable class with Cell-Broadcast service information. * @hide */ -public class MbmsStreamingManagerListener extends IMbmsStreamingManagerListener.Stub { +public class MbmsStreamingManagerCallback extends IMbmsStreamingManagerCallback.Stub { public final static int ERROR_CARRIER_NOT_SUPPORTED = 1; public final static int ERROR_UNABLE_TO_INITIALIZE = 2; diff --git a/telephony/java/android/telephony/mbms/StreamingService.java b/telephony/java/android/telephony/mbms/StreamingService.java index ee0d89421fa9..8cc604356bad 100644 --- a/telephony/java/android/telephony/mbms/StreamingService.java +++ b/telephony/java/android/telephony/mbms/StreamingService.java @@ -33,7 +33,7 @@ public class StreamingService { /** */ StreamingService(StreamingServiceInfo streamingServiceInfo, - IStreamingServiceListener listener) { + IStreamingServiceCallback listener) { } /** diff --git a/telephony/java/android/telephony/mbms/StreamingServiceListener.java b/telephony/java/android/telephony/mbms/StreamingServiceCallback.java index bc5aebbbd6b3..7f5c486f8d90 100644 --- a/telephony/java/android/telephony/mbms/StreamingServiceListener.java +++ b/telephony/java/android/telephony/mbms/StreamingServiceCallback.java @@ -23,7 +23,7 @@ import android.telephony.SignalStrength; * A Callback class for use when the applicaiton is actively streaming content. * @hide */ -public class StreamingServiceListener extends IStreamingServiceListener.Stub { +public class StreamingServiceCallback extends IStreamingServiceCallback.Stub { public void error(int errorCode, String message) { @@ -36,7 +36,7 @@ public class StreamingServiceListener extends IStreamingServiceListener.Stub { * See {@link StreamingService#STATE_STOPPED}, {@link StreamingService#STATE_STARTED} * and {@link StreamingService#STATE_STALLED}. */ - public void stateUpdated(int state) { + public void streamStateChanged(StreamingService service, int state) { // default implementation empty } diff --git a/telephony/java/android/telephony/mbms/UriPathPair.aidl b/telephony/java/android/telephony/mbms/UriPathPair.aidl new file mode 100755 index 000000000000..8bf768246da9 --- /dev/null +++ b/telephony/java/android/telephony/mbms/UriPathPair.aidl @@ -0,0 +1,20 @@ +/* +** +** Copyright 2016, 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 android.telephony.mbms; + +parcelable UriPathPair; diff --git a/telephony/java/android/telephony/mbms/UriPathPair.java b/telephony/java/android/telephony/mbms/UriPathPair.java new file mode 100644 index 000000000000..7acc270ed729 --- /dev/null +++ b/telephony/java/android/telephony/mbms/UriPathPair.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2017 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 android.telephony.mbms; + +import android.content.ContentResolver; +import android.net.Uri; +import android.os.Parcel; +import android.os.Parcelable; + +/** @hide */ +public class UriPathPair implements Parcelable { + private final Uri mFilePathUri; + private final Uri mContentUri; + + /** @hide */ + public UriPathPair(Uri fileUri, Uri contentUri) { + if (fileUri == null || !ContentResolver.SCHEME_FILE.equals(fileUri.getScheme())) { + throw new IllegalArgumentException("File URI must have file scheme"); + } + if (contentUri == null || !ContentResolver.SCHEME_CONTENT.equals(contentUri.getScheme())) { + throw new IllegalArgumentException("Content URI must have content scheme"); + } + + mFilePathUri = fileUri; + mContentUri = contentUri; + } + + /** @hide */ + protected UriPathPair(Parcel in) { + mFilePathUri = in.readParcelable(Uri.class.getClassLoader()); + mContentUri = in.readParcelable(Uri.class.getClassLoader()); + } + + public static final Creator<UriPathPair> CREATOR = new Creator<UriPathPair>() { + @Override + public UriPathPair createFromParcel(Parcel in) { + return new UriPathPair(in); + } + + @Override + public UriPathPair[] newArray(int size) { + return new UriPathPair[size]; + } + }; + + /** future systemapi */ + public Uri getFilePathUri() { + return mFilePathUri; + } + + /** future systemapi */ + public Uri getContentUri() { + return mContentUri; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeParcelable(mFilePathUri, flags); + dest.writeParcelable(mContentUri, flags); + } +} diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl index 4ec40dafc301..3090e1275f54 100755 --- a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl +++ b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl @@ -20,8 +20,8 @@ import android.app.PendingIntent; import android.net.Uri; import android.telephony.mbms.DownloadRequest; import android.telephony.mbms.DownloadStatus; -import android.telephony.mbms.IMbmsDownloadManagerListener; -import android.telephony.mbms.IDownloadListener; +import android.telephony.mbms.IMbmsDownloadManagerCallback; +import android.telephony.mbms.IDownloadCallback; /** * The interface the opaque MbmsStreamingService will satisfy. @@ -35,7 +35,7 @@ interface IMbmsDownloadService * * No return value. Async errors may be reported, but none expected (not doing anything yet). */ - void initialize(String appName, int subId, IMbmsDownloadManagerListener listener); + void initialize(String appName, int subId, IMbmsDownloadManagerCallback listener); /** * - Registers serviceClasses of interest with the uid/appName/subId key. @@ -50,20 +50,20 @@ interface IMbmsDownloadService /** * should move the params into a DownloadRequest parcelable */ - int download(in DownloadRequest downloadRequest, IDownloadListener listener); + int download(String appName, in DownloadRequest downloadRequest, IDownloadCallback listener); - List<DownloadRequest> listPendingDownloads(); + List<DownloadRequest> listPendingDownloads(String appName); - int cancelDownload(in DownloadRequest downloadRequest); + int cancelDownload(String appName, in DownloadRequest downloadRequest); - DownloadStatus getDownloadStatus(in DownloadRequest downloadRequest); + DownloadStatus getDownloadStatus(String appName, in DownloadRequest downloadRequest); /* * named this for 2 reasons: * 1 don't want 'State' here as it conflicts with 'Status' of the previous function * 2 want to perfect typing 'Knowledge' */ - void resetDownloadKnowledge(in DownloadRequest downloadRequest); + void resetDownloadKnowledge(String appName, in DownloadRequest downloadRequest); /** * End of life for this MbmsDownloadManager. diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl index cb83969b0958..fbc093134aba 100755 --- a/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl +++ b/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl @@ -17,8 +17,8 @@ package android.telephony.mbms.vendor; import android.net.Uri; -import android.telephony.mbms.IMbmsStreamingManagerListener; -import android.telephony.mbms.IStreamingServiceListener; +import android.telephony.mbms.IMbmsStreamingManagerCallback; +import android.telephony.mbms.IStreamingServiceCallback; import android.telephony.mbms.StreamingService; import android.telephony.mbms.StreamingServiceInfo; import android.telephony.SignalStrength; @@ -34,7 +34,7 @@ interface IMbmsStreamingService * Registers this listener, subId with this appName * */ - int initialize(IMbmsStreamingManagerListener listener, String appName, int subId); + int initialize(IMbmsStreamingManagerCallback listener, String appName, int subId); /** @@ -55,7 +55,7 @@ interface IMbmsStreamingService * URL-change and State-change pair. */ StreamingService startStreaming(String appName, int subId, String serviceId, - IStreamingServiceListener listener); + IStreamingServiceCallback listener); /** * Asynchronously fetches all Services being streamed by this uid/appName/subId. diff --git a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java new file mode 100644 index 000000000000..369aef1c2c68 --- /dev/null +++ b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2017 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 android.telephony.mbms.vendor; + +import android.os.RemoteException; +import android.telephony.mbms.DownloadRequest; +import android.telephony.mbms.DownloadStatus; +import android.telephony.mbms.IDownloadCallback; +import android.telephony.mbms.IMbmsDownloadManagerCallback; + +import java.util.List; + +/** + * Base class for MbmsDownloadService. The middleware should extend this base class rather than + * the aidl stub for compatibility + * @hide + * TODO: future systemapi + */ +public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub { + @Override + public void initialize(String appName, int subId, IMbmsDownloadManagerCallback listener) + throws RemoteException { + } + + @Override + public int getFileServices(String appName, int subId, List<String> serviceClasses) throws + RemoteException { + return 0; + } + + @Override + public int download(String appName, DownloadRequest downloadRequest, IDownloadCallback listener) + throws RemoteException { + return 0; + } + + @Override + public List<DownloadRequest> listPendingDownloads(String appName) throws RemoteException { + return null; + } + + @Override + public int cancelDownload(String appName, DownloadRequest downloadRequest) + throws RemoteException { + return 0; + } + + @Override + public DownloadStatus getDownloadStatus(String appName, DownloadRequest downloadRequest) + throws RemoteException { + return null; + } + + @Override + public void resetDownloadKnowledge(String appName, DownloadRequest downloadRequest) + throws RemoteException { + } + + @Override + public void dispose(String appName, int subId) throws RemoteException { + } +} diff --git a/telephony/java/android/telephony/mbms/vendor/MbmsStreamingServiceBase.java b/telephony/java/android/telephony/mbms/vendor/MbmsStreamingServiceBase.java new file mode 100644 index 000000000000..1c8ab7c544d0 --- /dev/null +++ b/telephony/java/android/telephony/mbms/vendor/MbmsStreamingServiceBase.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2017 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 android.telephony.mbms.vendor; + +import android.net.Uri; +import android.os.RemoteException; +import android.telephony.mbms.IMbmsStreamingManagerCallback; +import android.telephony.mbms.IStreamingServiceCallback; +import android.telephony.mbms.StreamingService; + +import java.util.List; + +/** + * @hide + * TODO: future systemapi + */ +public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub { + + @Override + public int initialize(IMbmsStreamingManagerCallback listener, String appName, int subId) + throws RemoteException { + return 0; + } + + @Override + public int getStreamingServices(String appName, int subId, List<String> serviceClasses) + throws RemoteException { + return 0; + } + + @Override + public StreamingService startStreaming(String appName, int subId, + String serviceId, IStreamingServiceCallback listener) throws RemoteException { + return null; + } + + @Override + public int getActiveStreamingServices(String appName, int subId) throws RemoteException { + return 0; + } + + @Override + public Uri getPlaybackUri(String appName, int subId, String serviceId) throws RemoteException { + return null; + } + + @Override + public void switchStreams(String appName, int subId, String oldServiceId, String newServiceId) + throws RemoteException { + } + + @Override + public int getState(String appName, int subId, String serviceId) throws RemoteException { + return 0; + } + + @Override + public void stopStreaming(String appName, int subId, String serviceId) throws RemoteException { + } + + @Override + public void disposeStream(String appName, int subId, String serviceId) throws RemoteException { + } + + @Override + public void dispose(String appName, int subId) throws RemoteException { + } +} diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 6de62de866f2..f2e1e2691c8f 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -504,6 +504,8 @@ interface ITelephony { boolean isVisualVoicemailEnabled(String callingPackage, in PhoneAccountHandle accountHandle); + String getVisualVoicemailPackageName(String callingPackage, int subId); + // Not oneway, caller needs to make sure the vaule is set before receiving a SMS void enableVisualVoicemailSmsFilter(String callingPackage, int subId, in VisualVoicemailSmsFilterSettings settings); diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 1e1d7a6cfa9d..954b17f744f2 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -414,6 +414,7 @@ cat include/telephony/ril.h | \ int RIL_REQUEST_SEND_DEVICE_STATE = 138; int RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER = 139; int RIL_REQUEST_SET_SIM_CARD_POWER = 140; + int RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION = 141; int RIL_RESPONSE_ACKNOWLEDGEMENT = 800; @@ -465,4 +466,5 @@ cat include/telephony/ril.h | \ int RIL_UNSOL_STK_CC_ALPHA_NOTIFY = 1044; int RIL_UNSOL_LCEDATA_RECV = 1045; int RIL_UNSOL_PCO_DATA = 1046; + int RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION = 1047; } diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java index ce4e7e215da2..55a8b0bbc001 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java +++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java @@ -402,7 +402,7 @@ public class TelephonyIntents { * <ul> * <li>apnType</li><dd>A string with the apn type.</dd> * <li>redirectionUrl</li><dd>redirection url string</dd> - * <li>subId</dt><li>Sub Id which associated the data connection failure.</dd> + * <li>subId</li><dd>Sub Id which associated the data connection failure.</dd> * </ul> * <p class="note">This is a protected intent that can only be sent by the system.</p> */ @@ -415,7 +415,7 @@ public class TelephonyIntents { * <ul> * <li>apnType</li><dd>A string with the apn type.</dd> * <li>errorCode</li><dd>A integer with dataFailCause.</dd> - * <li>subId</dt><li>Sub Id which associated the data connection failure.</dd> + * <li>subId</li><dd>Sub Id which associated the data connection failure.</dd> * </ul> * <p class="note">This is a protected intent that can only be sent by the system. </p> */ @@ -432,13 +432,25 @@ public class TelephonyIntents { * IPV4V6)</dd> * <li>pcoId</li><dd>An integer indicating the pco id for the data.</dd> * <li>pcoValue</li><dd>A byte array of pco data read from modem.</dd> - * <li>subId</dt><li>Sub Id which associated the data connection.</dd> + * <li>subId</li><dd>Sub Id which associated the data connection.</dd> * </ul> * <p class="note">This is a protected intent that can only be sent by the system. </p> */ public static final String ACTION_CARRIER_SIGNAL_PCO_VALUE = "com.android.internal.telephony.CARRIER_SIGNAL_PCO_VALUE"; + /** + * <p>Broadcast Action: when framework reset all carrier actions on sim load or absent. + * intended for carrier apps clean up (clear UI e.g.) and only sent to the specified carrier app + * The intent will have the following extra values:</p> + * <ul> + * <li>subId</li><dd>Sub Id which associated the data connection failure.</dd> + * </ul> + * <p class="note">This is a protected intent that can only be sent by the system.</p> + */ + public static final String ACTION_CARRIER_SIGNAL_RESET = + "com.android.internal.telephony.CARRIER_SIGNAL_RESET"; + // CARRIER_SIGNAL_ACTION extra keys public static final String EXTRA_REDIRECTION_URL_KEY = "redirectionUrl"; public static final String EXTRA_ERROR_CODE_KEY = "errorCode"; diff --git a/tests/net/java/com/android/server/connectivity/TetheringTest.java b/tests/net/java/com/android/server/connectivity/TetheringTest.java index b2c1244af708..7a1c2395c438 100644 --- a/tests/net/java/com/android/server/connectivity/TetheringTest.java +++ b/tests/net/java/com/android/server/connectivity/TetheringTest.java @@ -236,6 +236,9 @@ public class TetheringTest { verify(mNMService, times(1)).setIpForwardingEnabled(true); verify(mNMService, times(1)).startTethering(any(String[].class)); verifyNoMoreInteractions(mNMService); + verify(mWifiManager).updateInterfaceIpState( + mTestIfname, WifiManager.IFACE_IP_MODE_LOCAL_ONLY); + verifyNoMoreInteractions(mWifiManager); verifyTetheringBroadcast(mTestIfname, ConnectivityManager.EXTRA_ACTIVE_LOCAL_ONLY); // UpstreamNetworkMonitor will be started, and will register two callbacks: // a "listen all" and a "track default". @@ -261,6 +264,7 @@ public class TetheringTest { verify(mNMService, times(1)).stopTethering(); verify(mNMService, times(1)).setIpForwardingEnabled(false); verifyNoMoreInteractions(mNMService); + verifyNoMoreInteractions(mWifiManager); // Asking for the last error after the per-interface state machine // has been reaped yields an unknown interface error. assertEquals(ConnectivityManager.TETHER_ERROR_UNKNOWN_IFACE, @@ -292,6 +296,9 @@ public class TetheringTest { verify(mNMService, times(1)).setIpForwardingEnabled(true); verify(mNMService, times(1)).startTethering(any(String[].class)); verifyNoMoreInteractions(mNMService); + verify(mWifiManager).updateInterfaceIpState( + mTestIfname, WifiManager.IFACE_IP_MODE_TETHERED); + verifyNoMoreInteractions(mWifiManager); verifyTetheringBroadcast(mTestIfname, ConnectivityManager.EXTRA_ACTIVE_TETHER); // UpstreamNetworkMonitor will be started, and will register two callbacks: // a "listen all" and a "track default". @@ -338,6 +345,7 @@ public class TetheringTest { verify(mNMService, times(1)).stopTethering(); verify(mNMService, times(1)).setIpForwardingEnabled(false); verifyNoMoreInteractions(mNMService); + verifyNoMoreInteractions(mWifiManager); // Asking for the last error after the per-interface state machine // has been reaped yields an unknown interface error. assertEquals(ConnectivityManager.TETHER_ERROR_UNKNOWN_IFACE, diff --git a/tools/aapt2/compile/Png.cpp b/tools/aapt2/compile/Png.cpp index bbf7f411d07e..65c4eb864513 100644 --- a/tools/aapt2/compile/Png.cpp +++ b/tools/aapt2/compile/Png.cpp @@ -1080,6 +1080,10 @@ static bool do9Patch(PngInfo* image, std::string* outError) { newRows[i] = image->rows[i + 1]; memmove(newRows[i], newRows[i] + 4, (W - 2) * 4); } + delete[] image->rows[0]; + if (H - 1 > 0) { + delete[] image->rows[H - 1]; + } image->rows.swap(newRows); image->width -= 2; |