[Wi-Fi] Prevent fatal exception for null intent action
Intent action may be null. Bug: 139020487 Test: WifiScanModeActivityTest WifiNoInternetDialogTest WifiDppConfiguratorActivityTest WifiDppEnrolleeActivityTest Change-Id: Ie6119a86aaee1a6b40710705a0ea7d92c24736d6
This commit is contained in:
@@ -55,9 +55,9 @@ public final class WifiNoInternetDialog extends AlertActivity implements
|
||||
private boolean mButtonClicked;
|
||||
|
||||
private boolean isKnownAction(Intent intent) {
|
||||
return intent.getAction().equals(ACTION_PROMPT_UNVALIDATED)
|
||||
|| intent.getAction().equals(ACTION_PROMPT_LOST_VALIDATION)
|
||||
|| intent.getAction().equals(ACTION_PROMPT_PARTIAL_CONNECTIVITY);
|
||||
return ACTION_PROMPT_UNVALIDATED.equals(intent.getAction())
|
||||
|| ACTION_PROMPT_LOST_VALIDATION.equals(intent.getAction())
|
||||
|| ACTION_PROMPT_PARTIAL_CONNECTIVITY.equals(intent.getAction());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -46,8 +46,8 @@ public class WifiScanModeActivity extends FragmentActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
Intent intent = getIntent();
|
||||
if (savedInstanceState == null) {
|
||||
if (intent != null && intent.getAction()
|
||||
.equals(WifiManager.ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE)) {
|
||||
if (intent != null && WifiManager.ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE
|
||||
.equals(intent.getAction())) {
|
||||
ApplicationInfo ai;
|
||||
mApp = getCallingPackage();
|
||||
try {
|
||||
|
@@ -109,9 +109,15 @@ public class WifiDppConfiguratorActivity extends WifiDppBaseActivity implements
|
||||
|
||||
@Override
|
||||
protected void handleIntent(Intent intent) {
|
||||
String action = intent != null ? intent.getAction() : null;
|
||||
if (action == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean cancelActivity = false;
|
||||
WifiNetworkConfig config;
|
||||
switch (intent.getAction()) {
|
||||
switch (action) {
|
||||
case ACTION_CONFIGURATOR_QR_CODE_SCANNER:
|
||||
config = WifiNetworkConfig.getValidConfigOrNull(intent);
|
||||
if (config == null) {
|
||||
|
@@ -44,7 +44,13 @@ public class WifiDppEnrolleeActivity extends WifiDppBaseActivity implements
|
||||
|
||||
@Override
|
||||
protected void handleIntent(Intent intent) {
|
||||
switch (intent.getAction()) {
|
||||
String action = intent != null ? intent.getAction() : null;
|
||||
if (action == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case ACTION_ENROLLEE_QR_CODE_SCANNER:
|
||||
String ssid = intent.getStringExtra(WifiDppUtils.EXTRA_WIFI_SSID);
|
||||
showQrCodeScannerFragment(ssid);
|
||||
|
Reference in New Issue
Block a user