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 commit35e99ea8ef) (cherry picked from commitfb63d5a4ef) Change-Id: Ia5f328c4b25aa6624dc3c8493eb0c7bbab99904c
This commit is contained in:
committed by
Lorenzo Colitti
parent
a814243e87
commit
d707b3716b
@@ -2093,6 +2093,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) {
|
||||||
@@ -2103,6 +2105,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