mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 2 changesets (bug 815682, bug 897711) for Android S4 failures.
Backed out changeset 14f00ee7be7d (bug 897711) Backed out changeset 3de21c283716 (bug 815682)
This commit is contained in:
parent
fba2094643
commit
c09b4eaa3a
@ -149,11 +149,6 @@
|
||||
<action android:name="org.mozilla.gecko.ACTION_ALERT_CALLBACK" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="org.mozilla.gecko.GUEST_SESSION_INPROGRESS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Notification API V2 -->
|
||||
<intent-filter>
|
||||
<action android:name="@ANDROID_PACKAGE_NAME@.helperBroadcastAction" />
|
||||
|
@ -27,7 +27,6 @@ import org.mozilla.gecko.db.BrowserContract.Combined;
|
||||
import org.mozilla.gecko.db.BrowserContract.ReadingListItems;
|
||||
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.DBUtils;
|
||||
import org.mozilla.gecko.db.SuggestedSites;
|
||||
import org.mozilla.gecko.distribution.Distribution;
|
||||
import org.mozilla.gecko.favicons.Favicons;
|
||||
@ -79,7 +78,6 @@ import org.mozilla.gecko.widget.GeckoActionProvider;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@ -183,7 +181,7 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
|
||||
// The types of guest mdoe dialogs we show
|
||||
public static enum GuestModeDialog {
|
||||
private static enum GuestModeDialog {
|
||||
ENTERING,
|
||||
LEAVING
|
||||
}
|
||||
@ -498,17 +496,11 @@ public class BrowserApp extends GeckoApp
|
||||
mAboutHomeStartupTimer = new Telemetry.UptimeTimer("FENNEC_STARTUP_TIME_ABOUTHOME");
|
||||
|
||||
final Intent intent = getIntent();
|
||||
final String args = intent.getStringExtra("args");
|
||||
|
||||
if (GuestSession.shouldUse(this, args)) {
|
||||
GuestSession.configureWindow(getWindow());
|
||||
String args = intent.getStringExtra("args");
|
||||
if (args != null && args.contains(GUEST_BROWSING_ARG)) {
|
||||
mProfile = GeckoProfile.createGuestProfile(this);
|
||||
} else {
|
||||
// We also allow non-guest sessions if the keyguard isn't a secure one.
|
||||
final KeyguardManager manager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||
if (Versions.feature16Plus && !manager.isKeyguardSecure()) {
|
||||
GuestSession.configureWindow(getWindow());
|
||||
}
|
||||
GeckoProfile.maybeCleanupGuestProfile(this);
|
||||
}
|
||||
|
||||
@ -526,15 +518,11 @@ public class BrowserApp extends GeckoApp
|
||||
mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
|
||||
mProgressView = (ToolbarProgressView) findViewById(R.id.progress);
|
||||
mBrowserToolbar.setProgressBar(mProgressView);
|
||||
|
||||
final String action = intent.getAction();
|
||||
if (Intent.ACTION_VIEW.equals(action)) {
|
||||
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
|
||||
// Show the target URL immediately in the toolbar.
|
||||
mBrowserToolbar.setTitle(intent.getDataString());
|
||||
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT);
|
||||
} else if (GuestSession.NOTIFICATION_INTENT.equals(action)) {
|
||||
showGuestModeDialog(BrowserApp.GuestModeDialog.LEAVING);
|
||||
}
|
||||
|
||||
((GeckoApp.MainLayout) mMainLayout).setTouchEventInterceptor(new HideOnTouchListener());
|
||||
@ -650,13 +638,6 @@ public class BrowserApp extends GeckoApp
|
||||
Log.e(LOGTAG, "Error initializing media manager", ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (getProfile().inGuestMode()) {
|
||||
GuestSession.showNotification(this);
|
||||
} else {
|
||||
// If we're restarting, we won't destroy the activity. Make sure we remove any guest notifications that might have been shown.
|
||||
GuestSession.hideNotification(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void registerOnboardingReceiver(Context context) {
|
||||
@ -714,18 +695,6 @@ public class BrowserApp extends GeckoApp
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
final String args = getIntent().getStringExtra("args");
|
||||
// If an external intent tries to start Fennec in guest mode, and it's not already
|
||||
// in guest mode, this will change modes before opening the url.
|
||||
final boolean enableGuestSession = GuestSession.shouldUse(this, args);
|
||||
final boolean inGuestSession = GeckoProfile.get(this).inGuestMode();
|
||||
if (enableGuestSession != inGuestSession) {
|
||||
doRestart(getIntent());
|
||||
GeckoAppShell.systemExit();
|
||||
return;
|
||||
}
|
||||
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
|
||||
"Prompt:ShowTop");
|
||||
if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
|
||||
@ -1023,8 +992,6 @@ public class BrowserApp extends GeckoApp
|
||||
mBrowserHealthReporter = null;
|
||||
}
|
||||
|
||||
GuestSession.onDestroy(this);
|
||||
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
|
||||
"Menu:Update",
|
||||
"Reader:Added",
|
||||
@ -2663,11 +2630,10 @@ public class BrowserApp extends GeckoApp
|
||||
|
||||
charEncoding.setVisible(GeckoPreferences.getCharEncodingState());
|
||||
|
||||
if (mProfile.inGuestMode()) {
|
||||
if (mProfile.inGuestMode())
|
||||
exitGuestMode.setVisible(true);
|
||||
} else {
|
||||
else
|
||||
enterGuestMode.setVisible(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2819,7 +2785,7 @@ public class BrowserApp extends GeckoApp
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public void showGuestModeDialog(final GuestModeDialog type) {
|
||||
private void showGuestModeDialog(final GuestModeDialog type) {
|
||||
final Prompt ps = new Prompt(this, new Prompt.PromptCallback() {
|
||||
@Override
|
||||
public void onPromptFinished(String result) {
|
||||
@ -2832,14 +2798,7 @@ public class BrowserApp extends GeckoApp
|
||||
} else {
|
||||
GeckoProfile.leaveGuestSession(BrowserApp.this);
|
||||
}
|
||||
|
||||
if (!GuestSession.isSecureKeyguardLocked(BrowserApp.this)) {
|
||||
doRestart(args);
|
||||
} else {
|
||||
// If the secure keyguard is up, we don't want to restart.
|
||||
// Just clear the guest profile data.
|
||||
GeckoProfile.maybeCleanupGuestProfile(BrowserApp.this);
|
||||
}
|
||||
doRestart(args);
|
||||
GeckoAppShell.systemExit();
|
||||
}
|
||||
} catch(JSONException ex) {
|
||||
@ -2916,9 +2875,7 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
|
||||
// Only solicit feedback when the app has been launched from the icon shortcut.
|
||||
if (GuestSession.NOTIFICATION_INTENT.equals(action)) {
|
||||
showGuestModeDialog(BrowserApp.GuestModeDialog.LEAVING);
|
||||
} else if (!Intent.ACTION_MAIN.equals(action)) {
|
||||
if (!Intent.ACTION_MAIN.equals(action)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2163,32 +2163,21 @@ public abstract class GeckoApp
|
||||
}
|
||||
|
||||
public void doRestart() {
|
||||
doRestart(RESTARTER_ACTION, null, null);
|
||||
doRestart(RESTARTER_ACTION, null);
|
||||
}
|
||||
|
||||
public void doRestart(String args) {
|
||||
doRestart(RESTARTER_ACTION, args, null);
|
||||
doRestart(RESTARTER_ACTION, args);
|
||||
}
|
||||
|
||||
public void doRestart(Intent intent) {
|
||||
doRestart(RESTARTER_ACTION, null, intent);
|
||||
}
|
||||
|
||||
public void doRestart(String action, String args, Intent restartIntent) {
|
||||
public void doRestart(String action, String args) {
|
||||
Log.d(LOGTAG, "doRestart(\"" + action + "\")");
|
||||
try {
|
||||
Intent intent = new Intent(action);
|
||||
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, RESTARTER_CLASS);
|
||||
|
||||
/* TODO: addEnvToIntent(intent); */
|
||||
if (args != null) {
|
||||
if (args != null)
|
||||
intent.putExtra("args", args);
|
||||
}
|
||||
|
||||
if (restartIntent != null) {
|
||||
intent.putExtra(Intent.EXTRA_INTENT, restartIntent);
|
||||
}
|
||||
|
||||
intent.putExtra("didRestart", true);
|
||||
Log.d(LOGTAG, "Restart intent: " + intent.toString());
|
||||
GeckoAppShell.killAnyZombies();
|
||||
|
@ -90,9 +90,10 @@ public final class GeckoProfile {
|
||||
}
|
||||
}
|
||||
|
||||
// If the guest profile should be used return it.
|
||||
if (GuestSession.shouldUse(context, "")) {
|
||||
return GeckoProfile.getGuestProfile(context);
|
||||
// If the guest profile exists and is locked, return it
|
||||
GeckoProfile guest = GeckoProfile.getGuestProfile(context);
|
||||
if (guest != null && guest.locked()) {
|
||||
return guest;
|
||||
}
|
||||
|
||||
if (isGeckoApp) {
|
||||
@ -193,17 +194,12 @@ public final class GeckoProfile {
|
||||
|
||||
public static GeckoProfile createGuestProfile(Context context) {
|
||||
try {
|
||||
removeGuestProfile(context);
|
||||
// We need to force the creation of a new guest profile if we want it outside of the normal profile path,
|
||||
// otherwise GeckoProfile.getDir will try to be smart and build it for us in the normal profiles dir.
|
||||
getGuestDir(context).mkdir();
|
||||
GeckoProfile profile = getGuestProfile(context);
|
||||
|
||||
// If we're creating this guest session over the keyguard, don't lock it.
|
||||
// This will force the guest session to exit if the user unlocks their phone
|
||||
// and starts Fennec.
|
||||
if (!GuestSession.isSecureKeyguardLocked(context)) {
|
||||
profile.lock();
|
||||
}
|
||||
profile.lock();
|
||||
|
||||
/*
|
||||
* Now do the things that createProfileDirectory normally does --
|
||||
@ -232,7 +228,7 @@ public final class GeckoProfile {
|
||||
return sGuestDir;
|
||||
}
|
||||
|
||||
public static GeckoProfile getGuestProfile(Context context) {
|
||||
private static GeckoProfile getGuestProfile(Context context) {
|
||||
if (sGuestProfile == null) {
|
||||
File guestDir = getGuestDir(context);
|
||||
if (guestDir.exists()) {
|
||||
@ -246,11 +242,10 @@ public final class GeckoProfile {
|
||||
|
||||
public static boolean maybeCleanupGuestProfile(final Context context) {
|
||||
final GeckoProfile profile = getGuestProfile(context);
|
||||
|
||||
if (profile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!profile.locked()) {
|
||||
} else if (!profile.locked()) {
|
||||
profile.mInGuestMode = false;
|
||||
|
||||
// If the guest dir exists, but it's unlocked, delete it
|
||||
@ -335,17 +330,12 @@ public final class GeckoProfile {
|
||||
try {
|
||||
// If this dir doesn't exist getDir will create it for us
|
||||
final File lockFile = new File(getDir(), LOCK_FILE_NAME);
|
||||
final boolean result;
|
||||
lockFile.createNewFile();
|
||||
|
||||
if (lockFile.exists()) {
|
||||
final boolean result = lockFile.createNewFile();
|
||||
if (result) {
|
||||
mLocked = LockState.LOCKED;
|
||||
result = true;
|
||||
} else {
|
||||
mLocked = LockState.UNLOCKED;
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch(IOException ex) {
|
||||
Log.e(LOGTAG, "Error locking profile", ex);
|
||||
@ -367,11 +357,6 @@ public final class GeckoProfile {
|
||||
|
||||
try {
|
||||
final File lockFile = new File(profileDir, LOCK_FILE_NAME);
|
||||
if (!lockFile.exists()) {
|
||||
mLocked = LockState.UNLOCKED;
|
||||
return true;
|
||||
}
|
||||
|
||||
final boolean result = delete(lockFile);
|
||||
if (result) {
|
||||
mLocked = LockState.UNLOCKED;
|
||||
@ -382,7 +367,6 @@ public final class GeckoProfile {
|
||||
} catch(IOException ex) {
|
||||
Log.e(LOGTAG, "Error unlocking profile", ex);
|
||||
}
|
||||
|
||||
mLocked = LockState.LOCKED;
|
||||
return false;
|
||||
}
|
||||
|
@ -1,110 +0,0 @@
|
||||
/* -*- 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 org.mozilla.gecko.prompts.Prompt;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
import org.mozilla.gecko.util.NativeEventListener;
|
||||
import org.mozilla.gecko.util.NativeJSObject;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ListView;
|
||||
|
||||
// Utility methods for entering/exiting guest mode.
|
||||
public final class GuestSession {
|
||||
private static final String LOGTAG = "GeckoGuestSession";
|
||||
public static final String NOTIFICATION_INTENT = "org.mozilla.gecko.GUEST_SESSION_INPROGRESS";
|
||||
private static final int NOTIFICATION_ID = LOGTAG.hashCode();
|
||||
|
||||
// Returns true if the user is using a secure keyguard, and its currently locked.
|
||||
static boolean isSecureKeyguardLocked(Context context) {
|
||||
final KeyguardManager manager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
|
||||
|
||||
if (AppConstants.Versions.preJB) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return manager.isKeyguardLocked() && manager.isKeyguardSecure();
|
||||
}
|
||||
|
||||
/* Returns true if you should be in guest mode. This can be because a secure keyguard
|
||||
* is locked, or because the user has explicitly started guest mode via a dialog. If the
|
||||
* user has explicitly started Fennec in guest mode, this will return true until they
|
||||
* explicitly exit it.
|
||||
*/
|
||||
public static boolean shouldUse(final Context context, final String args) {
|
||||
// Did the command line args request guest mode?
|
||||
if (args != null && args.contains(BrowserApp.GUEST_BROWSING_ARG)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, is the device locked?
|
||||
final boolean keyguard = isSecureKeyguardLocked(context);
|
||||
if (keyguard) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, is there a locked guest mode profile?
|
||||
final GeckoProfile profile = GeckoProfile.getGuestProfile(context);
|
||||
if (profile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return profile.locked();
|
||||
}
|
||||
|
||||
private static PendingIntent getNotificationIntent(Context context) {
|
||||
Intent intent = new Intent(NOTIFICATION_INTENT);
|
||||
return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
public static void showNotification(Context context) {
|
||||
final NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
|
||||
final Resources res = context.getResources();
|
||||
builder.setContentTitle(res.getString(R.string.guest_browsing_notification_title))
|
||||
.setContentText(res.getString(R.string.guest_browsing_notification_text))
|
||||
.setSmallIcon(R.drawable.alert_guest)
|
||||
.setOngoing(true)
|
||||
.setContentIntent(getNotificationIntent(context));
|
||||
|
||||
final NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
manager.notify(NOTIFICATION_ID, builder.build());
|
||||
}
|
||||
|
||||
public static void hideNotification(Context context) {
|
||||
final NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
manager.cancel(NOTIFICATION_ID);
|
||||
}
|
||||
|
||||
public static void onDestroy(Context context) {
|
||||
if (GeckoProfile.get(context).inGuestMode()) {
|
||||
hideNotification(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static void configureWindow(Window window) {
|
||||
// In guest sessions we allow showing over the keyguard.
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
|
||||
}
|
||||
}
|
@ -39,33 +39,19 @@ public class Restarter extends Activity {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.i(LOGTAG, "Error killing gecko", e);
|
||||
Log.i(LOGTAG, e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
final Intent originalIntent = getIntent();
|
||||
Intent intent = null;
|
||||
if (originalIntent.hasExtra(Intent.EXTRA_INTENT)) {
|
||||
intent = (Intent) originalIntent.getParcelableExtra(Intent.EXTRA_INTENT);
|
||||
originalIntent.removeExtra(Intent.EXTRA_INTENT);
|
||||
}
|
||||
|
||||
if (intent == null) {
|
||||
intent = new Intent(Intent.ACTION_MAIN);
|
||||
}
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
|
||||
AppConstants.BROWSER_INTENT_CLASS_NAME);
|
||||
|
||||
Bundle b = originalIntent.getExtras();
|
||||
if (b != null) {
|
||||
Bundle b = getIntent().getExtras();
|
||||
if (b != null)
|
||||
intent.putExtras(b);
|
||||
}
|
||||
|
||||
Log.i(LOGTAG, intent.toString());
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.i(LOGTAG, "Error restarting", e);
|
||||
Log.i(LOGTAG, e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -489,8 +489,6 @@ just addresses the organization to follow, e.g. "This site is run by " -->
|
||||
<!ENTITY guest_session_dialog_cancel "Cancel">
|
||||
<!ENTITY new_guest_session_title "&brandShortName; will now restart">
|
||||
<!ENTITY new_guest_session_text "The person using it will not be able to see any of your personal browsing data (like saved passwords, history or bookmarks).\n\nWhen your guest is done, their browsing data will be deleted and your session will be restored.">
|
||||
<!ENTITY guest_browsing_notification_title "Guest browsing is enabled">
|
||||
<!ENTITY guest_browsing_notification_text "Tap to exit">
|
||||
|
||||
<!ENTITY exit_guest_session_title "&brandShortName; will now restart">
|
||||
<!ENTITY exit_guest_session_text "The browsing data from this session will be deleted.">
|
||||
|
@ -251,7 +251,6 @@ gbjar.sources += [
|
||||
'gfx/ViewTransform.java',
|
||||
'gfx/VirtualLayer.java',
|
||||
'GlobalHistory.java',
|
||||
'GuestSession.java',
|
||||
'health/BrowserHealthRecorder.java',
|
||||
'health/BrowserHealthReporter.java',
|
||||
'health/HealthRecorder.java',
|
||||
|
@ -24,7 +24,6 @@ import org.mozilla.gecko.GeckoApplication;
|
||||
import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.GuestSession;
|
||||
import org.mozilla.gecko.LocaleManager;
|
||||
import org.mozilla.gecko.PrefsHelper;
|
||||
import org.mozilla.gecko.R;
|
||||
@ -289,10 +288,6 @@ OnSharedPreferenceChangeListener
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (GeckoProfile.get(this).inGuestMode()) {
|
||||
GuestSession.configureWindow(getWindow());
|
||||
}
|
||||
|
||||
// Apply the current user-selected locale, if necessary.
|
||||
checkLocale();
|
||||
|
||||
|
@ -11,7 +11,6 @@ import org.json.JSONObject;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.Tab;
|
||||
import org.mozilla.gecko.Tabs;
|
||||
@ -163,10 +162,7 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis
|
||||
|
||||
private void create(String title, String text, PromptListItem[] listItems, int choiceMode)
|
||||
throws IllegalStateException {
|
||||
final LayerView view = GeckoAppShell.getLayerView();
|
||||
if (view != null) {
|
||||
view.abortPanning();
|
||||
}
|
||||
GeckoAppShell.getLayerView().abortPanning();
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 782 B |
Binary file not shown.
Before Width: | Height: | Size: 669 B |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 891 B |
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
<resources>
|
||||
|
||||
<item type="id" name="guestNotification"/>
|
||||
|
||||
</resources>
|
@ -447,8 +447,6 @@
|
||||
<string name="guest_session_dialog_cancel">&guest_session_dialog_cancel;</string>
|
||||
<string name="new_guest_session_title">&new_guest_session_title;</string>
|
||||
<string name="new_guest_session_text">&new_guest_session_text;</string>
|
||||
<string name="guest_browsing_notification_title">&guest_browsing_notification_title;</string>
|
||||
<string name="guest_browsing_notification_text">&guest_browsing_notification_text;</string>
|
||||
|
||||
<string name="exit_guest_session_title">&exit_guest_session_title;</string>
|
||||
<string name="exit_guest_session_text">&exit_guest_session_text;</string>
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
package org.mozilla.search;
|
||||
|
||||
import org.mozilla.gecko.AboutPages;
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
@ -14,7 +13,6 @@ import android.annotation.SuppressLint;
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@ -65,6 +63,7 @@ public class SearchWidget extends AppWidgetProvider {
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
// This will hold the intent to redispatch
|
||||
final Intent redirect;
|
||||
Log.i(LOGTAG, "Got intent " + intent.getAction());
|
||||
if (intent.getAction().equals(ACTION_LAUNCH_BROWSER)) {
|
||||
redirect = buildRedirectIntent(Intent.ACTION_MAIN,
|
||||
AppConstants.ANDROID_PACKAGE_NAME,
|
||||
@ -106,17 +105,9 @@ public class SearchWidget extends AppWidgetProvider {
|
||||
|
||||
// Utility to create the view for this widget and attach any event listeners to it
|
||||
private void addView(final AppWidgetManager manager, final Context context, final int id, final Bundle options) {
|
||||
final int category = options.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, -1);
|
||||
final boolean isKeyguard = category == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD;
|
||||
|
||||
final RemoteViews views;
|
||||
if (isKeyguard) {
|
||||
views = new RemoteViews(context.getPackageName(), R.layout.keyguard_widget);
|
||||
} else {
|
||||
views = new RemoteViews(context.getPackageName(), R.layout.search_widget);
|
||||
addClickIntent(context, views, R.id.search_button, ACTION_LAUNCH_SEARCH);
|
||||
}
|
||||
final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.search_widget);
|
||||
|
||||
addClickIntent(context, views, R.id.search_button, ACTION_LAUNCH_SEARCH);
|
||||
addClickIntent(context, views, R.id.new_tab_button, ACTION_LAUNCH_NEW_TAB);
|
||||
// Clicking the logo also launches the browser
|
||||
addClickIntent(context, views, R.id.logo_button, ACTION_LAUNCH_BROWSER);
|
||||
@ -128,7 +119,7 @@ public class SearchWidget extends AppWidgetProvider {
|
||||
private void addClickIntent(final Context context, final RemoteViews views, final int viewId, final String action) {
|
||||
final Intent intent = new Intent(context, SearchWidget.class);
|
||||
intent.setAction(action);
|
||||
intent.setData(Uri.parse(AboutPages.HOME));
|
||||
intent.setData(Uri.parse("about:home"));
|
||||
final PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
|
||||
views.setOnClickPendingIntent(viewId, pendingIntent);
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/widget_header_height"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/widget_bg">
|
||||
|
||||
<ImageView android:id="@+id/logo_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="@dimen/widget_padding"
|
||||
android:background="@drawable/widget_button_left"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/widget_icon"/>
|
||||
|
||||
<LinearLayout android:id="@+id/new_tab_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@string/new_tab"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/widget_button_right">
|
||||
|
||||
<TextView android:id="@+id/new_tab_button_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_widget_new_tab"
|
||||
android:drawablePadding="@dimen/widget_padding"
|
||||
android:gravity="center"
|
||||
android:text="@string/new_tab"
|
||||
android:fontFamily="sans-serif"
|
||||
android:textSize="@dimen/widget_text_size"
|
||||
android:textColor="@color/widget_text_color"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -7,7 +7,6 @@
|
||||
android:minWidth="300dp"
|
||||
android:minHeight="40dp"
|
||||
android:label="@string/search_widget_name"
|
||||
android:widgetCategory="home_screen|keyguard"
|
||||
android:widgetCategory="home_screen"
|
||||
android:previewImage="@drawable/launcher_widget"
|
||||
android:initialLayout="@layout/search_widget"
|
||||
android:initialKeyguardLayout="@layout/keyguard_widget"/>
|
||||
android:initialLayout="@layout/search_widget"/>
|
||||
|
Loading…
Reference in New Issue
Block a user