DO NOT MERGE: Add a null check for the OnStartTetheringCallback.
This avoids a NullPointerException when trying to call the callback
and gives a more readable error message.
(cherry picked from commit 35e99ea8ef)
Change-Id: Ia419ff68ef10f308f9e44be47420e27099ee6070
This commit is contained in:
committed by
Lorenzo Colitti
parent
6b0570513e
commit
fb63d5a4ef
@@ -2079,6 +2079,8 @@ public class ConnectivityManager {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
public void startTethering(int type, boolean showProvisioningUi,
|
public void startTethering(int type, boolean showProvisioningUi,
|
||||||
final OnStartTetheringCallback callback, Handler handler) {
|
final OnStartTetheringCallback callback, Handler handler) {
|
||||||
|
checkNotNull(callback, "OnStartTetheringCallback cannot be null.");
|
||||||
|
|
||||||
ResultReceiver wrappedCallback = new ResultReceiver(handler) {
|
ResultReceiver wrappedCallback = new ResultReceiver(handler) {
|
||||||
@Override
|
@Override
|
||||||
protected void onReceiveResult(int resultCode, Bundle resultData) {
|
protected void onReceiveResult(int resultCode, Bundle resultData) {
|
||||||
@@ -2089,6 +2091,7 @@ public class ConnectivityManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mService.startTethering(type, wrappedCallback, showProvisioningUi);
|
mService.startTethering(type, wrappedCallback, showProvisioningUi);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user