Fix the error that the broadcast receiver cannot be registered

Factory reset of eSIM failed due to the euiccWipeFinishReceiver cannot
be registered by the context directly. This CL changes the context to
application context to solve this problem.

Bug: 63610700
Test: E2E
Change-Id: I7e4c8b75b5b5b4203efd7302677ffa5cf00198b5
This commit is contained in:
qingxi
2017-07-12 13:15:51 -07:00
parent e060ffd2ca
commit aee0ab9eb9

View File

@@ -808,7 +808,8 @@ public class RecoverySystem {
HandlerThread euiccHandlerThread = new HandlerThread("euiccWipeFinishReceiverThread");
euiccHandlerThread.start();
Handler euiccHandler = new Handler(euiccHandlerThread.getLooper());
context.registerReceiver(euiccWipeFinishReceiver, filterConsent, null, euiccHandler);
context.getApplicationContext()
.registerReceiver(euiccWipeFinishReceiver, filterConsent, null, euiccHandler);
if (isWipeEuicc) {
euiccManager.eraseSubscriptions(callbackIntent);
} else {
@@ -831,7 +832,7 @@ public class RecoverySystem {
Log.e(TAG, "Timeout retaining eUICC data.");
}
}
context.unregisterReceiver(euiccWipeFinishReceiver);
context.getApplicationContext().unregisterReceiver(euiccWipeFinishReceiver);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
if (isWipeEuicc) {