Make TetherSettings use the new tether api.
The new API handles all the provisioning logic so this area can get significant code cleanup. Change-Id: I4bcffb14b3ce26a01d17ec149599d63b0b4392f1
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
@@ -44,9 +45,6 @@ public class TetherProvisioningActivity extends Activity {
|
||||
mResultReceiver = (ResultReceiver)getIntent().getParcelableExtra(
|
||||
ConnectivityManager.EXTRA_PROVISION_CALLBACK);
|
||||
|
||||
// TODO: Move isProvisioningNeededButUnavailable into ConnectivityManager and check
|
||||
// it here to short-circuit and fail.
|
||||
|
||||
int tetherType = getIntent().getIntExtra(ConnectivityManager.EXTRA_ADD_TETHER_TYPE,
|
||||
ConnectivityManager.TETHERING_INVALID);
|
||||
String[] provisionApp = getResources().getStringArray(
|
||||
@@ -58,6 +56,15 @@ public class TetherProvisioningActivity extends Activity {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Starting provisioning app: " + provisionApp[0] + "." + provisionApp[1]);
|
||||
}
|
||||
|
||||
if (getPackageManager().queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
|
||||
Log.e(TAG, "Provisioning app is configured, but not available.");
|
||||
mResultReceiver.send(ConnectivityManager.TETHER_ERROR_PROVISION_FAILED, null);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
startActivityForResultAsUser(intent, PROVISION_REQUEST, UserHandle.CURRENT);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user