Catch a resource not found exception

Test: not see a crash
Bug: 198296421
Change-Id: I469a726a32d7bb2f6f81fc0dae27d5b1d1ac0933
This commit is contained in:
Tsung-Mao Fang
2021-10-18 22:01:27 +08:00
parent 5a7966884b
commit 78267b2f2f

View File

@@ -29,6 +29,7 @@ import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.graphics.drawable.Icon;
import android.os.AsyncTask;
@@ -467,6 +468,9 @@ public class SettingsActivity extends SettingsBaseActivity
return;
} catch (NameNotFoundException e) {
Log.w(LOG_TAG, "Could not find package" + initialTitleResPackageName);
} catch (Resources.NotFoundException resourceNotFound) {
Log.w(LOG_TAG,
"Could not find title resource in " + initialTitleResPackageName);
}
} else {
setTitle(mInitialTitleResId);