merge fx-team to mozilla-central

This commit is contained in:
Carsten "Tomcat" Book 2013-10-11 11:13:15 +02:00
commit 2ceefd3151
14 changed files with 133 additions and 75 deletions

View File

@ -313,12 +313,6 @@ FENNEC_PP_JAVA_FILES := \
WebApps.java \
$(NULL)
FENNEC_PP_XML_FILES = \
res/xml/preferences.xml \
res/xml/preferences_customize.xml \
res/xml/searchable.xml \
$(NULL)
ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
MIN_CPU_VERSION=7
else
@ -358,6 +352,8 @@ DEFINES += \
-DCPU_ARCH=$(CPU_ARCH) \
-DGRE_MILESTONE=$(GRE_MILESTONE) \
-DMOZILLA_OFFICIAL=$(MOZILLA_OFFICIAL) \
-DMOZ_ANDROID_SHARED_ID="$(MOZ_ANDROID_SHARED_ID)" \
-DMOZ_ANDROID_SHARED_ACCOUNT_TYPE="$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE)" \
-DMOZ_APP_ABI=$(TARGET_XPCOM_ABI) \
-DMOZ_APP_BASENAME=$(MOZ_APP_BASENAME) \
-DMOZ_APP_BUILDID=$(MOZ_APP_BUILDID) \
@ -394,8 +390,6 @@ GARBAGE += \
gecko.ap_ \
res/values/strings.xml \
R.java \
$(FENNEC_PP_XML_FILES) \
$(SYNC_PP_RES_XML) \
package-name.txt \
fennec_ids.txt \
Manifest.java \
@ -407,43 +401,17 @@ GARBAGE += \
GARBAGE_DIRS += classes db jars res sync services
MOZ_ANDROID_SHARED_ID = "$(ANDROID_PACKAGE_NAME).sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "$(ANDROID_PACKAGE_NAME)_sync"
# Bug 567884 - Need a way to find appropriate icons during packaging
ifeq ($(MOZ_APP_NAME),fennec)
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
ICON_PATH_XHDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_96x96.png
ICON_PATH_XXHDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_144x144.png
# we released these builds to the public with shared IDs and need to keep them
ifeq (org.mozilla.firefox,$(ANDROID_PACKAGE_NAME))
MOZ_ANDROID_SHARED_ID = "org.mozilla.firefox.sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.firefox_sync"
else ifeq (org.mozilla.firefox_beta,$(ANDROID_PACKAGE_NAME))
MOZ_ANDROID_SHARED_ID = "org.mozilla.firefox.sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.firefox_sync"
else ifeq (org.mozilla.fennec_aurora,$(ANDROID_PACKAGE_NAME))
MOZ_ANDROID_SHARED_ID = "org.mozilla.fennec.sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.fennec_sync"
else ifeq (org.mozilla.fennec,$(ANDROID_PACKAGE_NAME))
MOZ_ANDROID_SHARED_ID = "org.mozilla.fennec.sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.fennec_sync"
endif
else
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
endif
ifdef MOZ_ANDROID_SHARED_ID
DEFINES += -DMOZ_ANDROID_SHARED_ID="$(MOZ_ANDROID_SHARED_ID)"
endif
ifdef MOZ_ANDROID_SHARED_ACCOUNT_TYPE
DEFINES += -DMOZ_ANDROID_SHARED_ACCOUNT_TYPE="$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE)"
endif
RES_LAYOUT = \
$(SYNC_RES_LAYOUT) \
res/layout/arrow_popup.xml \
@ -598,11 +566,14 @@ RES_VALUES_V16 = \
$(NULL)
RES_XML = \
res/xml/preferences.xml \
res/xml/preferences_customize.xml \
res/xml/preferences_display.xml \
res/xml/preferences_search.xml \
res/xml/preferences_privacy.xml \
res/xml/preferences_vendor.xml \
res/xml/preferences_devtools.xml \
res/xml/searchable.xml \
$(SYNC_RES_XML) \
$(NULL)
@ -1333,16 +1304,6 @@ GeneratedJNIWrappers.cpp: $(ANNOTATION_PROCESSOR_JAR_FILES)
GeneratedJNIWrappers.cpp: $(ALL_JARS)
$(JAVA) -classpath $(JAVA_BOOTCLASSPATH):$(ANNOTATION_PROCESSOR_JAR_FILES) org.mozilla.gecko.annotationProcessors.AnnotationProcessor $(ALL_JARS)
PP_RES_XML= \
$(SYNC_PP_RES_XML) \
$(FENNEC_PP_XML_FILES) \
$(NULL)
# This is kinda awful; if any of the source files change, we remake them all.
$(PP_RES_XML): $(patsubst res/%,$(srcdir)/resources/%.in,$(PP_RES_XML))
$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $(subst res/,$(srcdir)/resources/,$@).in > $@
# AndroidManifest.xml includes these files, so they need to be marked as dependencies.
SERVICES_MANIFEST_FRAGMENTS = $(wildcard $(topsrcdir)/mobile/android/services/manifests/*.in)
@ -1407,7 +1368,6 @@ all_resources = \
$(MULTILOCALE_STRINGS_XML_FILES) \
AndroidManifest.xml \
$(RESOURCES) \
$(PP_RES_XML) \
$(NULL)
R.java: $(all_resources)

View File

@ -343,12 +343,9 @@ SYNC_RES_VALUES_LARGE_V11 := \
$(NULL)
SYNC_RES_XML := \
$(NULL)
SYNC_PP_RES_XML := \
res/xml/sync_authenticator.xml \
res/xml/sync_syncadapter.xml \
res/xml/sync_options.xml \
res/xml/sync_authenticator.xml \
$(NULL)
SYNC_THIRDPARTY_JAVA_FILES := \

View File

@ -216,8 +216,10 @@ public class BrowserSearch extends HomeFragment
unregisterEventListener("SearchEngines:Data");
mView = null;
mList.setAdapter(null);
mList = null;
mView = null;
mSuggestionsOptInPrompt = null;
mSuggestClient = null;
}

View File

@ -59,15 +59,19 @@ strings-xml-preqs =\
$(if $(IS_LANGUAGE_REPACK),FORCE) \
$(NULL)
$(if $(MOZ_ANDROID_SHARED_ACCOUNT_TYPE),,$(error Missing MOZ_ANDROID_SHARED_ACCOUNT_TYPE))
$(dir-strings-xml)/strings.xml: $(strings-xml-preqs)
$(NSINSTALL) -D $(dir-strings-xml)
$(TOUCH) $(call mkdir_deps,$(dir-strings-xml))
$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
$(DEFINES) \
-DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \
-DBOOKMARKSPATH="$(BOOKMARKSPATH)" \
-DBRANDPATH="$(BRANDPATH)" \
-DMOZ_ANDROID_SHARED_ACCOUNT_TYPE=$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE) \
-DMOZ_APP_DISPLAYNAME="@MOZ_APP_DISPLAYNAME@" \
-DSTRINGSPATH="$(STRINGSPATH)" \
-DSYNCSTRINGSPATH="$(SYNCSTRINGSPATH)" \
-DBOOKMARKSPATH="$(BOOKMARKSPATH)" \
-DMOZ_APP_DISPLAYNAME="@MOZ_APP_DISPLAYNAME@" \
$< \
> $@

View File

@ -1,4 +1,3 @@
#filter substitution
<?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
@ -18,7 +17,7 @@
<PreferenceScreen android:title="@string/pref_category_customize" >
<intent android:action="android.intent.action.VIEW"
android:targetPackage="@ANDROID_PACKAGE_NAME@"
android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.GeckoPreferences" >
<extra
android:name="resource"
@ -28,7 +27,7 @@
<PreferenceScreen android:title="@string/pref_category_display" >
<intent android:action="android.intent.action.VIEW"
android:targetPackage="@ANDROID_PACKAGE_NAME@"
android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.GeckoPreferences" >
<extra
android:name="resource"
@ -38,7 +37,7 @@
<PreferenceScreen android:title="@string/pref_category_privacy_short" >
<intent android:action="android.intent.action.VIEW"
android:targetPackage="@ANDROID_PACKAGE_NAME@"
android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.GeckoPreferences" >
<extra
android:name="resource"
@ -48,7 +47,7 @@
<PreferenceScreen android:title="@string/pref_category_vendor">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="@ANDROID_PACKAGE_NAME@"
android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.GeckoPreferences" >
<extra
android:name="resource"
@ -57,7 +56,7 @@
</PreferenceScreen>
<PreferenceScreen android:title="@string/pref_category_devtools">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="@ANDROID_PACKAGE_NAME@"
android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.GeckoPreferences" >
<extra
android:name="resource"

View File

@ -1,4 +1,3 @@
#filter substitution
<?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
@ -9,7 +8,7 @@
android:enabled="false">
<PreferenceScreen android:title="@string/pref_category_search" >
<intent android:action="android.intent.action.VIEW"
android:targetPackage="@ANDROID_PACKAGE_NAME@"
android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.GeckoPreferences" >
<extra
android:name="resource"

View File

@ -1,8 +1,7 @@
#filter substitution
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/moz_app_displayname"
android:searchSuggestAuthority="@ANDROID_PACKAGE_NAME@.db.browser"
android:searchSuggestAuthority="@string/content_authority_db_browser"
android:searchSuggestIntentAction="android.intent.action.SEARCH"
android:searchSettingsDescription="@string/searchable_description"
android:includeInGlobalSearch="true"/>

View File

@ -1,11 +1,10 @@
#filter substitution
<?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/. -->
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@"
android:accountType="@string/moz_android_shared_account_type"
android:icon="@drawable/icon"
android:smallIcon="@drawable/icon"
android:label="@string/sync_account_label"

View File

@ -1,4 +1,3 @@
#filter substitution
<?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
@ -13,7 +12,7 @@
android:summary="@string/sync_settings_summary_pair">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="@ANDROID_PACKAGE_NAME@"
android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.sync.setup.activities.SetupSyncActivity">
<extra
android:name="isSetup"
@ -25,7 +24,7 @@
android:title="@string/sync_configure_engines_title">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="@ANDROID_PACKAGE_NAME@"
android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.sync.config.activities.SelectEnginesActivity">
</intent>
</PreferenceScreen>

View File

@ -1,12 +1,11 @@
#filter substitution
<?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/. -->
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="@ANDROID_PACKAGE_NAME@.db.browser"
android:accountType="@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@"
android:contentAuthority="@string/content_authority_db_browser"
android:accountType="@string/moz_android_shared_account_type"
android:supportsUploading="true"
android:userVisible="true"
/>

View File

@ -19,6 +19,9 @@
#includesubst @BOOKMARKSPATH@
<resources>
<string name="moz_app_displayname">@MOZ_APP_DISPLAYNAME@</string>
<string name="android_package_name">@ANDROID_PACKAGE_NAME@</string>
<string name="content_authority_db_browser">@ANDROID_PACKAGE_NAME@.db.browser</string>
<string name="moz_android_shared_account_type">@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@</string>
#include ../services/strings.xml.in
<string name="no_space_to_start_error">&no_space_to_start_error;</string>
<string name="error_loading_file">&error_loading_file;</string>

18
mobile/android/defs.mk Normal file
View File

@ -0,0 +1,18 @@
MOZ_ANDROID_SHARED_ID = "$(ANDROID_PACKAGE_NAME).sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "$(ANDROID_PACKAGE_NAME)_sync"
# We released these builds to the public with shared IDs and need to
# keep them consistent.
ifeq (org.mozilla.firefox,$(ANDROID_PACKAGE_NAME))
MOZ_ANDROID_SHARED_ID = "org.mozilla.firefox.sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.firefox_sync"
else ifeq (org.mozilla.firefox_beta,$(ANDROID_PACKAGE_NAME))
MOZ_ANDROID_SHARED_ID = "org.mozilla.firefox.sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.firefox_sync"
else ifeq (org.mozilla.fennec_aurora,$(ANDROID_PACKAGE_NAME))
MOZ_ANDROID_SHARED_ID = "org.mozilla.fennec.sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.fennec_sync"
else ifeq (org.mozilla.fennec,$(ANDROID_PACKAGE_NAME))
MOZ_ANDROID_SHARED_ID = "org.mozilla.fennec.sharedID"
MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "org.mozilla.fennec_sync"
endif

View File

@ -3,6 +3,8 @@
package org.mozilla.gecko.background.common;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -77,4 +79,81 @@ public class TestUtils extends AndroidSyncTestCase {
assertStagesFromBundle(all, null, new String[] { "skip1", "skip2" }, new String[] { "other1", "other2", "sync1", "sync2" });
assertStagesFromBundle(all, new String[] { "sync1", "sync2" }, new String[] { "skip1", "skip2" }, new String[] { "sync1", "sync2" });
}
public static void deleteDirectoryRecursively(final File dir) throws IOException {
if (!dir.isDirectory()) {
throw new IllegalStateException("Given directory, " + dir + ", is not a directory!");
}
for (File f : dir.listFiles()) {
if (f.isDirectory()) {
deleteDirectoryRecursively(f);
} else if (!f.delete()) {
// Since this method is for testing, we assume we should be able to do this.
throw new IOException("Could not delete file, " + f.getAbsolutePath() + ". Permissions?");
}
}
if (!dir.delete()) {
throw new IOException("Could not delete dir, " + dir.getAbsolutePath() + ".");
}
}
public void testDeleteDirectory() throws Exception {
final String TEST_DIR = getApplicationContext().getCacheDir().getAbsolutePath() +
"-testDeleteDirectory-" + System.currentTimeMillis();
// Non-existent directory.
final File nonexistent = new File("nonexistentDirectory"); // Hopefully. ;)
assertFalse(nonexistent.exists());
try {
deleteDirectoryRecursively(nonexistent);
fail("deleteDirectoryRecursively on a nonexistent directory should throw Exception");
} catch (IllegalStateException e) { }
// Empty dir.
File dir = mkdir(TEST_DIR);
deleteDirectoryRecursively(dir);
assertFalse(dir.exists());
// Filled dir.
dir = mkdir(TEST_DIR);
populateDir(dir);
deleteDirectoryRecursively(dir);
assertFalse(dir.exists());
// Filled dir with empty dir.
dir = mkdir(TEST_DIR);
populateDir(dir);
File subDir = new File(TEST_DIR + File.separator + "subDir");
assertTrue(subDir.mkdir());
deleteDirectoryRecursively(dir);
assertFalse(subDir.exists()); // For short-circuiting errors.
assertFalse(dir.exists());
// Filled dir with filled dir.
dir = mkdir(TEST_DIR);
populateDir(dir);
subDir = new File(TEST_DIR + File.separator + "subDir");
assertTrue(subDir.mkdir());
populateDir(subDir);
deleteDirectoryRecursively(dir);
assertFalse(subDir.exists()); // For short-circuiting errors.
assertFalse(dir.exists());
}
private File mkdir(final String name) {
final File dir = new File(name);
assertTrue(dir.mkdir());
return dir;
}
private void populateDir(final File dir) throws IOException {
assertTrue(dir.isDirectory());
final String dirPath = dir.getAbsolutePath();
for (int i = 0; i < 3; i++) {
final File f = new File(dirPath + File.separator + i);
assertTrue(f.createNewFile()); // Throws IOException if file could not be created.
}
}
}

View File

@ -9,6 +9,8 @@ import android.app.Activity;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
import org.mozilla.gecko.background.common.TestUtils;
public abstract class FakeProfileTestCase extends ActivityInstrumentationTestCase2<Activity> {
protected Context context;
@ -26,6 +28,9 @@ public abstract class FakeProfileTestCase extends ActivityInstrumentationTestCas
context = getInstrumentation().getTargetContext();
File cache = context.getCacheDir();
fakeProfileDirectory = new File(cache.getAbsolutePath() + getCacheSuffix());
if (fakeProfileDirectory.exists()) {
TestUtils.deleteDirectoryRecursively(fakeProfileDirectory);
}
if (!fakeProfileDirectory.mkdir()) {
throw new IllegalStateException("Could not create temporary directory.");
}
@ -33,11 +38,7 @@ public abstract class FakeProfileTestCase extends ActivityInstrumentationTestCas
@Override
protected void tearDown() throws Exception {
// We don't check return values.
for (File child : fakeProfileDirectory.listFiles()) {
child.delete();
}
fakeProfileDirectory.delete();
TestUtils.deleteDirectoryRecursively(fakeProfileDirectory);
super.tearDown();
}
}