Backed out 2 changesets (bug 1551614) for Android checkstyle failures. CLOSED TREE

Backed out changeset 390ec5bd9da7 (bug 1551614)
Backed out changeset ab1822f92ad7 (bug 1551614)
This commit is contained in:
Cosmin Sabou 2019-06-20 21:44:41 +03:00
Родитель a44dd8ef5a
Коммит 19d5f52e48
5 изменённых файлов: 60 добавлений и 29 удалений

Просмотреть файл

@ -265,6 +265,11 @@
</intent-filter>
</receiver>
<service android:name="org.mozilla.gecko.Restarter"
android:exported="false"
android:process="@MANGLED_ANDROID_PACKAGE_NAME@.Restarter">
</service>
<service android:name="org.mozilla.gecko.media.MediaControlService"
android:exported="false"
android:stopWithTask="true">

Просмотреть файл

@ -1022,13 +1022,7 @@ public abstract class GeckoApp extends GeckoActivity
// no need to touch that here.
if (BrowserLocaleManager.getInstance().systemLocaleDidChange()) {
Log.i(LOGTAG, "System locale changed. Restarting.");
mIsAbortingAppLaunch = true;
// Call finish() asap so that other classes would know BrowserApp isFinishing()
finishAndShutdown(/* restart */ true);
super.onCreate(savedInstanceState);
return;
}
@ -2125,12 +2119,6 @@ public abstract class GeckoApp extends GeckoActivity
// This build does not support the Android version of the device:
// We did not initialize anything, so skip cleaning up.
super.onDestroy();
if (mShutdownOnDestroy) {
GeckoApplication.shutdown(!mRestartOnShutdown ? null : new Intent(
Intent.ACTION_MAIN, /* uri */ null, getApplicationContext(), getClass()));
}
return;
}

Просмотреть файл

@ -153,14 +153,13 @@ public class GeckoApplication extends Application
return;
}
// Actually restarting the Processs / Application.
// Restarting, so let Restarter kill us.
final Context context = GeckoAppShell.getApplicationContext();
final Intent intent = new Intent()
.setClassName(context, AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS)
.putExtra("didRestart", true)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent);
Process.killProcess(Process.myPid());
final Intent intent = new Intent();
intent.setClass(context, Restarter.class)
.putExtra("pid", Process.myPid())
.putExtra(Intent.EXTRA_INTENT, restartIntent);
context.startService(intent);
}
/**

Просмотреть файл

@ -0,0 +1,49 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.Process;
import android.util.Log;
public class Restarter extends Service {
private static final String LOGTAG = "GeckoRestarter";
private void doRestart(Intent intent) {
final int oldProc = intent.getIntExtra("pid", -1);
if (oldProc < 0) {
return;
}
Process.killProcess(oldProc);
Log.d(LOGTAG, "Killed " + oldProc);
try {
Thread.sleep(100);
} catch (final InterruptedException e) {
}
final Intent restartIntent = (Intent)intent.getParcelableExtra(Intent.EXTRA_INTENT);
restartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra("didRestart", true)
.setPackage(getApplicationContext().getPackageName());
startActivity(restartIntent);
Log.d(LOGTAG, "Launched " + restartIntent);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
doRestart(intent);
stopSelf(startId);
return Service.START_NOT_STICKY;
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}

Просмотреть файл

@ -14,7 +14,6 @@ import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.UiThread;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v4.widget.SwipeRefreshLayout;
@ -113,15 +112,6 @@ public class CombinedHistoryPanel extends HomeFragment implements RemoteClientsD
public void onCreate(Bundle savedInstance) {
super.onCreate(savedInstance);
// BrowserApp's super.onCreate() as a FragmentActivity would dispatchCreate()
// for all fragments in it's savedInstanceState. This Fragment will be created.
// When BrowserApp does not complete it's onCreate() - like when finishing early and restarting
// our onCreate would try to access not yet initialized resources and would get a NPE.
final FragmentActivity parent = getActivity();
if (parent != null && parent.isFinishing()) {
return;
}
int cachedRecentTabsCount = 0;
if (mPanelStateChangeListener != null ) {
cachedRecentTabsCount = mPanelStateChangeListener.getCachedRecentTabsCount();