SetupWizard: Handle ActivityNotFoundException in LoadingFragment

Handle the possibly thrown ActivityNotFoundException.Changed the generic catch block into a specific catch block to handle ActivityNotFoundException.

Change-Id: Ica1106bab3e569aaa7883898ce6adb3a1a2dd99f
This commit is contained in:
Bharadwaj Narasimha 2016-07-01 13:40:54 -07:00
parent 20037b7ae9
commit 10a58d25fd

View File

@ -16,15 +16,19 @@
package com.cyanogenmod.setupwizard.ui; package com.cyanogenmod.setupwizard.ui;
import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import com.cyanogenmod.setupwizard.R; import com.cyanogenmod.setupwizard.R;
public class LoadingFragment extends SetupPageFragment { public class LoadingFragment extends SetupPageFragment {
private StartActivityForResultRunnable mStartActivityForResultRunnable; private StartActivityForResultRunnable mStartActivityForResultRunnable;
private static final String TAG = "LoadingFragment";
@Override @Override
public void startActivityForResult(Intent intent, int requestCode, Bundle options) { public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
if (isResumed()) { if (isResumed()) {
@ -74,8 +78,12 @@ public class LoadingFragment extends SetupPageFragment {
@Override @Override
public void run() { public void run() {
mLoadingFragment.startActivityForResult(mIntent, mRequestCode, mOptions); try {
mLoadingFragment.mStartActivityForResultRunnable = null; mLoadingFragment.startActivityForResult(mIntent, mRequestCode, mOptions);
}
catch(ActivityNotFoundException e) {
Log.e(TAG,"Activity not found to handle intent "+ mIntent.getDataString());
}
} }
} }
} }