Protect against multiple provision responses
Bug: 23573004 Change-Id: I9cbc7574d2019244f7198784372ce68d7e4d1fa2
This commit is contained in:
@@ -69,7 +69,7 @@ public class TetherService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
if (DEBUG) Log.d(TAG, "Creating WifiProvisionService");
|
if (DEBUG) Log.d(TAG, "Creating TetherService");
|
||||||
String provisionResponse = getResources().getString(
|
String provisionResponse = getResources().getString(
|
||||||
com.android.internal.R.string.config_mobile_hotspot_provision_response);
|
com.android.internal.R.string.config_mobile_hotspot_provision_response);
|
||||||
registerReceiver(mReceiver, new IntentFilter(provisionResponse),
|
registerReceiver(mReceiver, new IntentFilter(provisionResponse),
|
||||||
@@ -137,7 +137,7 @@ public class TetherService extends Service {
|
|||||||
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
||||||
prefs.edit().putString(KEY_TETHERS, tethersToString(mCurrentTethers)).commit();
|
prefs.edit().putString(KEY_TETHERS, tethersToString(mCurrentTethers)).commit();
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "Destroying WifiProvisionService");
|
if (DEBUG) Log.d(TAG, "Destroying TetherService");
|
||||||
unregisterReceiver(mReceiver);
|
unregisterReceiver(mReceiver);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
@@ -262,6 +262,10 @@ public class TetherService extends Service {
|
|||||||
String provisionResponse = context.getResources().getString(
|
String provisionResponse = context.getResources().getString(
|
||||||
com.android.internal.R.string.config_mobile_hotspot_provision_response);
|
com.android.internal.R.string.config_mobile_hotspot_provision_response);
|
||||||
if (provisionResponse.equals(intent.getAction())) {
|
if (provisionResponse.equals(intent.getAction())) {
|
||||||
|
if (!mInProvisionCheck) {
|
||||||
|
Log.e(TAG, "Unexpected provision response " + intent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
mInProvisionCheck = false;
|
mInProvisionCheck = false;
|
||||||
int checkType = mCurrentTethers.get(mCurrentTypeIndex);
|
int checkType = mCurrentTethers.get(mCurrentTypeIndex);
|
||||||
if (intent.getIntExtra(EXTRA_RESULT, RESULT_DEFAULT) == RESULT_OK) {
|
if (intent.getIntExtra(EXTRA_RESULT, RESULT_DEFAULT) == RESULT_OK) {
|
||||||
|
Reference in New Issue
Block a user