Merge "Renamed data/net service provider onDestroy to close" am: 47d385a5b3

am: 8c539c5eee

Change-Id: If9596c83f8a5e960f4675b80ddcc1eab8f67c178
This commit is contained in:
Jack Yu
2018-12-14 15:53:13 -08:00
committed by android-build-merger
4 changed files with 22 additions and 28 deletions

View File

@@ -5081,16 +5081,15 @@ package android.telephony {
public abstract class NetworkService extends android.app.Service { public abstract class NetworkService extends android.app.Service {
ctor public NetworkService(); ctor public NetworkService();
method protected abstract android.telephony.NetworkService.NetworkServiceProvider createNetworkServiceProvider(int); method protected abstract android.telephony.NetworkService.NetworkServiceProvider createNetworkServiceProvider(int);
field public static final java.lang.String NETWORK_SERVICE_EXTRA_SLOT_ID = "android.telephony.extra.SLOT_ID";
field public static final java.lang.String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService"; field public static final java.lang.String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService";
} }
public class NetworkService.NetworkServiceProvider { public abstract class NetworkService.NetworkServiceProvider implements java.lang.AutoCloseable {
ctor public NetworkService.NetworkServiceProvider(int); ctor public NetworkService.NetworkServiceProvider(int);
method public abstract void close();
method public void getNetworkRegistrationState(int, android.telephony.NetworkServiceCallback); method public void getNetworkRegistrationState(int, android.telephony.NetworkServiceCallback);
method public final int getSlotId(); method public final int getSlotId();
method public final void notifyNetworkRegistrationStateChanged(); method public final void notifyNetworkRegistrationStateChanged();
method protected void onDestroy();
} }
public class NetworkServiceCallback { public class NetworkServiceCallback {
@@ -5403,20 +5402,19 @@ package android.telephony.data {
public abstract class DataService extends android.app.Service { public abstract class DataService extends android.app.Service {
ctor public DataService(); ctor public DataService();
method public abstract android.telephony.data.DataService.DataServiceProvider createDataServiceProvider(int); method public abstract android.telephony.data.DataService.DataServiceProvider createDataServiceProvider(int);
field public static final java.lang.String DATA_SERVICE_EXTRA_SLOT_ID = "android.telephony.data.extra.SLOT_ID";
field public static final java.lang.String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService"; field public static final java.lang.String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService";
field public static final int REQUEST_REASON_HANDOVER = 3; // 0x3 field public static final int REQUEST_REASON_HANDOVER = 3; // 0x3
field public static final int REQUEST_REASON_NORMAL = 1; // 0x1 field public static final int REQUEST_REASON_NORMAL = 1; // 0x1
field public static final int REQUEST_REASON_SHUTDOWN = 2; // 0x2 field public static final int REQUEST_REASON_SHUTDOWN = 2; // 0x2
} }
public class DataService.DataServiceProvider { public abstract class DataService.DataServiceProvider implements java.lang.AutoCloseable {
ctor public DataService.DataServiceProvider(int); ctor public DataService.DataServiceProvider(int);
method public abstract void close();
method public void deactivateDataCall(int, int, android.telephony.data.DataServiceCallback); method public void deactivateDataCall(int, int, android.telephony.data.DataServiceCallback);
method public void getDataCallList(android.telephony.data.DataServiceCallback); method public void getDataCallList(android.telephony.data.DataServiceCallback);
method public final int getSlotId(); method public final int getSlotId();
method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>); method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
method protected void onDestroy();
method public void setDataProfile(java.util.List<android.telephony.data.DataProfile>, boolean, android.telephony.data.DataServiceCallback); method public void setDataProfile(java.util.List<android.telephony.data.DataProfile>, boolean, android.telephony.data.DataServiceCallback);
method public void setInitialAttachApn(android.telephony.data.DataProfile, boolean, android.telephony.data.DataServiceCallback); method public void setInitialAttachApn(android.telephony.data.DataProfile, boolean, android.telephony.data.DataServiceCallback);
method public void setupDataCall(int, android.telephony.data.DataProfile, boolean, boolean, int, android.net.LinkProperties, android.telephony.data.DataServiceCallback); method public void setupDataCall(int, android.telephony.data.DataProfile, boolean, boolean, int, android.net.LinkProperties, android.telephony.data.DataServiceCallback);
@@ -5935,8 +5933,8 @@ package android.telephony.ims {
field public static final int CODE_SIP_SERVER_TIMEOUT = 353; // 0x161 field public static final int CODE_SIP_SERVER_TIMEOUT = 353; // 0x161
field public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352; // 0x160 field public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352; // 0x160
field public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336; // 0x150 field public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336; // 0x150
field public static final int CODE_SIP_TRANSACTION_DOES_NOT_EXIST = 343; // 0x157
field public static final int CODE_SIP_TOO_MANY_HOPS = 374; // 0x176 field public static final int CODE_SIP_TOO_MANY_HOPS = 374; // 0x176
field public static final int CODE_SIP_TRANSACTION_DOES_NOT_EXIST = 343; // 0x157
field public static final int CODE_SIP_UNDECIPHERABLE = 378; // 0x17a field public static final int CODE_SIP_UNDECIPHERABLE = 378; // 0x17a
field public static final int CODE_SIP_USER_MARKED_UNWANTED = 365; // 0x16d field public static final int CODE_SIP_USER_MARKED_UNWANTED = 365; // 0x16d
field public static final int CODE_SIP_USER_REJECTED = 361; // 0x169 field public static final int CODE_SIP_USER_REJECTED = 361; // 0x169

View File

@@ -16,7 +16,6 @@
package android.telephony; package android.telephony;
import android.annotation.CallSuper;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.app.Service; import android.app.Service;
import android.content.Intent; import android.content.Intent;
@@ -53,7 +52,6 @@ public abstract class NetworkService extends Service {
private final String TAG = NetworkService.class.getSimpleName(); private final String TAG = NetworkService.class.getSimpleName();
public static final String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService"; public static final String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService";
public static final String NETWORK_SERVICE_EXTRA_SLOT_ID = "android.telephony.extra.SLOT_ID";
private static final int NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER = 1; private static final int NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER = 1;
private static final int NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER = 2; private static final int NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER = 2;
@@ -81,7 +79,7 @@ public abstract class NetworkService extends Service {
* must extend this class to support network connection. Note that each instance of network * must extend this class to support network connection. Note that each instance of network
* service is associated with one physical SIM slot. * service is associated with one physical SIM slot.
*/ */
public class NetworkServiceProvider { public abstract class NetworkServiceProvider implements AutoCloseable {
private final int mSlotId; private final int mSlotId;
private final List<INetworkServiceCallback> private final List<INetworkServiceCallback>
@@ -137,12 +135,12 @@ public abstract class NetworkService extends Service {
} }
/** /**
* Called when the instance of network service is destroyed (e.g. got unbind or binder died). * Called when the instance of network service is destroyed (e.g. got unbind or binder died)
* or when the network service provider is removed. The extended class should implement this
* method to perform cleanup works.
*/ */
@CallSuper @Override
protected void onDestroy() { public abstract void close();
mNetworkRegistrationStateChangedCallbacks.clear();
}
} }
private class NetworkServiceHandler extends Handler { private class NetworkServiceHandler extends Handler {
@@ -168,7 +166,7 @@ public abstract class NetworkService extends Service {
case NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER: case NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER:
// If the service provider doesn't exist yet, we try to create it. // If the service provider doesn't exist yet, we try to create it.
if (serviceProvider != null) { if (serviceProvider != null) {
serviceProvider.onDestroy(); serviceProvider.close();
mServiceMap.remove(slotId); mServiceMap.remove(slotId);
} }
break; break;
@@ -176,7 +174,7 @@ public abstract class NetworkService extends Service {
for (int i = 0; i < mServiceMap.size(); i++) { for (int i = 0; i < mServiceMap.size(); i++) {
serviceProvider = mServiceMap.get(i); serviceProvider = mServiceMap.get(i);
if (serviceProvider != null) { if (serviceProvider != null) {
serviceProvider.onDestroy(); serviceProvider.close();
} }
} }
mServiceMap.clear(); mServiceMap.clear();

View File

@@ -16,7 +16,6 @@
package android.telephony.data; package android.telephony.data;
import android.annotation.CallSuper;
import android.annotation.IntDef; import android.annotation.IntDef;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
@@ -60,7 +59,6 @@ public abstract class DataService extends Service {
private static final String TAG = DataService.class.getSimpleName(); private static final String TAG = DataService.class.getSimpleName();
public static final String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService"; public static final String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService";
public static final String DATA_SERVICE_EXTRA_SLOT_ID = "android.telephony.data.extra.SLOT_ID";
/** {@hide} */ /** {@hide} */
@IntDef(prefix = "REQUEST_REASON_", value = { @IntDef(prefix = "REQUEST_REASON_", value = {
@@ -116,7 +114,7 @@ public abstract class DataService extends Service {
* must extend this class to support data connection. Note that each instance of data service * must extend this class to support data connection. Note that each instance of data service
* provider is associated with one physical SIM slot. * provider is associated with one physical SIM slot.
*/ */
public class DataServiceProvider { public abstract class DataServiceProvider implements AutoCloseable {
private final int mSlotId; private final int mSlotId;
@@ -250,12 +248,12 @@ public abstract class DataService extends Service {
} }
/** /**
* Called when the instance of data service is destroyed (e.g. got unbind or binder died). * Called when the instance of data service is destroyed (e.g. got unbind or binder died)
* or when the data service provider is removed. The extended class should implement this
* method to perform cleanup works.
*/ */
@CallSuper @Override
protected void onDestroy() { public abstract void close();
mDataCallListChangedCallbacks.clear();
}
} }
private static final class SetupDataCallRequest { private static final class SetupDataCallRequest {
@@ -345,7 +343,7 @@ public abstract class DataService extends Service {
break; break;
case DATA_SERVICE_REMOVE_DATA_SERVICE_PROVIDER: case DATA_SERVICE_REMOVE_DATA_SERVICE_PROVIDER:
if (serviceProvider != null) { if (serviceProvider != null) {
serviceProvider.onDestroy(); serviceProvider.close();
mServiceMap.remove(slotId); mServiceMap.remove(slotId);
} }
break; break;
@@ -353,7 +351,7 @@ public abstract class DataService extends Service {
for (int i = 0; i < mServiceMap.size(); i++) { for (int i = 0; i < mServiceMap.size(); i++) {
serviceProvider = mServiceMap.get(i); serviceProvider = mServiceMap.get(i);
if (serviceProvider != null) { if (serviceProvider != null) {
serviceProvider.onDestroy(); serviceProvider.close();
} }
} }
mServiceMap.clear(); mServiceMap.clear();

View File

@@ -151,7 +151,7 @@ public abstract class QualifiedNetworksService extends Service {
/** /**
* Called when the qualified networks updater is removed. The extended class should * Called when the qualified networks updater is removed. The extended class should
* implement this method to perform clean up works. * implement this method to perform cleanup works.
*/ */
@Override @Override
public abstract void close(); public abstract void close();