Commit 3b0d9476 authored by Peter Wen's avatar Peter Wen Committed by Commit Bot

Android: Remove InvalidStartupDialog

Follow-up for: https://crrev.com/c/1825572

Now that ProcessInitExceptions are no longer checked. Simply raising it
is sufficient to prioritize startup errors via PureJavaExceptionHandler.

Bug: 1000651
Change-Id: Ia93973e12699bca752a37ce6d2d76d1ebe3b5782
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849270
Commit-Queue: Peter Wen <wnwen@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704316}
parent 3325b80e
......@@ -831,7 +831,6 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java",
"java/src/org/chromium/chrome/browser/init/EmptyBrowserParts.java",
"java/src/org/chromium/chrome/browser/init/FirstDrawDetector.java",
"java/src/org/chromium/chrome/browser/init/InvalidStartupDialog.java",
"java/src/org/chromium/chrome/browser/init/NativeInitializationController.java",
"java/src/org/chromium/chrome/browser/init/NativeStartupBridge.java",
"java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java",
......
......@@ -79,7 +79,6 @@ def _CheckAlertDialogBuilder(input_api, output_api):
# general, preference and FRE related UIs are not relevant to VR mode.
blacklist = (
BROWSER_ROOT + 'browserservices/ClearDataDialogActivity.java',
BROWSER_ROOT + 'init/InvalidStartupDialog.java',
BROWSER_ROOT + 'password_manager/AccountChooserDialog.java',
BROWSER_ROOT + 'password_manager/AutoSigninFirstRunDialog.java',
BROWSER_ROOT + r'preferences[\\\/].*',
......
......@@ -4,7 +4,6 @@
package org.chromium.chrome.browser;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
......@@ -13,7 +12,6 @@ import android.os.Bundle;
import androidx.annotation.Nullable;
import org.chromium.base.ActivityState;
import org.chromium.base.ApplicationState;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.BuildConfig;
......@@ -25,7 +23,6 @@ import org.chromium.base.Log;
import org.chromium.base.PathUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.annotations.MainDex;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.base.memory.MemoryPressureMonitor;
import org.chromium.base.multidex.ChromiumMultiDexInstaller;
import org.chromium.base.task.AsyncTask;
......@@ -42,7 +39,6 @@ import org.chromium.chrome.browser.dependency_injection.ChromeAppComponent;
import org.chromium.chrome.browser.dependency_injection.ChromeAppModule;
import org.chromium.chrome.browser.dependency_injection.DaggerChromeAppComponent;
import org.chromium.chrome.browser.dependency_injection.ModuleFactoryOverrides;
import org.chromium.chrome.browser.init.InvalidStartupDialog;
import org.chromium.chrome.browser.metrics.UmaUtils;
import org.chromium.chrome.browser.night_mode.SystemNightModeMonitor;
import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
......@@ -202,18 +198,6 @@ public class ChromeApplication extends Application {
|| level >= TRIM_MEMORY_MODERATE;
}
/**
* Shows an error dialog following a startup error, and then exits the application.
* @param e The exception reported by Chrome initialization.
*/
public static void reportStartupErrorAndExit(final ProcessInitException e) {
Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
if (ApplicationStatus.getStateForActivity(activity) == ActivityState.DESTROYED) {
return;
}
InvalidStartupDialog.show(activity, e.getErrorCode());
}
@Override
public void startActivity(Intent intent) {
startActivity(intent, null);
......
......@@ -33,7 +33,6 @@ import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.LoaderErrors;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeApplication;
import org.chromium.chrome.browser.ChromeBaseAppCompatActivity;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.LaunchIntentDispatcher;
......@@ -249,9 +248,7 @@ public abstract class AsyncInitializationActivity extends ChromeBaseAppCompatAct
@CallSuper
@Override
public void onStartupFailure() {
ProcessInitException e =
new ProcessInitException(LoaderErrors.LOADER_ERROR_NATIVE_STARTUP_FAILED);
ChromeApplication.reportStartupErrorAndExit(e);
throw new ProcessInitException(LoaderErrors.LOADER_ERROR_NATIVE_STARTUP_FAILED);
}
/**
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.init;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import org.chromium.base.library_loader.LoaderErrors;
import org.chromium.chrome.R;
/**
* Dialog shown when startup fails.
* <br>
* Fragments are required to be public with a public empty constructor, hence the visibility.
*/
public class InvalidStartupDialog extends DialogFragment {
private static final String TAG = "InvalidStartupDialog";
private static final String MESSAGE_KEY = "InvalidStartupErrorKey";
/**
* Shows the invalid startup dialog for a given error code.
*
* @param activity The activity showing the dialog.
* @param errorCode The error code that triggered the failure.
*/
public static void show(Activity activity, int errorCode) {
int msg;
switch (errorCode) {
case LoaderErrors.LOADER_ERROR_NATIVE_LIBRARY_LOAD_FAILED:
msg = R.string.os_version_missing_features;
break;
case LoaderErrors.LOADER_ERROR_NATIVE_LIBRARY_WRONG_VERSION:
msg = R.string.incompatible_libraries;
break;
default:
msg = R.string.native_startup_failed;
}
final String message = activity.getResources().getString(msg);
if (!(activity instanceof FragmentActivity)) {
Log.e(TAG, "Unable to start chrome due to: " + msg);
System.exit(-1);
return;
}
Bundle dialogArgs = new Bundle();
dialogArgs.putString(MESSAGE_KEY, message);
InvalidStartupDialog dialog = new InvalidStartupDialog();
dialog.setArguments(dialogArgs);
dialog.show(((FragmentActivity) activity).getSupportFragmentManager(),
"InvalidStartupDialog");
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle arguments = getArguments();
String message = arguments.getString(MESSAGE_KEY, "Failed to start");
AlertDialog.Builder builder =
new AlertDialog.Builder(getActivity(), R.style.Theme_Chromium_AlertDialog);
builder.setMessage(message)
.setCancelable(true)
.setPositiveButton(getResources().getString(android.R.string.ok), null);
return builder.create();
}
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
System.exit(-1);
}
}
\ No newline at end of file
......@@ -2577,17 +2577,6 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p
YY
</message>
<!-- Startup errors -->
<message name="IDS_OS_VERSION_MISSING_FEATURES" desc="Error message shown when Chrome fails to run due to an incomplete version of Android.">
Critical functionality required to run Chrome is missing; either your Chrome installation is incomplete, or not compatible with this version of Android.
</message>
<message name="IDS_INCOMPATIBLE_LIBRARIES" desc="Error message shown when Chrome fails to start due to having the wrong version of the native library">
Chrome’s components are incompatible with one another. Chrome may be upgrading, please try again in a few minutes. If the problem continues, try uninstalling and re-installing Chrome.
</message>
<message name="IDS_NATIVE_STARTUP_FAILED" desc="Error message shown when Chrome fails to start for other (unknown) reasons">
Chrome failed during startup with an unexpected error.
</message>
<!-- First Run strings -->
<message name="IDS_FRE_ACTIVITY_LABEL" desc="Label for first run dialog in Android Recents.">
Chrome First Run Experience
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment