Bug 1256401 - Part 1: Remove mobile/android/b2gdroid. r=fabrice

MozReview-Commit-ID: AUnqHFr017n

--HG--
extra : rebase_source : 739270c96d0d288280260ffff591f096ba2a14ff
extra : histedit_source : 31ba47a9d58175af61e473b1ec7e8abefe8b3cd8
This commit is contained in:
Nick Alexander 2016-03-18 14:20:24 -07:00
Родитель bdacd45ef9
Коммит a06e89f5a6
88 изменённых файлов: 0 добавлений и 14142 удалений

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

@ -1,17 +0,0 @@
# vim: set filetype=python:
# 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/.
include('/toolkit/toolkit.mozbuild')
if CONFIG['ENABLE_TESTS']:
DIRS += ['/testing/instrumentation']
if CONFIG['MOZ_EXTENSIONS']:
DIRS += ['/extensions']
DIRS += [
'/%s' % CONFIG['MOZ_BRANDING_DIRECTORY'],
'/mobile/android/b2gdroid',
]

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

@ -1,83 +0,0 @@
# 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/.
ANDROID_MANIFEST_FILE := src/main/AndroidManifest.xml
JAVAFILES := \
src/main/java/org/mozilla/b2gdroid/Apps.java \
src/main/java/org/mozilla/b2gdroid/GeckoEventReceiver.java \
src/main/java/org/mozilla/b2gdroid/HeadlessSmsSendService.java \
src/main/java/org/mozilla/b2gdroid/Launcher.java \
src/main/java/org/mozilla/b2gdroid/MmsService.java \
src/main/java/org/mozilla/b2gdroid/NotificationObserver.java \
src/main/java/org/mozilla/b2gdroid/RemoteGeckoEventProxy.java \
src/main/java/org/mozilla/b2gdroid/ScreenStateObserver.java \
src/main/java/org/mozilla/b2gdroid/SettingsMapper.java \
src/main/java/org/mozilla/b2gdroid/GeckoEventReceiver.java \
src/main/java/org/mozilla/b2gdroid/NotificationObserver.java \
src/main/java/org/mozilla/b2gdroid/RemoteGeckoEventProxy.java \
src/main/java/com/google/android/mms/ContentType.java \
src/main/java/com/google/android/mms/InvalidHeaderValueException.java \
src/main/java/com/google/android/mms/MmsException.java \
src/main/java/com/google/android/mms/pdu/AcknowledgeInd.java \
src/main/java/com/google/android/mms/pdu/Base64.java \
src/main/java/com/google/android/mms/pdu/CharacterSets.java \
src/main/java/com/google/android/mms/pdu/DeliveryInd.java \
src/main/java/com/google/android/mms/pdu/EncodedStringValue.java \
src/main/java/com/google/android/mms/pdu/GenericPdu.java \
src/main/java/com/google/android/mms/pdu/MultimediaMessagePdu.java \
src/main/java/com/google/android/mms/pdu/NotificationInd.java \
src/main/java/com/google/android/mms/pdu/NotifyRespInd.java \
src/main/java/com/google/android/mms/pdu/PduBody.java \
src/main/java/com/google/android/mms/pdu/PduComposer.java \
src/main/java/com/google/android/mms/pdu/PduContentTypes.java \
src/main/java/com/google/android/mms/pdu/PduHeaders.java \
src/main/java/com/google/android/mms/pdu/PduParser.java \
src/main/java/com/google/android/mms/pdu/PduPart.java \
src/main/java/com/google/android/mms/pdu/PduPersister.java \
src/main/java/com/google/android/mms/pdu/QuotedPrintable.java \
src/main/java/com/google/android/mms/pdu/ReadOrigInd.java \
src/main/java/com/google/android/mms/pdu/ReadRecInd.java \
src/main/java/com/google/android/mms/pdu/RetrieveConf.java \
src/main/java/com/google/android/mms/pdu/SendConf.java \
src/main/java/com/google/android/mms/pdu/SendReq.java \
src/main/java/com/google/android/mms/util/AbstractCache.java \
src/main/java/com/google/android/mms/util/PduCache.java \
src/main/java/com/google/android/mms/util/PduCacheEntry.java \
src/main/java/com/google/android/mms/util/SqliteWrapper.java \
$(NULL)
# The GeckoView consuming APK depends on the GeckoView JAR files. There are two
# issues: first, the GeckoView JAR files need to be built before they are
# consumed here. This happens for delicate reasons. In the (serial) libs tier,
# base/ is traversed before b2gdroid/app. Since base/libs builds classes.dex,
# the underlying JAR files are built before the libs tier of b2gdroid/app is
# processed. Second, there is a correctness issue: the GeckoView JAR providing
# org.mozilla.gecko.R does not have the correct resource IDs for the consuming
# application, so we skip it. The b2gdroid APK builds a JAR containing
# org.mozilla.gecko.R itself.
jars_dir := $(DEPTH)/mobile/android/base
ANDROID_EXTRA_JARS := $(filter-out %gecko-R.jar,$(wildcard $(jars_dir)/*.jar))
# Needed for the UpdateService
ANDROID_EXTRA_JARS += $(ANDROID_COMPAT_LIB)
ANDROID_EXTRA_JARS += \
$(ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB) \
$(ANDROID_SUPPORT_V4_AAR_LIB) \
$(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
$(ANDROID_APPCOMPAT_V7_AAR_LIB) \
$(ANDROID_DESIGN_AAR_LIB) \
$(NULL)
# The GeckoView consuming APK depends on the GeckoView resources. This hacks a
# type of poor man's AAR support.
.aapt.deps: .geckoview_resources.deps
.geckoview_resources.deps: $(DEPTH)/mobile/android/base/geckoview_resources.zip
@$(TOUCH) $@
$(UNZIP) -u -o $< -d $(CURDIR)/geckoview_resources
include $(topsrcdir)/config/rules.mk
libs:: $(ANDROID_APK_NAME).apk

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

@ -1,996 +0,0 @@
/* 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/. */
#filter substitution
// For browser.xml binding
//
// cacheRatio* is a ratio that determines the amount of pixels to cache. The
// ratio is multiplied by the viewport width or height to get the displayport's
// width or height, respectively.
//
// (divide integer value by 1000 to get the ratio)
//
// For instance: cachePercentageWidth is 1500
// viewport height is 500
// => display port height will be 500 * 1.5 = 750
//
pref("toolkit.browser.cacheRatioWidth", 2000);
pref("toolkit.browser.cacheRatioHeight", 3000);
// How long before a content view (a handle to a remote scrollable object)
// expires.
pref("toolkit.browser.contentViewExpire", 3000);
pref("browser.chromeURL", "chrome://browser/content/");
// If a tab has not been active for this long (seconds), then it may be
// turned into a zombie tab to preemptively free up memory. -1 disables time-based
// expiration (but low-memory conditions may still require the tab to be zombified).
pref("browser.tabs.expireTime", 900);
// From libpref/src/init/all.js, extended to allow a slightly wider zoom range.
pref("zoom.minPercent", 20);
pref("zoom.maxPercent", 400);
pref("toolkit.zoomManager.zoomValues", ".2,.3,.5,.67,.8,.9,1,1.1,1.2,1.33,1.5,1.7,2,2.4,3,4");
// Mobile will use faster, less durable mode.
pref("toolkit.storage.synchronous", 0);
pref("browser.viewport.desktopWidth", 980);
// The default fallback zoom level to render pages at. Set to -1 to fit page; otherwise
// the value is divided by 1000 and clamped to hard-coded min/max scale values.
pref("browser.viewport.defaultZoom", -1);
/* allow scrollbars to float above chrome ui */
pref("ui.scrollbarsCanOverlapContent", 1);
/* turn off the caret blink after 10 cycles */
pref("ui.caretBlinkCount", 10);
// Unified AccessibleCarets (touch-caret and selection-carets).
pref("layout.accessiblecaret.enabled", true);
// Android generates long tap (mouse) events.
pref("layout.accessiblecaret.use_long_tap_injector", false);
/* cache prefs */
pref("browser.cache.disk.enable", true);
pref("browser.cache.disk.capacity", 20480); // kilobytes
pref("browser.cache.disk.max_entry_size", 4096); // kilobytes
pref("browser.cache.disk.smart_size.enabled", true);
pref("browser.cache.disk.smart_size.first_run", true);
#ifdef MOZ_PKG_SPECIAL
// low memory devices
pref("browser.cache.memory.enable", false);
#else
pref("browser.cache.memory.enable", true);
#endif
pref("browser.cache.memory.capacity", 1024); // kilobytes
pref("browser.cache.memory_limit", 5120); // 5 MB
/* image cache prefs */
pref("image.cache.size", 1048576); // bytes
/* offline cache prefs */
pref("browser.offline-apps.notify", true);
pref("browser.cache.offline.enable", true);
pref("browser.cache.offline.capacity", 5120); // kilobytes
pref("offline-apps.quota.warn", 1024); // kilobytes
// cache compression turned off for now - see bug #715198
pref("browser.cache.compression_level", 0);
/* disable some protocol warnings */
pref("network.protocol-handler.warn-external.tel", false);
pref("network.protocol-handler.warn-external.sms", false);
pref("network.protocol-handler.warn-external.mailto", false);
pref("network.protocol-handler.warn-external.vnd.youtube", false);
/* http prefs */
pref("network.http.pipelining", true);
pref("network.http.pipelining.ssl", true);
pref("network.http.proxy.pipelining", true);
pref("network.http.pipelining.maxrequests" , 6);
pref("network.http.keep-alive.timeout", 109);
pref("network.http.max-connections", 20);
pref("network.http.max-persistent-connections-per-server", 6);
pref("network.http.max-persistent-connections-per-proxy", 20);
// spdy
pref("network.http.spdy.push-allowance", 32768);
// See bug 545869 for details on why these are set the way they are
pref("network.buffer.cache.count", 24);
pref("network.buffer.cache.size", 16384);
// predictive actions
pref("network.predictor.enabled", true);
pref("network.predictor.max-db-size", 2097152); // bytes
pref("network.predictor.preserve", 50); // percentage of predictor data to keep when cleaning up
/* history max results display */
pref("browser.display.history.maxresults", 100);
/* How many times should have passed before the remote tabs list is refreshed */
pref("browser.display.remotetabs.timeout", 10);
/* session history */
pref("browser.sessionhistory.max_total_viewers", 1);
pref("browser.sessionhistory.max_entries", 50);
pref("browser.sessionhistory.contentViewerTimeout", 360);
/* session store */
pref("browser.sessionstore.resume_session_once", false);
pref("browser.sessionstore.resume_from_crash", true);
pref("browser.sessionstore.interval", 10000); // milliseconds
pref("browser.sessionstore.max_tabs_undo", 5);
pref("browser.sessionstore.max_resumed_crashes", 1);
pref("browser.sessionstore.recent_crashes", 0);
pref("browser.sessionstore.privacy_level", 0); // saving data: 0 = all, 1 = unencrypted sites, 2 = never
/* these should help performance */
pref("mozilla.widget.force-24bpp", true);
pref("mozilla.widget.use-buffer-pixmap", true);
pref("mozilla.widget.disable-native-theme", true);
pref("layout.reflow.synthMouseMove", false);
pref("layout.css.report_errors", false);
/* download manager (don't show the window or alert) */
pref("browser.download.useDownloadDir", true);
pref("browser.download.folderList", 1); // Default to ~/Downloads
pref("browser.download.manager.showAlertOnComplete", false);
pref("browser.download.manager.showAlertInterval", 2000);
pref("browser.download.manager.retention", 2);
pref("browser.download.manager.showWhenStarting", false);
pref("browser.download.manager.closeWhenDone", true);
pref("browser.download.manager.openDelay", 0);
pref("browser.download.manager.focusWhenStarting", false);
pref("browser.download.manager.flashCount", 2);
pref("browser.download.manager.displayedHistoryDays", 7);
pref("browser.download.manager.addToRecentDocs", true);
/* download helper */
pref("browser.helperApps.deleteTempFileOnExit", false);
/* password manager */
pref("signon.rememberSignons", true);
pref("signon.expireMasterPassword", false);
pref("signon.debug", false);
/* form helper (scroll to and optionally zoom into editable fields) */
pref("formhelper.mode", 2); // 0 = disabled, 1 = enabled, 2 = dynamic depending on screen size
pref("formhelper.autozoom", true);
/* find helper */
pref("findhelper.autozoom", true);
/* autocomplete */
pref("browser.formfill.enable", true);
/* spellcheck */
pref("layout.spellcheckDefault", 0);
/* new html5 forms */
pref("dom.experimental_forms", true);
pref("dom.forms.number", true);
/* extension manager and xpinstall */
pref("xpinstall.whitelist.directRequest", false);
pref("xpinstall.whitelist.fileRequest", false);
pref("xpinstall.whitelist.add", "https://addons.mozilla.org");
pref("xpinstall.whitelist.add.180", "https://marketplace.firefox.com");
pref("xpinstall.signatures.required", false);
pref("extensions.enabledScopes", 1);
pref("extensions.autoupdate.enabled", true);
pref("extensions.autoupdate.interval", 86400);
pref("extensions.update.enabled", false);
pref("extensions.update.interval", 86400);
pref("extensions.dss.enabled", false);
pref("extensions.dss.switchPending", false);
pref("extensions.ignoreMTimeChanges", false);
pref("extensions.logging.enabled", false);
pref("extensions.hideInstallButton", true);
pref("extensions.showMismatchUI", false);
pref("extensions.hideUpdateButton", false);
pref("extensions.strictCompatibility", false);
pref("extensions.minCompatibleAppVersion", "11.0");
pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.hotfix.id", "firefox-android-hotfix@mozilla.org");
pref("extensions.hotfix.cert.checkAttributes", true);
pref("extensions.hotfix.certs.1.sha1Fingerprint", "91:53:98:0C:C1:86:DF:47:8F:35:22:9E:11:C9:A7:31:04:49:A1:AA");
/* preferences for the Get Add-ons pane */
pref("extensions.getAddons.cache.enabled", true);
pref("extensions.getAddons.maxResults", 15);
pref("extensions.getAddons.recommended.browseURL", "https://addons.mozilla.org/%LOCALE%/android/recommended/");
pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/android/api/%API_VERSION%/list/featured/all/%MAX_RESULTS%/%OS%/%VERSION%");
pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/android/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/android/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%/%COMPATIBILITY_MODE%");
pref("extensions.getAddons.browseAddons", "https://addons.mozilla.org/%LOCALE%/android/");
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/android/api/%API_VERSION%/search/guid:%IDS%?src=mobile&appOS=%OS%&appVersion=%VERSION%");
pref("extensions.getAddons.getWithPerformance.url", "https://services.addons.mozilla.org/%LOCALE%/android/api/%API_VERSION%/search/guid:%IDS%?src=mobile&appOS=%OS%&appVersion=%VERSION%&tMain=%TIME_MAIN%&tFirstPaint=%TIME_FIRST_PAINT%&tSessionRestored=%TIME_SESSION_RESTORED%");
/* preference for the locale picker */
pref("extensions.getLocales.get.url", "");
pref("extensions.compatability.locales.buildid", "0");
/* blocklist preferences */
pref("extensions.blocklist.enabled", true);
pref("extensions.blocklist.interval", 86400);
pref("extensions.blocklist.url", "https://blocklist.addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
pref("extensions.blocklist.detailsURL", "https://www.mozilla.com/%LOCALE%/blocklist/");
/* Don't let XPIProvider install distribution add-ons; we do our own thing on mobile. */
pref("extensions.installDistroAddons", false);
/* block popups by default, and notify the user about blocked popups */
pref("dom.disable_open_during_load", true);
pref("privacy.popups.showBrowserMessage", true);
/* disable opening windows with the dialog feature */
pref("dom.disable_window_open_dialog_feature", true);
pref("dom.disable_window_showModalDialog", true);
pref("dom.disable_window_print", true);
pref("dom.disable_window_find", true);
pref("keyword.enabled", true);
pref("browser.fixup.domainwhitelist.localhost", true);
pref("accessibility.typeaheadfind", false);
pref("accessibility.typeaheadfind.timeout", 5000);
pref("accessibility.typeaheadfind.flashBar", 1);
pref("accessibility.typeaheadfind.linksonly", false);
pref("accessibility.typeaheadfind.casesensitive", 0);
pref("accessibility.browsewithcaret_shortcut.enabled", false);
// Whether the character encoding menu is under the main Firefox button. This
// preference is a string so that localizers can alter it.
pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");
// pointer to the default engine name
pref("browser.search.defaultenginename", "chrome://browser/locale/region.properties");
// SSL error page behaviour
pref("browser.ssl_override_behavior", 2);
pref("browser.xul.error_pages.expert_bad_cert", false);
// ordering of search engines in the engine list.
pref("browser.search.order.1", "chrome://browser/locale/region.properties");
pref("browser.search.order.2", "chrome://browser/locale/region.properties");
pref("browser.search.order.3", "chrome://browser/locale/region.properties");
// Market-specific search defaults
pref("browser.search.geoSpecificDefaults", true);
pref("browser.search.geoSpecificDefaults.url", "https://search.services.mozilla.com/1/%APP%/%VERSION%/%CHANNEL%/%LOCALE%/%REGION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%");
// US specific default (used as a fallback if the geoSpecificDefaults request fails).
pref("browser.search.defaultenginename.US", "chrome://browser/locale/region.properties");
pref("browser.search.order.US.1", "chrome://browser/locale/region.properties");
pref("browser.search.order.US.2", "chrome://browser/locale/region.properties");
pref("browser.search.order.US.3", "chrome://browser/locale/region.properties");
// disable updating
pref("browser.search.update", false);
// enable tracking protection for private browsing
pref("privacy.trackingprotection.pbmode.enabled", true);
// disable search suggestions by default
pref("browser.search.suggest.enabled", false);
pref("browser.search.suggest.prompted", false);
// Tell the search service to load search plugins from the locale JAR
pref("browser.search.loadFromJars", true);
pref("browser.search.jarURIs", "chrome://browser/locale/searchplugins/");
// tell the search service that we don't really expose the "current engine"
pref("browser.search.noCurrentEngine", true);
// Control media casting & mirroring features
pref("browser.casting.enabled", true);
#ifdef RELEASE_BUILD
// Chromecast mirroring is broken (bug 1131084)
pref("browser.mirroring.enabled", false);
#else
pref("browser.mirroring.enabled", true);
#endif
// Enable sparse localization by setting a few package locale overrides
pref("chrome.override_package.global", "browser");
pref("chrome.override_package.mozapps", "browser");
pref("chrome.override_package.passwordmgr", "browser");
// enable xul error pages
pref("browser.xul.error_pages.enabled", true);
// disable color management
pref("gfx.color_management.mode", 0);
// 0=fixed margin, 1=velocity bias, 2=dynamic resolution, 3=no margins, 4=prediction bias
pref("gfx.displayport.strategy", 1);
// all of the following displayport strategy prefs will be divided by 1000
// to obtain some multiplier which is then used in the strategy.
// fixed margin strategy options
pref("gfx.displayport.strategy_fm.multiplier", -1); // displayport dimension multiplier
pref("gfx.displayport.strategy_fm.danger_x", -1); // danger zone on x-axis when multiplied by viewport width
pref("gfx.displayport.strategy_fm.danger_y", -1); // danger zone on y-axis when multiplied by viewport height
// velocity bias strategy options
pref("gfx.displayport.strategy_vb.multiplier", -1); // displayport dimension multiplier
pref("gfx.displayport.strategy_vb.threshold", -1); // velocity threshold in inches/frame
pref("gfx.displayport.strategy_vb.reverse_buffer", -1); // fraction of buffer to keep in reverse direction from scroll
pref("gfx.displayport.strategy_vb.danger_x_base", -1); // danger zone on x-axis when multiplied by viewport width
pref("gfx.displayport.strategy_vb.danger_y_base", -1); // danger zone on y-axis when multiplied by viewport height
pref("gfx.displayport.strategy_vb.danger_x_incr", -1); // additional danger zone on x-axis when multiplied by viewport width and velocity
pref("gfx.displayport.strategy_vb.danger_y_incr", -1); // additional danger zone on y-axis when multiplied by viewport height and velocity
// prediction bias strategy options
pref("gfx.displayport.strategy_pb.threshold", -1); // velocity threshold in inches/frame
// Allow 24-bit colour when the hardware supports it
pref("gfx.android.rgb16.force", false);
// Allow GLContexts to be attached/detached from SurfaceTextures
pref("gfx.SurfaceTexture.detach.enabled", true);
// don't allow JS to move and resize existing windows
pref("dom.disable_window_move_resize", true);
// prevent click image resizing for nsImageDocument
pref("browser.enable_click_image_resizing", false);
// open in tab preferences
// 0=default window, 1=current window/tab, 2=new window, 3=new tab in most window
pref("browser.link.open_external", 3);
pref("browser.link.open_newwindow", 3);
// 0=force all new windows to tabs, 1=don't force, 2=only force those with no features set
pref("browser.link.open_newwindow.restriction", 0);
// controls which bits of private data to clear. by default we clear them all.
pref("privacy.item.cache", true);
pref("privacy.item.cookies", true);
pref("privacy.item.offlineApps", true);
pref("privacy.item.history", true);
pref("privacy.item.searchHistory", true);
pref("privacy.item.formdata", true);
pref("privacy.item.downloads", true);
pref("privacy.item.passwords", true);
pref("privacy.item.sessions", true);
pref("privacy.item.geolocation", true);
pref("privacy.item.siteSettings", true);
pref("privacy.item.syncAccount", true);
// enable geo
pref("geo.enabled", true);
// content sink control -- controls responsiveness during page load
// see https://bugzilla.mozilla.org/show_bug.cgi?id=481566#c9
//pref("content.sink.enable_perf_mode", 2); // 0 - switch, 1 - interactive, 2 - perf
//pref("content.sink.pending_event_mode", 0);
//pref("content.sink.perf_deflect_count", 1000000);
//pref("content.sink.perf_parse_time", 50000000);
// Disable the JS engine's gc on memory pressure, since we do one in the mobile
// browser (bug 669346).
pref("javascript.options.gc_on_memory_pressure", false);
#ifdef MOZ_PKG_SPECIAL
// low memory devices
pref("javascript.options.mem.gc_high_frequency_heap_growth_max", 120);
pref("javascript.options.mem.gc_high_frequency_heap_growth_min", 120);
pref("javascript.options.mem.gc_high_frequency_high_limit_mb", 40);
pref("javascript.options.mem.gc_high_frequency_low_limit_mb", 10);
pref("javascript.options.mem.gc_low_frequency_heap_growth", 120);
pref("javascript.options.mem.high_water_mark", 16);
pref("javascript.options.mem.gc_allocation_threshold_mb", 3);
pref("javascript.options.mem.gc_decommit_threshold_mb", 1);
pref("javascript.options.mem.gc_min_empty_chunk_count", 1);
pref("javascript.options.mem.gc_max_empty_chunk_count", 2);
#else
pref("javascript.options.mem.high_water_mark", 32);
#endif
pref("dom.max_chrome_script_run_time", 0); // disable slow script dialog for chrome
pref("dom.max_script_run_time", 20);
// JS error console
pref("devtools.errorconsole.enabled", false);
// Absolute path to the devtools unix domain socket file used
// to communicate with a usb cable via adb forward.
pref("devtools.debugger.unix-domain-socket", "/data/data/org.mozilla.b2gdroid/firefox-debugger-socket");
pref("devtools.remote.usb.enabled", false);
pref("devtools.remote.wifi.enabled", false);
pref("font.size.inflation.minTwips", 0);
// When true, zooming will be enabled on all sites, even ones that declare user-scalable=no.
pref("browser.ui.zoom.force-user-scalable", false);
pref("ui.zoomedview.disabled", false);
pref("ui.zoomedview.limitReadableSize", 8); // value in layer pixels
pref("ui.zoomedview.defaultZoomFactor", 2);
pref("ui.zoomedview.simplified", true); // Do not display all the zoomed view controls
pref("ui.touch.radius.enabled", false);
pref("ui.touch.radius.leftmm", 3);
pref("ui.touch.radius.topmm", 5);
pref("ui.touch.radius.rightmm", 3);
pref("ui.touch.radius.bottommm", 2);
pref("ui.touch.radius.visitedWeight", 120);
pref("ui.mouse.radius.enabled", true);
pref("ui.mouse.radius.leftmm", 3);
pref("ui.mouse.radius.topmm", 5);
pref("ui.mouse.radius.rightmm", 3);
pref("ui.mouse.radius.bottommm", 2);
pref("ui.mouse.radius.visitedWeight", 120);
pref("ui.mouse.radius.reposition", true);
// The percentage of the screen that needs to be scrolled before margins are exposed.
pref("browser.ui.show-margins-threshold", 10);
// Maximum distance from the point where the user pressed where we still
// look for text to select
pref("browser.ui.selection.distance", 250);
// plugins
pref("plugin.disable", false);
pref("dom.ipc.plugins.enabled", false);
// This pref isn't actually used anymore, but we're leaving this here to avoid changing
// the default so that we can migrate a user-set pref. See bug 885357.
pref("plugins.click_to_play", true);
// The default value for nsIPluginTag.enabledState (STATE_CLICKTOPLAY = 1)
pref("plugin.default.state", 1);
// product URLs
// The breakpad report server to link to in about:crashes
pref("breakpad.reportURL", "https://crash-stats.mozilla.com/report/index/");
pref("app.support.baseURL", "http://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/");
// Used to submit data to input from about:feedback
pref("app.feedback.postURL", "https://input.mozilla.org/api/v1/feedback/");
pref("app.privacyURL", "https://www.mozilla.org/privacy/firefox/");
pref("app.creditsURL", "http://www.mozilla.org/credits/");
pref("app.channelURL", "http://www.mozilla.org/%LOCALE%/firefox/channel/");
#if MOZ_UPDATE_CHANNEL == aurora
pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/mobile/%VERSION%/auroranotes/");
#elif MOZ_UPDATE_CHANNEL == beta
pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/mobile/%VERSION%beta/releasenotes/");
#else
pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/mobile/%VERSION%/releasenotes/");
#endif
#if MOZ_UPDATE_CHANNEL == beta
pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/mobile/beta/faq/");
#else
pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/mobile/faq/");
#endif
// Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
pref("security.alternate_certificate_error_page", "certerror");
pref("security.warn_viewing_mixed", false); // Warning is disabled. See Bug 616712.
// Block insecure active content on https pages
pref("security.mixed_content.block_active_content", true);
// Enable pinning
pref("security.cert_pinning.enforcement_level", 1);
// Only fetch OCSP for EV certificates
pref("security.OCSP.enabled", 2);
// Override some named colors to avoid inverse OS themes
pref("ui.-moz-dialog", "#efebe7");
pref("ui.-moz-dialogtext", "#101010");
pref("ui.-moz-field", "#fff");
pref("ui.-moz-fieldtext", "#1a1a1a");
pref("ui.-moz-buttonhoverface", "#f3f0ed");
pref("ui.-moz-buttonhovertext", "#101010");
pref("ui.-moz-combobox", "#fff");
pref("ui.-moz-comboboxtext", "#101010");
pref("ui.buttonface", "#ece7e2");
pref("ui.buttonhighlight", "#fff");
pref("ui.buttonshadow", "#aea194");
pref("ui.buttontext", "#101010");
pref("ui.captiontext", "#101010");
pref("ui.graytext", "#b1a598");
pref("ui.highlight", "#fad184");
pref("ui.highlighttext", "#1a1a1a");
pref("ui.infobackground", "#f5f5b5");
pref("ui.infotext", "#000");
pref("ui.menu", "#f7f5f3");
pref("ui.menutext", "#101010");
pref("ui.threeddarkshadow", "#000");
pref("ui.threedface", "#ece7e2");
pref("ui.threedhighlight", "#fff");
pref("ui.threedlightshadow", "#ece7e2");
pref("ui.threedshadow", "#aea194");
pref("ui.window", "#efebe7");
pref("ui.windowtext", "#101010");
pref("ui.windowframe", "#efebe7");
/* prefs used by the update timer system (including blocklist pings) */
pref("app.update.timerFirstInterval", 30000); // milliseconds
pref("app.update.timerMinimumDelay", 30); // seconds
// used by update service to decide whether or not to
// automatically download an update
pref("app.update.autodownload", "wifi");
pref("app.update.url.android", "https://aus4.mozilla.org/update/4/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%MOZ_VERSION%/update.xml");
#ifdef MOZ_UPDATER
/* prefs used specifically for updating the app */
pref("app.update.enabled", false);
pref("app.update.channel", "@MOZ_UPDATE_CHANNEL@");
#endif
// replace newlines with spaces on paste into single-line text boxes
pref("editor.singleLine.pasteNewlines", 2);
// threshold where a tap becomes a drag, in 1/240" reference pixels
// The names of the preferences are to be in sync with EventStateManager.cpp
pref("ui.dragThresholdX", 25);
pref("ui.dragThresholdY", 25);
pref("layers.acceleration.disabled", false);
pref("layers.offmainthreadcomposition.enabled", true);
pref("layers.async-video.enabled", true);
pref("layers.async-pan-zoom.enabled", true);
// APZ physics settings, tuned by UX designers
pref("apz.axis_lock.mode", 2); // Use "sticky" axis locking
pref("apz.fling_curve_function_x1", "0.41");
pref("apz.fling_curve_function_y1", "0.0");
pref("apz.fling_curve_function_x2", "0.80");
pref("apz.fling_curve_function_y2", "1.0");
pref("apz.fling_curve_threshold_inches_per_ms", "0.01");
pref("apz.fling_friction", "0.0019");
pref("apz.max_velocity_inches_per_ms", "0.07");
pref("layers.progressive-paint", true);
pref("layers.low-precision-buffer", true);
pref("layers.low-precision-resolution", "0.25");
pref("layers.low-precision-opacity", "1.0");
// We want to limit layers for two reasons:
// 1) We can't scroll smoothly if we have to many draw calls
// 2) Pages that have too many layers consume too much memory and crash.
// By limiting the number of layers on mobile we're making the main thread
// work harder keep scrolling smooth and memory low.
pref("layers.max-active", 20);
pref("notification.feature.enabled", true);
pref("dom.webnotifications.enabled", true);
// prevent tooltips from showing up
pref("browser.chrome.toolbar_tips", false);
// prevent video elements from preloading too much data
pref("media.preload.default", 1); // default to preload none
pref("media.preload.auto", 2); // preload metadata if preload=auto
pref("media.cache_size", 32768); // 32MB media cache
// Try to save battery by not resuming reading from a connection until we fall
// below 10s of buffered data.
pref("media.cache_resume_threshold", 10);
pref("media.cache_readahead_limit", 30);
// Number of video frames we buffer while decoding video.
// On Android this is decided by a similar value which varies for
// each OMX decoder |OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountMin|. This
// number must be less than the OMX equivalent or gecko will think it is
// chronically starved of video frames. All decoders seen so far have a value
// of at least 4.
pref("media.video-queue.default-size", 3);
// Enable the MediaCodec PlatformDecoderModule by default.
pref("media.android-media-codec.enabled", true);
pref("media.android-media-codec.preferred", true);
// Enable MSE
pref("media.mediasource.enabled", true);
// optimize images memory usage
pref("image.downscale-during-decode.enabled", true);
#ifdef MOZ_SAFE_BROWSING
pref("browser.safebrowsing.enabled", true);
pref("browser.safebrowsing.malware.enabled", true);
pref("browser.safebrowsing.downloads.enabled", false);
pref("browser.safebrowsing.downloads.remote.enabled", false);
pref("browser.safebrowsing.downloads.remote.timeout_ms", 10000);
pref("browser.safebrowsing.downloads.remote.url", "https://sb-ssl.google.com/safebrowsing/clientreport/download?key=%GOOGLE_API_KEY%");
pref("browser.safebrowsing.downloads.remote.block_dangerous", true);
pref("browser.safebrowsing.downloads.remote.block_dangerous_host", true);
pref("browser.safebrowsing.downloads.remote.block_potentially_unwanted", false);
pref("browser.safebrowsing.downloads.remote.block_uncommon", false);
pref("browser.safebrowsing.debug", false);
pref("browser.safebrowsing.provider.google.lists", "goog-badbinurl-shavar,goog-downloadwhite-digest256,goog-phish-shavar,goog-malware-shavar,goog-unwanted-shavar");
pref("browser.safebrowsing.provider.google.updateURL", "https://safebrowsing.google.com/safebrowsing/downloads?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2&key=%GOOGLE_API_KEY%");
pref("browser.safebrowsing.provider.google.gethashURL", "https://safebrowsing.google.com/safebrowsing/gethash?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2");
pref("browser.safebrowsing.provider.google.reportURL", "https://safebrowsing.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site=");
pref("browser.safebrowsing.reportPhishMistakeURL", "https://%LOCALE%.phish-error.mozilla.com/?hl=%LOCALE%&url=");
pref("browser.safebrowsing.reportPhishURL", "https://%LOCALE%.phish-report.mozilla.com/?hl=%LOCALE%&url=");
pref("browser.safebrowsing.reportMalwareMistakeURL", "https://%LOCALE%.malware-error.mozilla.com/?hl=%LOCALE%&url=");
pref("browser.safebrowsing.id", @MOZ_APP_UA_NAME@);
// Name of the about: page contributed by safebrowsing to handle display of error
// pages on phishing/malware hits. (bug 399233)
pref("urlclassifier.alternate_error_page", "blocked");
// The number of random entries to send with a gethash request.
pref("urlclassifier.gethashnoise", 4);
// Gethash timeout for Safebrowsing.
pref("urlclassifier.gethash.timeout_ms", 5000);
// If an urlclassifier table has not been updated in this number of seconds,
// a gethash request will be forced to check that the result is still in
// the database.
pref("urlclassifier.max-complete-age", 2700);
#endif
// URL for posting tiles metrics.
#ifdef RELEASE_BUILD
pref("browser.tiles.reportURL", "https://tiles.services.mozilla.com/v2/links/click");
#endif
// True if this is the first time we are showing about:firstrun
pref("browser.firstrun.show.uidiscovery", true);
pref("browser.firstrun.show.localepicker", false);
// True if you always want dump() to work
//
// On Android, you also need to do the following for the output
// to show up in logcat:
//
// $ adb shell stop
// $ adb shell setprop log.redirect-stdio true
// $ adb shell start
pref("browser.dom.window.dump.enabled", true);
// SimplePush
pref("services.push.enabled", false);
// controls if we want camera support
pref("device.camera.enabled", true);
pref("media.realtime_decoder.enabled", true);
pref("dom.report_all_js_exceptions", true);
pref("javascript.options.showInConsole", true);
pref("full-screen-api.enabled", true);
pref("direct-texture.force.enabled", false);
pref("direct-texture.force.disabled", false);
// This fraction in 1000ths of velocity remains after every animation frame when the velocity is low.
pref("ui.scrolling.friction_slow", -1);
// This fraction in 1000ths of velocity remains after every animation frame when the velocity is high.
pref("ui.scrolling.friction_fast", -1);
// The maximum velocity change factor between events, per ms, in 1000ths.
// Direction changes are excluded.
pref("ui.scrolling.max_event_acceleration", -1);
// The rate of deceleration when the surface has overscrolled, in 1000ths.
pref("ui.scrolling.overscroll_decel_rate", -1);
// The fraction of the surface which can be overscrolled before it must snap back, in 1000ths.
pref("ui.scrolling.overscroll_snap_limit", -1);
// The minimum amount of space that must be present for an axis to be considered scrollable,
// in 1/1000ths of pixels.
pref("ui.scrolling.min_scrollable_distance", -1);
// The axis lock mode for panning behaviour - set between standard, free and sticky
pref("ui.scrolling.axis_lock_mode", "standard");
// Negate scroll, true will make the mouse scroll wheel move the screen the same direction as with most desktops or laptops.
pref("ui.scrolling.negate_wheel_scroll", true);
// Determine the dead zone for gamepad joysticks. Higher values result in larger dead zones; use a negative value to
// auto-detect based on reported hardware values
pref("ui.scrolling.gamepad_dead_zone", 115);
// Prefs for fling acceleration
pref("ui.scrolling.fling_accel_interval", -1);
pref("ui.scrolling.fling_accel_base_multiplier", -1);
pref("ui.scrolling.fling_accel_supplemental_multiplier", -1);
// Prefs for fling curving
pref("ui.scrolling.fling_curve_function_x1", -1);
pref("ui.scrolling.fling_curve_function_y1", -1);
pref("ui.scrolling.fling_curve_function_x2", -1);
pref("ui.scrolling.fling_curve_function_y2", -1);
pref("ui.scrolling.fling_curve_threshold_velocity", -1);
pref("ui.scrolling.fling_curve_max_velocity", -1);
pref("ui.scrolling.fling_curve_newton_iterations", -1);
// Enable accessibility mode if platform accessibility is enabled.
pref("accessibility.accessfu.activate", 2);
pref("accessibility.accessfu.quicknav_modes", "Link,Heading,FormElement,Landmark,ListItem");
// Active quicknav mode, index value of list from quicknav_modes
pref("accessibility.accessfu.quicknav_index", 0);
// Setting for an utterance order (0 - description first, 1 - description last).
pref("accessibility.accessfu.utterance", 1);
// Whether to skip images with empty alt text
pref("accessibility.accessfu.skip_empty_images", true);
// Transmit UDP busy-work to the LAN when anticipating low latency
// network reads and on wifi to mitigate 802.11 Power Save Polling delays
pref("network.tickle-wifi.enabled", true);
// Mobile manages state by autodetection
pref("network.manage-offline-status", true);
// increase the timeout clamp for background tabs to 15 minutes
pref("dom.min_background_timeout_value", 900000);
// Media plugins for libstagefright playback on android
pref("media.plugins.enabled", true);
// Stagefright's OMXCodec::CreationFlags. The interesting flag values are:
// 0 = Let Stagefright choose hardware or software decoding (default)
// 8 = Force software decoding
// 16 = Force hardware decoding
pref("media.stagefright.omxcodec.flags", 0);
// Coalesce touch events to prevent them from flooding the event queue
pref("dom.event.touch.coalescing.enabled", false);
// default orientation for the app, default to undefined
// the java GeckoScreenOrientationListener needs this to be defined
pref("app.orientation.default", "");
// On memory pressure, release dirty but unused pages held by jemalloc
// back to the system.
pref("memory.free_dirty_pages", true);
pref("layout.imagevisibility.numscrollportwidths", 1);
pref("layout.imagevisibility.numscrollportheights", 1);
pref("layers.enable-tiles", true);
// Enable the dynamic toolbar
pref("browser.chrome.dynamictoolbar", true);
// The mode of browser titlebar
// 0: Show a current page title.
// 1: Show a current page url.
pref("browser.chrome.titlebarMode", 1);
// Hide common parts of URLs like "www." or "http://"
pref("browser.urlbar.trimURLs", true);
#ifdef MOZ_PKG_SPECIAL
// Disable webgl on ARMv6 because running the reftests takes
// too long for some reason (bug 843738)
pref("webgl.disabled", true);
#endif
// initial web feed readers list
pref("browser.contentHandlers.types.0.title", "chrome://browser/locale/region.properties");
pref("browser.contentHandlers.types.0.uri", "chrome://browser/locale/region.properties");
pref("browser.contentHandlers.types.0.type", "application/vnd.mozilla.maybe.feed");
pref("browser.contentHandlers.types.1.title", "chrome://browser/locale/region.properties");
pref("browser.contentHandlers.types.1.uri", "chrome://browser/locale/region.properties");
pref("browser.contentHandlers.types.1.type", "application/vnd.mozilla.maybe.feed");
pref("browser.contentHandlers.types.2.title", "chrome://browser/locale/region.properties");
pref("browser.contentHandlers.types.2.uri", "chrome://browser/locale/region.properties");
pref("browser.contentHandlers.types.2.type", "application/vnd.mozilla.maybe.feed");
pref("browser.contentHandlers.types.3.title", "chrome://browser/locale/region.properties");
pref("browser.contentHandlers.types.3.uri", "chrome://browser/locale/region.properties");
pref("browser.contentHandlers.types.3.type", "application/vnd.mozilla.maybe.feed");
// WebPayment
pref("dom.mozPay.enabled", true);
pref("dom.payment.provider.0.name", "Firefox Marketplace");
pref("dom.payment.provider.0.description", "marketplace.firefox.com");
pref("dom.payment.provider.0.uri", "https://marketplace.firefox.com/mozpay/?req=");
pref("dom.payment.provider.0.type", "mozilla/payments/pay/v1");
pref("dom.payment.provider.0.requestMethod", "GET");
// Shortnumber matching needed for e.g. Brazil:
// 01187654321 can be found with 87654321
pref("dom.phonenumber.substringmatching.BR", 8);
pref("dom.phonenumber.substringmatching.CO", 10);
pref("dom.phonenumber.substringmatching.VE", 7);
// Enable hardware-accelerated Skia canvas
pref("gfx.canvas.azure.backends", "skia");
pref("gfx.canvas.azure.accelerated", true);
// See ua-update.json.in for the packaged UA override list
pref("general.useragent.updates.enabled", true);
pref("general.useragent.updates.url", "https://dynamicua.cdn.mozilla.net/0/%APP_ID%");
pref("general.useragent.updates.interval", 604800); // 1 week
pref("general.useragent.updates.retry", 86400); // 1 day
// When true, phone number linkification is enabled.
pref("browser.ui.linkify.phone", false);
// Enables/disables Spatial Navigation
pref("snav.enabled", true);
// This url, if changed, MUST continue to point to an https url. Pulling arbitrary content to inject into
// this page over http opens us up to a man-in-the-middle attack that we'd rather not face. If you are a downstream
// repackager of this code using an alternate snippet url, please keep your users safe
pref("browser.snippets.updateUrl", "https://snippets.mozilla.com/json/%SNIPPETS_VERSION%/%NAME%/%VERSION%/%APPBUILDID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/");
// How frequently we check for new snippets, in seconds (1 day)
pref("browser.snippets.updateInterval", 86400);
// URL used to check for user's country code
pref("browser.snippets.geoUrl", "https://geo.mozilla.org/country.json");
// URL used to ping metrics with stats about which snippets have been shown
pref("browser.snippets.statsUrl", "https://snippets-stats.mozilla.org/mobile");
// These prefs require a restart to take effect.
pref("browser.snippets.enabled", true);
pref("browser.snippets.syncPromo.enabled", true);
pref("browser.snippets.firstrunHomepage.enabled", true);
// The mode of home provider syncing.
// 0: Sync always
// 1: Sync only when on wifi
pref("home.sync.updateMode", 0);
// How frequently to check if we should sync home provider data.
pref("home.sync.checkIntervalSecs", 3600);
// Enable device storage API
pref("device.storage.enabled", true);
// Enable meta-viewport support for font inflation code
pref("dom.meta-viewport.enabled", true);
// Enable GMP support in the addon manager.
pref("media.gmp-provider.enabled", true);
// The default color scheme in reader mode (light, dark, auto)
// auto = color automatically adjusts according to ambient light level
// (auto only works on platforms where the 'devicelight' event is enabled)
pref("reader.color_scheme", "auto");
// Color scheme values available in reader mode UI.
pref("reader.color_scheme.values", "[\"dark\",\"auto\",\"light\"]");
// Whether to use a vertical or horizontal toolbar.
pref("reader.toolbar.vertical", false);
// Whether or not to display buttons related to reading list in reader view.
pref("browser.readinglist.enabled", true);
// Telemetry settings.
// Whether to use the unified telemetry behavior, requires a restart.
pref("toolkit.telemetry.unified", false);
// Disable sending console to logcat on release builds.
#ifdef RELEASE_BUILD
pref("consoleservice.logcat", false);
#else
pref("consoleservice.logcat", true);
#endif
// Enable Cardboard VR on mobile, assuming VR at all is enabled
pref("dom.vr.cardboard.enabled", true);
// TODO: Disabled until bug 1190301 is fixed.
pref("browser.tabs.showAudioPlayingIcon", false);
// B2GDroid preferences.
pref("toolkit.defaultChromeURI", "chrome://b2g/content/shell.html");
// Setup webapps to use a single profile.
pref("dom.webapps.useCurrentProfile", true);
// Enable system messages.
pref("dom.sysmsg.enabled", true);
// Enable the mozSettings api.
pref("dom.mozSettings.enabled", true);
// Enable dataStore.
pref("dom.datastore.enabled", true);
// When an entry is changed, use two timers to fire system messages in a more
// moderate pattern.
pref("dom.datastore.sysMsgOnChangeShortTimeoutSec", 10);
pref("dom.datastore.sysMsgOnChangeLongTimeoutSec", 60);
// DOM Inter-App Communication API.
pref("dom.inter-app-communication-api.enabled", true);
// Downloads API
pref("dom.mozDownloads.enabled", true);
pref("dom.downloads.max_retention_days", 7);
// Startup prefs.
// TODO: don't hardcode that.
pref("b2g.system_startup_url", "app://system.gaiamobile.org/index.html");
pref("b2g.system_manifest_url", "app://system.gaiamobile.org/manifest.webapp");
pref("dom.mozBrowserFramesEnabled", true);
// Default Content Security Policy to apply to certified apps.
// If you change this CSP, make sure to update the fast path in nsCSPService.cpp
pref("security.apps.certified.CSP.default", "default-src * data: blob:; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline' app://theme.gaiamobile.org");
// Default Content Security Policy to apply to trusted apps.
pref("security.apps.trusted.CSP.default", "default-src * data: blob:; object-src 'none'; frame-src 'none'");
pref("b2g.orientation.animate", true);
// The origin used for the shared themes uri space.
pref("b2g.theme.origin", "app://theme.gaiamobile.org");
pref("dom.mozApps.themable", true);
pref("dom.mozApps.selected_theme", "default_theme.gaiamobile.org");
// InputMethod so we can do soft keyboards.
pref("dom.mozInputMethod.enabled", true);
// sms api.
pref("dom.sms.enabled", true);
// Enable native identity (persona/browserid)
pref("dom.identity.enabled", true);
// Enable sync and mozId with Firefox Accounts.
pref("services.sync.fxaccounts.enabled", true);
pref("identity.fxaccounts.enabled", true);
// Mobile Identity API.
pref("services.mobileid.server.uri", "https://msisdn.services.mozilla.com");
// Enable Web Speech synthesis API
pref("media.webspeech.synth.enabled", true);
// Enable the permissions api.
pref("dom.mozPermissionSettings.enabled", true);
// TCPSocket
pref("dom.mozTCPSocket.enabled", true);
// Contacts API.
pref("dom.mozContacts.enabled", true);
// OOP apps.
pref("dom.ipc.tabs.disabled", false);
pref("dom.ipc.processCount", 100000);
// Retain at most 10 processes' layers buffers
pref("layers.compositor-lru-size", 10);
// Enable pre-launching content processes for improved startup time
// (hiding latency).
pref("dom.ipc.processPrelaunch.enabled", true);
// Wait this long before pre-launching a new subprocess.
pref("dom.ipc.processPrelaunch.delayMs", 5000);
pref("dom.ipc.reuse_parent_app", false);
// When a process receives a system message, we hold a CPU wake lock on its
// behalf for this many seconds, or until it handles the system message,
// whichever comes first.
pref("dom.ipc.systemMessageCPULockTimeoutSec", 30);
pref("dom.wakelock.enabled", true);
pref("dom.webcomponents.enabled", true);
// Enable the Alarms API
pref("dom.mozAlarms.enabled", true);
pref("layout.css.scroll-snap.enabled", true);
pref("layout.css.scroll-behavior.enabled", true);
pref("layout.css.scroll-behavior.property-enabled", true);
// Enable extensions
pref("dom.apps.customization.enabled", true);

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

@ -1,38 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
ANDROID_APK_NAME = 'b2gdroid'
ANDROID_APK_PACKAGE = 'org.mozilla.b2gdroid'
ANDROID_RES_DIRS += [
'src/main/res',
'!geckoview_resources',
]
ANDROID_ASSETS_DIRS += [
'src/main/assets',
'!/dist/bin/gaia/assets', # We must have built /b2g/gaia before building app/.
]
# Make aapt generate org/mozilla/gecko/R.java. There's a problem hidden here:
# the GeckoView classes may reference resources provided by other packages.
# That is, the GeckoView JAR files may reference android.support.v7.appcompat.R
# (say) at runtime. That class is in the gecko-R.jar file which is not (and can
# not!) be included as part of GeckoView. To avoid this, we'd need to include
# the transitive set of resource classes. For now, let's assume that b2gdroid
# will not induce accesses to other package's resources at runtime.
ANDROID_EXTRA_PACKAGES += ['org.mozilla.gecko']
if CONFIG['ANDROID_SUPPORT_V4_AAR']:
ANDROID_EXTRA_PACKAGES += ['android.support.v4']
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_SUPPORT_V4_AAR_RES']]
if CONFIG['ANDROID_APPCOMPAT_V7_AAR']:
ANDROID_EXTRA_PACKAGES += ['android.support.v7.appcompat']
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_APPCOMPAT_V7_AAR_RES']]
JS_PREFERENCE_PP_FILES += [
'b2gdroid.js',
]

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

@ -1,189 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mozilla.b2gdroid"
android:installLocation="auto"
>
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="22"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-feature android:name="android.hardware.location" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen"/>
<!-- Contacts API -->
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<!-- WebSMS -->
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.WRITE_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.BROADCAST_SMS"/>
<uses-permission android:name="android.permission.WAP_PUSH_DELIVER"/>
<uses-permission android:name="android.permission.SEND_RESPOND_VIA_MESSAGE"/>
<uses-feature android:name="android.hardware.telephony"/>
<!-- Tab Queue -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<!-- Android Beam support -->
<uses-permission android:name="android.permission.NFC"/>
<uses-feature android:name="android.hardware.nfc" android:required="false"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-feature android:name="android.hardware.audio.low_latency" android:required="false"/>
<uses-feature android:name="android.hardware.camera.any" android:required="false"/>
<uses-feature android:name="android.hardware.microphone" android:required="false"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<!-- App requires OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- Needed to disable the default lockscreen -->
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application android:label="@string/b2g"
android:icon="@drawable/b2g"
android:logo="@drawable/b2g"
android:hardwareAccelerated="true"
android:debuggable="true">
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true"/>
<!-- Listen for incoming SMS messages -->
<receiver android:name="org.mozilla.gecko.GeckoSmsManager"
android:permission="android.permission.BROADCAST_SMS">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_DELIVER" />
</intent-filter>
</receiver>
<!-- Listen for incoming MMS messages -->
<receiver android:name=".MmsService"
android:permission="android.permission.BROADCAST_WAP_PUSH">
<intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
</receiver>
<!-- Service that delivers messages from the phone "quick response" -->
<service android:name=".HeadlessSmsSendService"
android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
</service>
<activity android:name="org.mozilla.b2gdroid.Launcher"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:icon="@drawable/b2g"
android:label="@string/b2g"
android:launchMode="singleInstance"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true">
<!-- Set up as a homescreen replacement -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- Handle SMS intents -->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
<!-- Default browser intents -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:scheme="about" />
<data android:scheme="javascript" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:mimeType="text/html"/>
<data android:mimeType="text/plain"/>
<data android:mimeType="application/xhtml+xml"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.WEB_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<!-- We will route the search intent to Gaia -->
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
</activity>
<service
android:name="org.mozilla.b2gdroid.NotificationObserver"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
android:process="org.mozilla.b2gdroid.NotificationObserver">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<service
android:exported="false"
android:name="org.mozilla.gecko.updater.UpdateService"
android:process="org.mozilla.b2gdroid.UpdateService">
</service>
<receiver android:name="org.mozilla.gecko.AlarmReceiver" >
</receiver>
</application>
</manifest>

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

@ -1 +0,0 @@
Example asset!

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

@ -1,230 +0,0 @@
/*
* Copyright (C) 2007-2008 Esmertec AG.
* Copyright (C) 2007-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms;
import java.util.ArrayList;
public class ContentType {
public static final String MMS_MESSAGE = "application/vnd.wap.mms-message";
// The phony content type for generic PDUs (e.g. ReadOrig.ind,
// Notification.ind, Delivery.ind).
public static final String MMS_GENERIC = "application/vnd.wap.mms-generic";
public static final String MULTIPART_MIXED = "application/vnd.wap.multipart.mixed";
public static final String MULTIPART_RELATED = "application/vnd.wap.multipart.related";
public static final String MULTIPART_ALTERNATIVE = "application/vnd.wap.multipart.alternative";
public static final String TEXT_PLAIN = "text/plain";
public static final String TEXT_HTML = "text/html";
public static final String TEXT_VCALENDAR = "text/x-vCalendar";
public static final String TEXT_VCARD = "text/x-vCard";
public static final String IMAGE_UNSPECIFIED = "image/*";
public static final String IMAGE_JPEG = "image/jpeg";
public static final String IMAGE_JPG = "image/jpg";
public static final String IMAGE_GIF = "image/gif";
public static final String IMAGE_WBMP = "image/vnd.wap.wbmp";
public static final String IMAGE_PNG = "image/png";
public static final String IMAGE_X_MS_BMP = "image/x-ms-bmp";
public static final String AUDIO_UNSPECIFIED = "audio/*";
public static final String AUDIO_AAC = "audio/aac";
public static final String AUDIO_AMR = "audio/amr";
public static final String AUDIO_IMELODY = "audio/imelody";
public static final String AUDIO_MID = "audio/mid";
public static final String AUDIO_MIDI = "audio/midi";
public static final String AUDIO_MP3 = "audio/mp3";
public static final String AUDIO_MPEG3 = "audio/mpeg3";
public static final String AUDIO_MPEG = "audio/mpeg";
public static final String AUDIO_MPG = "audio/mpg";
public static final String AUDIO_MP4 = "audio/mp4";
public static final String AUDIO_X_MID = "audio/x-mid";
public static final String AUDIO_X_MIDI = "audio/x-midi";
public static final String AUDIO_X_MP3 = "audio/x-mp3";
public static final String AUDIO_X_MPEG3 = "audio/x-mpeg3";
public static final String AUDIO_X_MPEG = "audio/x-mpeg";
public static final String AUDIO_X_MPG = "audio/x-mpg";
public static final String AUDIO_3GPP = "audio/3gpp";
public static final String AUDIO_X_WAV = "audio/x-wav";
public static final String AUDIO_OGG = "application/ogg";
public static final String VIDEO_UNSPECIFIED = "video/*";
public static final String VIDEO_3GPP = "video/3gpp";
public static final String VIDEO_3G2 = "video/3gpp2";
public static final String VIDEO_H263 = "video/h263";
public static final String VIDEO_MP4 = "video/mp4";
public static final String APP_SMIL = "application/smil";
public static final String APP_WAP_XHTML = "application/vnd.wap.xhtml+xml";
public static final String APP_XHTML = "application/xhtml+xml";
public static final String APP_DRM_CONTENT = "application/vnd.oma.drm.content";
public static final String APP_DRM_MESSAGE = "application/vnd.oma.drm.message";
private static final ArrayList<String> sSupportedContentTypes = new ArrayList<String>();
private static final ArrayList<String> sSupportedImageTypes = new ArrayList<String>();
private static final ArrayList<String> sSupportedAudioTypes = new ArrayList<String>();
private static final ArrayList<String> sSupportedVideoTypes = new ArrayList<String>();
static {
sSupportedContentTypes.add(TEXT_PLAIN);
sSupportedContentTypes.add(TEXT_HTML);
sSupportedContentTypes.add(TEXT_VCALENDAR);
sSupportedContentTypes.add(TEXT_VCARD);
sSupportedContentTypes.add(IMAGE_JPEG);
sSupportedContentTypes.add(IMAGE_GIF);
sSupportedContentTypes.add(IMAGE_WBMP);
sSupportedContentTypes.add(IMAGE_PNG);
sSupportedContentTypes.add(IMAGE_JPG);
sSupportedContentTypes.add(IMAGE_X_MS_BMP);
//supportedContentTypes.add(IMAGE_SVG); not yet supported.
sSupportedContentTypes.add(AUDIO_AAC);
sSupportedContentTypes.add(AUDIO_AMR);
sSupportedContentTypes.add(AUDIO_IMELODY);
sSupportedContentTypes.add(AUDIO_MID);
sSupportedContentTypes.add(AUDIO_MIDI);
sSupportedContentTypes.add(AUDIO_MP3);
sSupportedContentTypes.add(AUDIO_MP4);
sSupportedContentTypes.add(AUDIO_MPEG3);
sSupportedContentTypes.add(AUDIO_MPEG);
sSupportedContentTypes.add(AUDIO_MPG);
sSupportedContentTypes.add(AUDIO_X_MID);
sSupportedContentTypes.add(AUDIO_X_MIDI);
sSupportedContentTypes.add(AUDIO_X_MP3);
sSupportedContentTypes.add(AUDIO_X_MPEG3);
sSupportedContentTypes.add(AUDIO_X_MPEG);
sSupportedContentTypes.add(AUDIO_X_MPG);
sSupportedContentTypes.add(AUDIO_X_WAV);
sSupportedContentTypes.add(AUDIO_3GPP);
sSupportedContentTypes.add(AUDIO_OGG);
sSupportedContentTypes.add(VIDEO_3GPP);
sSupportedContentTypes.add(VIDEO_3G2);
sSupportedContentTypes.add(VIDEO_H263);
sSupportedContentTypes.add(VIDEO_MP4);
sSupportedContentTypes.add(APP_SMIL);
sSupportedContentTypes.add(APP_WAP_XHTML);
sSupportedContentTypes.add(APP_XHTML);
sSupportedContentTypes.add(APP_DRM_CONTENT);
sSupportedContentTypes.add(APP_DRM_MESSAGE);
// add supported image types
sSupportedImageTypes.add(IMAGE_JPEG);
sSupportedImageTypes.add(IMAGE_GIF);
sSupportedImageTypes.add(IMAGE_WBMP);
sSupportedImageTypes.add(IMAGE_PNG);
sSupportedImageTypes.add(IMAGE_JPG);
sSupportedImageTypes.add(IMAGE_X_MS_BMP);
// add supported audio types
sSupportedAudioTypes.add(AUDIO_AAC);
sSupportedAudioTypes.add(AUDIO_AMR);
sSupportedAudioTypes.add(AUDIO_IMELODY);
sSupportedAudioTypes.add(AUDIO_MID);
sSupportedAudioTypes.add(AUDIO_MIDI);
sSupportedAudioTypes.add(AUDIO_MP3);
sSupportedAudioTypes.add(AUDIO_MPEG3);
sSupportedAudioTypes.add(AUDIO_MPEG);
sSupportedAudioTypes.add(AUDIO_MPG);
sSupportedAudioTypes.add(AUDIO_MP4);
sSupportedAudioTypes.add(AUDIO_X_MID);
sSupportedAudioTypes.add(AUDIO_X_MIDI);
sSupportedAudioTypes.add(AUDIO_X_MP3);
sSupportedAudioTypes.add(AUDIO_X_MPEG3);
sSupportedAudioTypes.add(AUDIO_X_MPEG);
sSupportedAudioTypes.add(AUDIO_X_MPG);
sSupportedAudioTypes.add(AUDIO_X_WAV);
sSupportedAudioTypes.add(AUDIO_3GPP);
sSupportedAudioTypes.add(AUDIO_OGG);
// add supported video types
sSupportedVideoTypes.add(VIDEO_3GPP);
sSupportedVideoTypes.add(VIDEO_3G2);
sSupportedVideoTypes.add(VIDEO_H263);
sSupportedVideoTypes.add(VIDEO_MP4);
}
// This class should never be instantiated.
private ContentType() {
}
public static boolean isSupportedType(String contentType) {
return (null != contentType) && sSupportedContentTypes.contains(contentType);
}
public static boolean isSupportedImageType(String contentType) {
return isImageType(contentType) && isSupportedType(contentType);
}
public static boolean isSupportedAudioType(String contentType) {
return isAudioType(contentType) && isSupportedType(contentType);
}
public static boolean isSupportedVideoType(String contentType) {
return isVideoType(contentType) && isSupportedType(contentType);
}
public static boolean isTextType(String contentType) {
return (null != contentType) && contentType.startsWith("text/");
}
public static boolean isImageType(String contentType) {
return (null != contentType) && contentType.startsWith("image/");
}
public static boolean isAudioType(String contentType) {
return (null != contentType) && contentType.startsWith("audio/");
}
public static boolean isVideoType(String contentType) {
return (null != contentType) && contentType.startsWith("video/");
}
public static boolean isDrmType(String contentType) {
return (null != contentType)
&& (contentType.equals(APP_DRM_CONTENT)
|| contentType.equals(APP_DRM_MESSAGE));
}
public static boolean isUnspecified(String contentType) {
return (null != contentType) && contentType.endsWith("*");
}
@SuppressWarnings("unchecked")
public static ArrayList<String> getImageTypes() {
return (ArrayList<String>) sSupportedImageTypes.clone();
}
@SuppressWarnings("unchecked")
public static ArrayList<String> getAudioTypes() {
return (ArrayList<String>) sSupportedAudioTypes.clone();
}
@SuppressWarnings("unchecked")
public static ArrayList<String> getVideoTypes() {
return (ArrayList<String>) sSupportedVideoTypes.clone();
}
@SuppressWarnings("unchecked")
public static ArrayList<String> getSupportedTypes() {
return (ArrayList<String>) sSupportedContentTypes.clone();
}
}

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

@ -1,41 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms;
/**
* Thrown when an invalid header value was set.
*/
public class InvalidHeaderValueException extends MmsException {
private static final long serialVersionUID = -2053384496042052262L;
/**
* Constructs an InvalidHeaderValueException with no detailed message.
*/
public InvalidHeaderValueException() {
super();
}
/**
* Constructs an InvalidHeaderValueException with the specified detailed message.
*
* @param message the detailed message.
*/
public InvalidHeaderValueException(String message) {
super(message);
}
}

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

@ -1,60 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms;
/**
* A generic exception that is thrown by the Mms client.
*/
public class MmsException extends Exception {
private static final long serialVersionUID = -7323249827281485390L;
/**
* Creates a new MmsException.
*/
public MmsException() {
super();
}
/**
* Creates a new MmsException with the specified detail message.
*
* @param message the detail message.
*/
public MmsException(String message) {
super(message);
}
/**
* Creates a new MmsException with the specified cause.
*
* @param cause the cause.
*/
public MmsException(Throwable cause) {
super(cause);
}
/**
* Creates a new MmsException with the specified detail message and cause.
*
* @param message the detail message.
* @param cause the cause.
*/
public MmsException(String message, Throwable cause) {
super(message, cause);
}
}

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

@ -1,89 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
/**
* M-Acknowledge.ind PDU.
*/
public class AcknowledgeInd extends GenericPdu {
/**
* Constructor, used when composing a M-Acknowledge.ind pdu.
*
* @param mmsVersion current viersion of mms
* @param transactionId the transaction-id value
* @throws InvalidHeaderValueException if parameters are invalid.
* NullPointerException if transactionId is null.
*/
public AcknowledgeInd(int mmsVersion, byte[] transactionId)
throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND);
setMmsVersion(mmsVersion);
setTransactionId(transactionId);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
AcknowledgeInd(PduHeaders headers) {
super(headers);
}
/**
* Get X-Mms-Report-Allowed field value.
*
* @return the X-Mms-Report-Allowed value
*/
public int getReportAllowed() {
return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED);
}
/**
* Set X-Mms-Report-Allowed field value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setReportAllowed(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED);
}
/**
* Get X-Mms-Transaction-Id field value.
*
* @return the X-Mms-Report-Allowed value
*/
public byte[] getTransactionId() {
return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
}
/**
* Set X-Mms-Transaction-Id field value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setTransactionId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
}
}

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

@ -1,167 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
public class Base64 {
/**
* Used to get the number of Quadruples.
*/
static final int FOURBYTE = 4;
/**
* Byte used to pad output.
*/
static final byte PAD = (byte) '=';
/**
* The base length.
*/
static final int BASELENGTH = 255;
// Create arrays to hold the base64 characters
private static byte[] base64Alphabet = new byte[BASELENGTH];
// Populating the character arrays
static {
for (int i = 0; i < BASELENGTH; i++) {
base64Alphabet[i] = (byte) -1;
}
for (int i = 'Z'; i >= 'A'; i--) {
base64Alphabet[i] = (byte) (i - 'A');
}
for (int i = 'z'; i >= 'a'; i--) {
base64Alphabet[i] = (byte) (i - 'a' + 26);
}
for (int i = '9'; i >= '0'; i--) {
base64Alphabet[i] = (byte) (i - '0' + 52);
}
base64Alphabet['+'] = 62;
base64Alphabet['/'] = 63;
}
/**
* Decodes Base64 data into octects
*
* @param base64Data Byte array containing Base64 data
* @return Array containing decoded data.
*/
public static byte[] decodeBase64(byte[] base64Data) {
// RFC 2045 requires that we discard ALL non-Base64 characters
base64Data = discardNonBase64(base64Data);
// handle the edge case, so we don't have to worry about it later
if (base64Data.length == 0) {
return new byte[0];
}
int numberQuadruple = base64Data.length / FOURBYTE;
byte decodedData[] = null;
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0;
// Throw away anything not in base64Data
int encodedIndex = 0;
int dataIndex = 0;
{
// this sizes the output array properly - rlw
int lastData = base64Data.length;
// ignore the '=' padding
while (base64Data[lastData - 1] == PAD) {
if (--lastData == 0) {
return new byte[0];
}
}
decodedData = new byte[lastData - numberQuadruple];
}
for (int i = 0; i < numberQuadruple; i++) {
dataIndex = i * 4;
marker0 = base64Data[dataIndex + 2];
marker1 = base64Data[dataIndex + 3];
b1 = base64Alphabet[base64Data[dataIndex]];
b2 = base64Alphabet[base64Data[dataIndex + 1]];
if (marker0 != PAD && marker1 != PAD) {
//No PAD e.g 3cQl
b3 = base64Alphabet[marker0];
b4 = base64Alphabet[marker1];
decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
decodedData[encodedIndex + 1] =
(byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
decodedData[encodedIndex + 2] = (byte) (b3 << 6 | b4);
} else if (marker0 == PAD) {
//Two PAD e.g. 3c[Pad][Pad]
decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
} else if (marker1 == PAD) {
//One PAD e.g. 3cQ[Pad]
b3 = base64Alphabet[marker0];
decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
decodedData[encodedIndex + 1] =
(byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
}
encodedIndex += 3;
}
return decodedData;
}
/**
* Check octect wheter it is a base64 encoding.
*
* @param octect to be checked byte
* @return ture if it is base64 encoding, false otherwise.
*/
private static boolean isBase64(byte octect) {
if (octect == PAD) {
return true;
} else if (base64Alphabet[octect] == -1) {
return false;
} else {
return true;
}
}
/**
* Discards any characters outside of the base64 alphabet, per
* the requirements on page 25 of RFC 2045 - "Any characters
* outside of the base64 alphabet are to be ignored in base64
* encoded data."
*
* @param data The base-64 encoded data to groom
* @return The data, less non-base64 characters (see RFC 2045).
*/
static byte[] discardNonBase64(byte[] data) {
byte groomedData[] = new byte[data.length];
int bytesCopied = 0;
for (int i = 0; i < data.length; i++) {
if (isBase64(data[i])) {
groomedData[bytesCopied++] = data[i];
}
}
byte packedData[] = new byte[bytesCopied];
System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
return packedData;
}
}

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

@ -1,172 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
public class CharacterSets {
/**
* IANA assigned MIB enum numbers.
*
* From wap-230-wsp-20010705-a.pdf
* Any-charset = <Octet 128>
* Equivalent to the special RFC2616 charset value "*"
*/
public static final int ANY_CHARSET = 0x00;
public static final int US_ASCII = 0x03;
public static final int ISO_8859_1 = 0x04;
public static final int ISO_8859_2 = 0x05;
public static final int ISO_8859_3 = 0x06;
public static final int ISO_8859_4 = 0x07;
public static final int ISO_8859_5 = 0x08;
public static final int ISO_8859_6 = 0x09;
public static final int ISO_8859_7 = 0x0A;
public static final int ISO_8859_8 = 0x0B;
public static final int ISO_8859_9 = 0x0C;
public static final int SHIFT_JIS = 0x11;
public static final int UTF_8 = 0x6A;
public static final int BIG5 = 0x07EA;
public static final int UCS2 = 0x03E8;
public static final int UTF_16 = 0x03F7;
/**
* If the encoding of given data is unsupported, use UTF_8 to decode it.
*/
public static final int DEFAULT_CHARSET = UTF_8;
/**
* Array of MIB enum numbers.
*/
private static final int[] MIBENUM_NUMBERS = {
ANY_CHARSET,
US_ASCII,
ISO_8859_1,
ISO_8859_2,
ISO_8859_3,
ISO_8859_4,
ISO_8859_5,
ISO_8859_6,
ISO_8859_7,
ISO_8859_8,
ISO_8859_9,
SHIFT_JIS,
UTF_8,
BIG5,
UCS2,
UTF_16,
};
/**
* The Well-known-charset Mime name.
*/
public static final String MIMENAME_ANY_CHARSET = "*";
public static final String MIMENAME_US_ASCII = "us-ascii";
public static final String MIMENAME_ISO_8859_1 = "iso-8859-1";
public static final String MIMENAME_ISO_8859_2 = "iso-8859-2";
public static final String MIMENAME_ISO_8859_3 = "iso-8859-3";
public static final String MIMENAME_ISO_8859_4 = "iso-8859-4";
public static final String MIMENAME_ISO_8859_5 = "iso-8859-5";
public static final String MIMENAME_ISO_8859_6 = "iso-8859-6";
public static final String MIMENAME_ISO_8859_7 = "iso-8859-7";
public static final String MIMENAME_ISO_8859_8 = "iso-8859-8";
public static final String MIMENAME_ISO_8859_9 = "iso-8859-9";
public static final String MIMENAME_SHIFT_JIS = "shift_JIS";
public static final String MIMENAME_UTF_8 = "utf-8";
public static final String MIMENAME_BIG5 = "big5";
public static final String MIMENAME_UCS2 = "iso-10646-ucs-2";
public static final String MIMENAME_UTF_16 = "utf-16";
public static final String DEFAULT_CHARSET_NAME = MIMENAME_UTF_8;
/**
* Array of the names of character sets.
*/
private static final String[] MIME_NAMES = {
MIMENAME_ANY_CHARSET,
MIMENAME_US_ASCII,
MIMENAME_ISO_8859_1,
MIMENAME_ISO_8859_2,
MIMENAME_ISO_8859_3,
MIMENAME_ISO_8859_4,
MIMENAME_ISO_8859_5,
MIMENAME_ISO_8859_6,
MIMENAME_ISO_8859_7,
MIMENAME_ISO_8859_8,
MIMENAME_ISO_8859_9,
MIMENAME_SHIFT_JIS,
MIMENAME_UTF_8,
MIMENAME_BIG5,
MIMENAME_UCS2,
MIMENAME_UTF_16,
};
private static final HashMap<Integer, String> MIBENUM_TO_NAME_MAP;
private static final HashMap<String, Integer> NAME_TO_MIBENUM_MAP;
static {
// Create the HashMaps.
MIBENUM_TO_NAME_MAP = new HashMap<Integer, String>();
NAME_TO_MIBENUM_MAP = new HashMap<String, Integer>();
assert(MIBENUM_NUMBERS.length == MIME_NAMES.length);
int count = MIBENUM_NUMBERS.length - 1;
for(int i = 0; i <= count; i++) {
MIBENUM_TO_NAME_MAP.put(MIBENUM_NUMBERS[i], MIME_NAMES[i]);
NAME_TO_MIBENUM_MAP.put(MIME_NAMES[i], MIBENUM_NUMBERS[i]);
}
}
private CharacterSets() {} // Non-instantiatable
/**
* Map an MIBEnum number to the name of the charset which this number
* is assigned to by IANA.
*
* @param mibEnumValue An IANA assigned MIBEnum number.
* @return The name string of the charset.
* @throws UnsupportedEncodingException
*/
public static String getMimeName(int mibEnumValue)
throws UnsupportedEncodingException {
String name = MIBENUM_TO_NAME_MAP.get(mibEnumValue);
if (name == null) {
throw new UnsupportedEncodingException();
}
return name;
}
/**
* Map a well-known charset name to its assigned MIBEnum number.
*
* @param mimeName The charset name.
* @return The MIBEnum number assigned by IANA for this charset.
* @throws UnsupportedEncodingException
*/
public static int getMibEnumValue(String mimeName)
throws UnsupportedEncodingException {
if(null == mimeName) {
return -1;
}
Integer mibEnumValue = NAME_TO_MIBENUM_MAP.get(mimeName);
if (mibEnumValue == null) {
throw new UnsupportedEncodingException();
}
return mibEnumValue;
}
}

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

@ -1,138 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
/**
* M-Delivery.Ind Pdu.
*/
public class DeliveryInd extends GenericPdu {
/**
* Empty constructor.
* Since the Pdu corresponding to this class is constructed
* by the Proxy-Relay server, this class is only instantiated
* by the Pdu Parser.
*
* @throws InvalidHeaderValueException if error occurs.
*/
public DeliveryInd() throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_DELIVERY_IND);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
DeliveryInd(PduHeaders headers) {
super(headers);
}
/**
* Get Date value.
*
* @return the value
*/
public long getDate() {
return mPduHeaders.getLongInteger(PduHeaders.DATE);
}
/**
* Set Date value.
*
* @param value the value
*/
public void setDate(long value) {
mPduHeaders.setLongInteger(value, PduHeaders.DATE);
}
/**
* Get Message-ID value.
*
* @return the value
*/
public byte[] getMessageId() {
return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
}
/**
* Set Message-ID value.
*
* @param value the value, should not be null
* @throws NullPointerException if the value is null.
*/
public void setMessageId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
}
/**
* Get Status value.
*
* @return the value
*/
public int getStatus() {
return mPduHeaders.getOctet(PduHeaders.STATUS);
}
/**
* Set Status value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setStatus(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.STATUS);
}
/**
* Get To value.
*
* @return the value
*/
public EncodedStringValue[] getTo() {
return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
}
/**
* set To value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setTo(EncodedStringValue[] value) {
mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
}
/*
* Optional, not supported header fields:
*
* public byte[] getApplicId() {return null;}
* public void setApplicId(byte[] value) {}
*
* public byte[] getAuxApplicId() {return null;}
* public void getAuxApplicId(byte[] value) {}
*
* public byte[] getReplyApplicId() {return 0x00;}
* public void setReplyApplicId(byte[] value) {}
*
* public EncodedStringValue getStatusText() {return null;}
* public void setStatusText(EncodedStringValue value) {}
*/
}

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

@ -1,283 +0,0 @@
/*
* Copyright (C) 2007-2008 Esmertec AG.
* Copyright (C) 2007-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import android.util.Log;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
/**
* Encoded-string-value = Text-string | Value-length Char-set Text-string
*/
public class EncodedStringValue implements Cloneable {
private static final String TAG = "EncodedStringValue";
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
/**
* The Char-set value.
*/
private int mCharacterSet;
/**
* The Text-string value.
*/
private byte[] mData;
/**
* Constructor.
*
* @param charset the Char-set value
* @param data the Text-string value
* @throws NullPointerException if Text-string value is null.
*/
public EncodedStringValue(int charset, byte[] data) {
// TODO: CharSet needs to be validated against MIBEnum.
if(null == data) {
throw new NullPointerException("EncodedStringValue: Text-string is null.");
}
mCharacterSet = charset;
mData = new byte[data.length];
System.arraycopy(data, 0, mData, 0, data.length);
}
/**
* Constructor.
*
* @param data the Text-string value
* @throws NullPointerException if Text-string value is null.
*/
public EncodedStringValue(byte[] data) {
this(CharacterSets.DEFAULT_CHARSET, data);
}
public EncodedStringValue(String data) {
try {
mData = data.getBytes(CharacterSets.DEFAULT_CHARSET_NAME);
mCharacterSet = CharacterSets.DEFAULT_CHARSET;
} catch (UnsupportedEncodingException e) {
Log.e(TAG, "Default encoding must be supported.", e);
}
}
/**
* Get Char-set value.
*
* @return the value
*/
public int getCharacterSet() {
return mCharacterSet;
}
/**
* Set Char-set value.
*
* @param charset the Char-set value
*/
public void setCharacterSet(int charset) {
// TODO: CharSet needs to be validated against MIBEnum.
mCharacterSet = charset;
}
/**
* Get Text-string value.
*
* @return the value
*/
public byte[] getTextString() {
byte[] byteArray = new byte[mData.length];
System.arraycopy(mData, 0, byteArray, 0, mData.length);
return byteArray;
}
/**
* Set Text-string value.
*
* @param textString the Text-string value
* @throws NullPointerException if Text-string value is null.
*/
public void setTextString(byte[] textString) {
if(null == textString) {
throw new NullPointerException("EncodedStringValue: Text-string is null.");
}
mData = new byte[textString.length];
System.arraycopy(textString, 0, mData, 0, textString.length);
}
/**
* Convert this object to a {@link java.lang.String}. If the encoding of
* the EncodedStringValue is null or unsupported, it will be
* treated as iso-8859-1 encoding.
*
* @return The decoded String.
*/
public String getString() {
if (CharacterSets.ANY_CHARSET == mCharacterSet) {
return new String(mData); // system default encoding.
} else {
try {
String name = CharacterSets.getMimeName(mCharacterSet);
return new String(mData, name);
} catch (UnsupportedEncodingException e) {
if (LOCAL_LOGV) {
Log.v(TAG, e.getMessage(), e);
}
try {
return new String(mData, CharacterSets.MIMENAME_ISO_8859_1);
} catch (UnsupportedEncodingException ex) {
return new String(mData); // system default encoding.
}
}
}
}
/**
* Append to Text-string.
*
* @param textString the textString to append
* @throws NullPointerException if the text String is null
* or an IOException occured.
*/
public void appendTextString(byte[] textString) {
if(null == textString) {
throw new NullPointerException("Text-string is null.");
}
if(null == mData) {
mData = new byte[textString.length];
System.arraycopy(textString, 0, mData, 0, textString.length);
} else {
ByteArrayOutputStream newTextString = new ByteArrayOutputStream();
try {
newTextString.write(mData);
newTextString.write(textString);
} catch (IOException e) {
e.printStackTrace();
throw new NullPointerException(
"appendTextString: failed when write a new Text-string");
}
mData = newTextString.toByteArray();
}
}
/*
* (non-Javadoc)
* @see java.lang.Object#clone()
*/
@Override
public Object clone() throws CloneNotSupportedException {
super.clone();
int len = mData.length;
byte[] dstBytes = new byte[len];
System.arraycopy(mData, 0, dstBytes, 0, len);
try {
return new EncodedStringValue(mCharacterSet, dstBytes);
} catch (Exception e) {
Log.e(TAG, "failed to clone an EncodedStringValue: " + this);
e.printStackTrace();
throw new CloneNotSupportedException(e.getMessage());
}
}
/**
* Split this encoded string around matches of the given pattern.
*
* @param pattern the delimiting pattern
* @return the array of encoded strings computed by splitting this encoded
* string around matches of the given pattern
*/
public EncodedStringValue[] split(String pattern) {
String[] temp = getString().split(pattern);
EncodedStringValue[] ret = new EncodedStringValue[temp.length];
for (int i = 0; i < ret.length; ++i) {
try {
ret[i] = new EncodedStringValue(mCharacterSet,
temp[i].getBytes());
} catch (NullPointerException e) {
// Can't arrive here
return null;
}
}
return ret;
}
/**
* Extract an EncodedStringValue[] from a given String.
*/
public static EncodedStringValue[] extract(String src) {
String[] values = src.split(";");
ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
for (int i = 0; i < values.length; i++) {
if (values[i].length() > 0) {
list.add(new EncodedStringValue(values[i]));
}
}
int len = list.size();
if (len > 0) {
return list.toArray(new EncodedStringValue[len]);
} else {
return null;
}
}
/**
* Concatenate an EncodedStringValue[] into a single String.
*/
public static String concat(EncodedStringValue[] addr) {
StringBuilder sb = new StringBuilder();
int maxIndex = addr.length - 1;
for (int i = 0; i <= maxIndex; i++) {
sb.append(addr[i].getString());
if (i < maxIndex) {
sb.append(";");
}
}
return sb.toString();
}
public static EncodedStringValue copy(EncodedStringValue value) {
if (value == null) {
return null;
}
return new EncodedStringValue(value.mCharacterSet, value.mData);
}
public static EncodedStringValue[] encodeStrings(String[] array) {
int count = array.length;
if (count > 0) {
EncodedStringValue[] encodedArray = new EncodedStringValue[count];
for (int i = 0; i < count; i++) {
encodedArray[i] = new EncodedStringValue(array[i]);
}
return encodedArray;
}
return null;
}
}

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

@ -1,113 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
public class GenericPdu {
/**
* The headers of pdu.
*/
PduHeaders mPduHeaders = null;
/**
* Constructor.
*/
public GenericPdu() {
mPduHeaders = new PduHeaders();
}
/**
* Constructor.
*
* @param headers Headers for this PDU.
*/
GenericPdu(PduHeaders headers) {
mPduHeaders = headers;
}
/**
* Get the headers of this PDU.
*
* @return A PduHeaders of this PDU.
*/
PduHeaders getPduHeaders() {
return mPduHeaders;
}
/**
* Get X-Mms-Message-Type field value.
*
* @return the X-Mms-Report-Allowed value
*/
public int getMessageType() {
return mPduHeaders.getOctet(PduHeaders.MESSAGE_TYPE);
}
/**
* Set X-Mms-Message-Type field value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
* RuntimeException if field's value is not Octet.
*/
public void setMessageType(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.MESSAGE_TYPE);
}
/**
* Get X-Mms-MMS-Version field value.
*
* @return the X-Mms-MMS-Version value
*/
public int getMmsVersion() {
return mPduHeaders.getOctet(PduHeaders.MMS_VERSION);
}
/**
* Set X-Mms-MMS-Version field value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
* RuntimeException if field's value is not Octet.
*/
public void setMmsVersion(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.MMS_VERSION);
}
/**
* Get From value.
* From-value = Value-length
* (Address-present-token Encoded-string-value | Insert-address-token)
*
* @return the value
*/
public EncodedStringValue getFrom() {
return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
}
/**
* Set From value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setFrom(EncodedStringValue value) {
mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
}
}

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

@ -1,150 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
/**
* Multimedia message PDU.
*/
public class MultimediaMessagePdu extends GenericPdu{
/**
* The body.
*/
private PduBody mMessageBody;
/**
* Constructor.
*/
public MultimediaMessagePdu() {
super();
}
/**
* Constructor.
*
* @param header the header of this PDU
* @param body the body of this PDU
*/
public MultimediaMessagePdu(PduHeaders header, PduBody body) {
super(header);
mMessageBody = body;
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
MultimediaMessagePdu(PduHeaders headers) {
super(headers);
}
/**
* Get body of the PDU.
*
* @return the body
*/
public PduBody getBody() {
return mMessageBody;
}
/**
* Set body of the PDU.
*
* @param body the body
*/
public void setBody(PduBody body) {
mMessageBody = body;
}
/**
* Get subject.
*
* @return the value
*/
public EncodedStringValue getSubject() {
return mPduHeaders.getEncodedStringValue(PduHeaders.SUBJECT);
}
/**
* Set subject.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setSubject(EncodedStringValue value) {
mPduHeaders.setEncodedStringValue(value, PduHeaders.SUBJECT);
}
/**
* Get To value.
*
* @return the value
*/
public EncodedStringValue[] getTo() {
return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
}
/**
* Add a "To" value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void addTo(EncodedStringValue value) {
mPduHeaders.appendEncodedStringValue(value, PduHeaders.TO);
}
/**
* Get X-Mms-Priority value.
*
* @return the value
*/
public int getPriority() {
return mPduHeaders.getOctet(PduHeaders.PRIORITY);
}
/**
* Set X-Mms-Priority value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setPriority(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.PRIORITY);
}
/**
* Get Date value.
*
* @return the value
*/
public long getDate() {
return mPduHeaders.getLongInteger(PduHeaders.DATE);
}
/**
* Set Date value in seconds.
*
* @param value the value
*/
public void setDate(long value) {
mPduHeaders.setLongInteger(value, PduHeaders.DATE);
}
}

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

@ -1,285 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
/**
* M-Notification.ind PDU.
*/
public class NotificationInd extends GenericPdu {
/**
* Empty constructor.
* Since the Pdu corresponding to this class is constructed
* by the Proxy-Relay server, this class is only instantiated
* by the Pdu Parser.
*
* @throws InvalidHeaderValueException if error occurs.
* RuntimeException if an undeclared error occurs.
*/
public NotificationInd() throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
NotificationInd(PduHeaders headers) {
super(headers);
}
/**
* Get X-Mms-Content-Class Value.
*
* @return the value
*/
public int getContentClass() {
return mPduHeaders.getOctet(PduHeaders.CONTENT_CLASS);
}
/**
* Set X-Mms-Content-Class Value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
* RuntimeException if an undeclared error occurs.
*/
public void setContentClass(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.CONTENT_CLASS);
}
/**
* Get X-Mms-Content-Location value.
* When used in a PDU other than M-Mbox-Delete.conf and M-Delete.conf:
* Content-location-value = Uri-value
*
* @return the value
*/
public byte[] getContentLocation() {
return mPduHeaders.getTextString(PduHeaders.CONTENT_LOCATION);
}
/**
* Set X-Mms-Content-Location value.
*
* @param value the value
* @throws NullPointerException if the value is null.
* RuntimeException if an undeclared error occurs.
*/
public void setContentLocation(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.CONTENT_LOCATION);
}
/**
* Get X-Mms-Expiry value.
*
* Expiry-value = Value-length
* (Absolute-token Date-value | Relative-token Delta-seconds-value)
*
* @return the value
*/
public long getExpiry() {
return mPduHeaders.getLongInteger(PduHeaders.EXPIRY);
}
/**
* Set X-Mms-Expiry value.
*
* @param value the value
* @throws RuntimeException if an undeclared error occurs.
*/
public void setExpiry(long value) {
mPduHeaders.setLongInteger(value, PduHeaders.EXPIRY);
}
/**
* Get From value.
* From-value = Value-length
* (Address-present-token Encoded-string-value | Insert-address-token)
*
* @return the value
*/
public EncodedStringValue getFrom() {
return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
}
/**
* Set From value.
*
* @param value the value
* @throws NullPointerException if the value is null.
* RuntimeException if an undeclared error occurs.
*/
public void setFrom(EncodedStringValue value) {
mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
}
/**
* Get X-Mms-Message-Class value.
* Message-class-value = Class-identifier | Token-text
* Class-identifier = Personal | Advertisement | Informational | Auto
*
* @return the value
*/
public byte[] getMessageClass() {
return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS);
}
/**
* Set X-Mms-Message-Class value.
*
* @param value the value
* @throws NullPointerException if the value is null.
* RuntimeException if an undeclared error occurs.
*/
public void setMessageClass(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS);
}
/**
* Get X-Mms-Message-Size value.
* Message-size-value = Long-integer
*
* @return the value
*/
public long getMessageSize() {
return mPduHeaders.getLongInteger(PduHeaders.MESSAGE_SIZE);
}
/**
* Set X-Mms-Message-Size value.
*
* @param value the value
* @throws RuntimeException if an undeclared error occurs.
*/
public void setMessageSize(long value) {
mPduHeaders.setLongInteger(value, PduHeaders.MESSAGE_SIZE);
}
/**
* Get subject.
*
* @return the value
*/
public EncodedStringValue getSubject() {
return mPduHeaders.getEncodedStringValue(PduHeaders.SUBJECT);
}
/**
* Set subject.
*
* @param value the value
* @throws NullPointerException if the value is null.
* RuntimeException if an undeclared error occurs.
*/
public void setSubject(EncodedStringValue value) {
mPduHeaders.setEncodedStringValue(value, PduHeaders.SUBJECT);
}
/**
* Get X-Mms-Transaction-Id.
*
* @return the value
*/
public byte[] getTransactionId() {
return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
}
/**
* Set X-Mms-Transaction-Id.
*
* @param value the value
* @throws NullPointerException if the value is null.
* RuntimeException if an undeclared error occurs.
*/
public void setTransactionId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
}
/**
* Get X-Mms-Delivery-Report Value.
*
* @return the value
*/
public int getDeliveryReport() {
return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT);
}
/**
* Set X-Mms-Delivery-Report Value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
* RuntimeException if an undeclared error occurs.
*/
public void setDeliveryReport(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT);
}
/*
* Optional, not supported header fields:
*
* public byte[] getApplicId() {return null;}
* public void setApplicId(byte[] value) {}
*
* public byte[] getAuxApplicId() {return null;}
* public void getAuxApplicId(byte[] value) {}
*
* public byte getDrmContent() {return 0x00;}
* public void setDrmContent(byte value) {}
*
* public byte getDistributionIndicator() {return 0x00;}
* public void setDistributionIndicator(byte value) {}
*
* public ElementDescriptorValue getElementDescriptor() {return null;}
* public void getElementDescriptor(ElementDescriptorValue value) {}
*
* public byte getPriority() {return 0x00;}
* public void setPriority(byte value) {}
*
* public byte getRecommendedRetrievalMode() {return 0x00;}
* public void setRecommendedRetrievalMode(byte value) {}
*
* public byte getRecommendedRetrievalModeText() {return 0x00;}
* public void setRecommendedRetrievalModeText(byte value) {}
*
* public byte[] getReplaceId() {return 0x00;}
* public void setReplaceId(byte[] value) {}
*
* public byte[] getReplyApplicId() {return 0x00;}
* public void setReplyApplicId(byte[] value) {}
*
* public byte getReplyCharging() {return 0x00;}
* public void setReplyCharging(byte value) {}
*
* public byte getReplyChargingDeadline() {return 0x00;}
* public void setReplyChargingDeadline(byte value) {}
*
* public byte[] getReplyChargingId() {return 0x00;}
* public void setReplyChargingId(byte[] value) {}
*
* public long getReplyChargingSize() {return 0;}
* public void setReplyChargingSize(long value) {}
*
* public byte getStored() {return 0x00;}
* public void setStored(byte value) {}
*/
}

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

@ -1,114 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
/**
* M-NofifyResp.ind PDU.
*/
public class NotifyRespInd extends GenericPdu {
/**
* Constructor, used when composing a M-NotifyResp.ind pdu.
*
* @param mmsVersion current version of mms
* @param transactionId the transaction-id value
* @param status the status value
* @throws InvalidHeaderValueException if parameters are invalid.
* NullPointerException if transactionId is null.
* RuntimeException if an undeclared error occurs.
*/
public NotifyRespInd(int mmsVersion,
byte[] transactionId,
int status) throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND);
setMmsVersion(mmsVersion);
setTransactionId(transactionId);
setStatus(status);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
NotifyRespInd(PduHeaders headers) {
super(headers);
}
/**
* Get X-Mms-Report-Allowed field value.
*
* @return the X-Mms-Report-Allowed value
*/
public int getReportAllowed() {
return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED);
}
/**
* Set X-Mms-Report-Allowed field value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
* RuntimeException if an undeclared error occurs.
*/
public void setReportAllowed(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED);
}
/**
* Set X-Mms-Status field value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
* RuntimeException if an undeclared error occurs.
*/
public void setStatus(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.STATUS);
}
/**
* GetX-Mms-Status field value.
*
* @return the X-Mms-Status value
*/
public int getStatus() {
return mPduHeaders.getOctet(PduHeaders.STATUS);
}
/**
* Get X-Mms-Transaction-Id field value.
*
* @return the X-Mms-Report-Allowed value
*/
public byte[] getTransactionId() {
return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
}
/**
* Set X-Mms-Transaction-Id field value.
*
* @param value the value
* @throws NullPointerException if the value is null.
* RuntimeException if an undeclared error occurs.
*/
public void setTransactionId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
}
}

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

@ -1,191 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
public class PduBody {
private Vector<PduPart> mParts = null;
private Map<String, PduPart> mPartMapByContentId = null;
private Map<String, PduPart> mPartMapByContentLocation = null;
private Map<String, PduPart> mPartMapByName = null;
private Map<String, PduPart> mPartMapByFileName = null;
/**
* Constructor.
*/
public PduBody() {
mParts = new Vector<PduPart>();
mPartMapByContentId = new HashMap<String, PduPart>();
mPartMapByContentLocation = new HashMap<String, PduPart>();
mPartMapByName = new HashMap<String, PduPart>();
mPartMapByFileName = new HashMap<String, PduPart>();
}
private void putPartToMaps(PduPart part) {
// Put part to mPartMapByContentId.
byte[] contentId = part.getContentId();
if(null != contentId) {
mPartMapByContentId.put(new String(contentId), part);
}
// Put part to mPartMapByContentLocation.
byte[] contentLocation = part.getContentLocation();
if(null != contentLocation) {
String clc = new String(contentLocation);
mPartMapByContentLocation.put(clc, part);
}
// Put part to mPartMapByName.
byte[] name = part.getName();
if(null != name) {
String clc = new String(name);
mPartMapByName.put(clc, part);
}
// Put part to mPartMapByFileName.
byte[] fileName = part.getFilename();
if(null != fileName) {
String clc = new String(fileName);
mPartMapByFileName.put(clc, part);
}
}
/**
* Appends the specified part to the end of this body.
*
* @param part part to be appended
* @return true when success, false when fail
* @throws NullPointerException when part is null
*/
public boolean addPart(PduPart part) {
if(null == part) {
throw new NullPointerException();
}
putPartToMaps(part);
return mParts.add(part);
}
/**
* Inserts the specified part at the specified position.
*
* @param index index at which the specified part is to be inserted
* @param part part to be inserted
* @throws NullPointerException when part is null
*/
public void addPart(int index, PduPart part) {
if(null == part) {
throw new NullPointerException();
}
putPartToMaps(part);
mParts.add(index, part);
}
/**
* Removes the part at the specified position.
*
* @param index index of the part to return
* @return part at the specified index
*/
public PduPart removePart(int index) {
return mParts.remove(index);
}
/**
* Remove all of the parts.
*/
public void removeAll() {
mParts.clear();
}
/**
* Get the part at the specified position.
*
* @param index index of the part to return
* @return part at the specified index
*/
public PduPart getPart(int index) {
return mParts.get(index);
}
/**
* Get the index of the specified part.
*
* @param part the part object
* @return index the index of the first occurrence of the part in this body
*/
public int getPartIndex(PduPart part) {
return mParts.indexOf(part);
}
/**
* Get the number of parts.
*
* @return the number of parts
*/
public int getPartsNum() {
return mParts.size();
}
/**
* Get pdu part by content id.
*
* @param cid the value of content id.
* @return the pdu part.
*/
public PduPart getPartByContentId(String cid) {
return mPartMapByContentId.get(cid);
}
/**
* Get pdu part by Content-Location. Content-Location of part is
* the same as filename and name(param of content-type).
*
* @param fileName the value of filename.
* @return the pdu part.
*/
public PduPart getPartByContentLocation(String contentLocation) {
return mPartMapByContentLocation.get(contentLocation);
}
/**
* Get pdu part by name.
*
* @param fileName the value of filename.
* @return the pdu part.
*/
public PduPart getPartByName(String name) {
return mPartMapByName.get(name);
}
/**
* Get pdu part by filename.
*
* @param fileName the value of filename.
* @return the pdu part.
*/
public PduPart getPartByFileName(String filename) {
return mPartMapByFileName.get(filename);
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,110 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
public class PduContentTypes {
/**
* All content types. From:
* http://www.openmobilealliance.org/tech/omna/omna-wsp-content-type.htm
*/
static final String[] contentTypes = {
"*/*", /* 0x00 */
"text/*", /* 0x01 */
"text/html", /* 0x02 */
"text/plain", /* 0x03 */
"text/x-hdml", /* 0x04 */
"text/x-ttml", /* 0x05 */
"text/x-vCalendar", /* 0x06 */
"text/x-vCard", /* 0x07 */
"text/vnd.wap.wml", /* 0x08 */
"text/vnd.wap.wmlscript", /* 0x09 */
"text/vnd.wap.wta-event", /* 0x0A */
"multipart/*", /* 0x0B */
"multipart/mixed", /* 0x0C */
"multipart/form-data", /* 0x0D */
"multipart/byterantes", /* 0x0E */
"multipart/alternative", /* 0x0F */
"application/*", /* 0x10 */
"application/java-vm", /* 0x11 */
"application/x-www-form-urlencoded", /* 0x12 */
"application/x-hdmlc", /* 0x13 */
"application/vnd.wap.wmlc", /* 0x14 */
"application/vnd.wap.wmlscriptc", /* 0x15 */
"application/vnd.wap.wta-eventc", /* 0x16 */
"application/vnd.wap.uaprof", /* 0x17 */
"application/vnd.wap.wtls-ca-certificate", /* 0x18 */
"application/vnd.wap.wtls-user-certificate", /* 0x19 */
"application/x-x509-ca-cert", /* 0x1A */
"application/x-x509-user-cert", /* 0x1B */
"image/*", /* 0x1C */
"image/gif", /* 0x1D */
"image/jpeg", /* 0x1E */
"image/tiff", /* 0x1F */
"image/png", /* 0x20 */
"image/vnd.wap.wbmp", /* 0x21 */
"application/vnd.wap.multipart.*", /* 0x22 */
"application/vnd.wap.multipart.mixed", /* 0x23 */
"application/vnd.wap.multipart.form-data", /* 0x24 */
"application/vnd.wap.multipart.byteranges", /* 0x25 */
"application/vnd.wap.multipart.alternative", /* 0x26 */
"application/xml", /* 0x27 */
"text/xml", /* 0x28 */
"application/vnd.wap.wbxml", /* 0x29 */
"application/x-x968-cross-cert", /* 0x2A */
"application/x-x968-ca-cert", /* 0x2B */
"application/x-x968-user-cert", /* 0x2C */
"text/vnd.wap.si", /* 0x2D */
"application/vnd.wap.sic", /* 0x2E */
"text/vnd.wap.sl", /* 0x2F */
"application/vnd.wap.slc", /* 0x30 */
"text/vnd.wap.co", /* 0x31 */
"application/vnd.wap.coc", /* 0x32 */
"application/vnd.wap.multipart.related", /* 0x33 */
"application/vnd.wap.sia", /* 0x34 */
"text/vnd.wap.connectivity-xml", /* 0x35 */
"application/vnd.wap.connectivity-wbxml", /* 0x36 */
"application/pkcs7-mime", /* 0x37 */
"application/vnd.wap.hashed-certificate", /* 0x38 */
"application/vnd.wap.signed-certificate", /* 0x39 */
"application/vnd.wap.cert-response", /* 0x3A */
"application/xhtml+xml", /* 0x3B */
"application/wml+xml", /* 0x3C */
"text/css", /* 0x3D */
"application/vnd.wap.mms-message", /* 0x3E */
"application/vnd.wap.rollover-certificate", /* 0x3F */
"application/vnd.wap.locc+wbxml", /* 0x40 */
"application/vnd.wap.loc+xml", /* 0x41 */
"application/vnd.syncml.dm+wbxml", /* 0x42 */
"application/vnd.syncml.dm+xml", /* 0x43 */
"application/vnd.syncml.notification", /* 0x44 */
"application/vnd.wap.xhtml+xml", /* 0x45 */
"application/vnd.wv.csp.cir", /* 0x46 */
"application/vnd.oma.dd+xml", /* 0x47 */
"application/vnd.oma.drm.message", /* 0x48 */
"application/vnd.oma.drm.content", /* 0x49 */
"application/vnd.oma.drm.rights+xml", /* 0x4A */
"application/vnd.oma.drm.rights+wbxml", /* 0x4B */
"application/vnd.wv.csp+xml", /* 0x4C */
"application/vnd.wv.csp+wbxml", /* 0x4D */
"application/vnd.syncml.ds.notification", /* 0x4E */
"audio/*", /* 0x4F */
"video/*", /* 0x50 */
"application/vnd.oma.dd2+xml", /* 0x51 */
"application/mikey" /* 0x52 */
};
}

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

@ -1,721 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
import java.util.ArrayList;
import java.util.HashMap;
public class PduHeaders {
/**
* All pdu header fields.
*/
public static final int BCC = 0x81;
public static final int CC = 0x82;
public static final int CONTENT_LOCATION = 0x83;
public static final int CONTENT_TYPE = 0x84;
public static final int DATE = 0x85;
public static final int DELIVERY_REPORT = 0x86;
public static final int DELIVERY_TIME = 0x87;
public static final int EXPIRY = 0x88;
public static final int FROM = 0x89;
public static final int MESSAGE_CLASS = 0x8A;
public static final int MESSAGE_ID = 0x8B;
public static final int MESSAGE_TYPE = 0x8C;
public static final int MMS_VERSION = 0x8D;
public static final int MESSAGE_SIZE = 0x8E;
public static final int PRIORITY = 0x8F;
public static final int READ_REPLY = 0x90;
public static final int READ_REPORT = 0x90;
public static final int REPORT_ALLOWED = 0x91;
public static final int RESPONSE_STATUS = 0x92;
public static final int RESPONSE_TEXT = 0x93;
public static final int SENDER_VISIBILITY = 0x94;
public static final int STATUS = 0x95;
public static final int SUBJECT = 0x96;
public static final int TO = 0x97;
public static final int TRANSACTION_ID = 0x98;
public static final int RETRIEVE_STATUS = 0x99;
public static final int RETRIEVE_TEXT = 0x9A;
public static final int READ_STATUS = 0x9B;
public static final int REPLY_CHARGING = 0x9C;
public static final int REPLY_CHARGING_DEADLINE = 0x9D;
public static final int REPLY_CHARGING_ID = 0x9E;
public static final int REPLY_CHARGING_SIZE = 0x9F;
public static final int PREVIOUSLY_SENT_BY = 0xA0;
public static final int PREVIOUSLY_SENT_DATE = 0xA1;
public static final int STORE = 0xA2;
public static final int MM_STATE = 0xA3;
public static final int MM_FLAGS = 0xA4;
public static final int STORE_STATUS = 0xA5;
public static final int STORE_STATUS_TEXT = 0xA6;
public static final int STORED = 0xA7;
public static final int ATTRIBUTES = 0xA8;
public static final int TOTALS = 0xA9;
public static final int MBOX_TOTALS = 0xAA;
public static final int QUOTAS = 0xAB;
public static final int MBOX_QUOTAS = 0xAC;
public static final int MESSAGE_COUNT = 0xAD;
public static final int CONTENT = 0xAE;
public static final int START = 0xAF;
public static final int ADDITIONAL_HEADERS = 0xB0;
public static final int DISTRIBUTION_INDICATOR = 0xB1;
public static final int ELEMENT_DESCRIPTOR = 0xB2;
public static final int LIMIT = 0xB3;
public static final int RECOMMENDED_RETRIEVAL_MODE = 0xB4;
public static final int RECOMMENDED_RETRIEVAL_MODE_TEXT = 0xB5;
public static final int STATUS_TEXT = 0xB6;
public static final int APPLIC_ID = 0xB7;
public static final int REPLY_APPLIC_ID = 0xB8;
public static final int AUX_APPLIC_ID = 0xB9;
public static final int CONTENT_CLASS = 0xBA;
public static final int DRM_CONTENT = 0xBB;
public static final int ADAPTATION_ALLOWED = 0xBC;
public static final int REPLACE_ID = 0xBD;
public static final int CANCEL_ID = 0xBE;
public static final int CANCEL_STATUS = 0xBF;
/**
* X-Mms-Message-Type field types.
*/
public static final int MESSAGE_TYPE_SEND_REQ = 0x80;
public static final int MESSAGE_TYPE_SEND_CONF = 0x81;
public static final int MESSAGE_TYPE_NOTIFICATION_IND = 0x82;
public static final int MESSAGE_TYPE_NOTIFYRESP_IND = 0x83;
public static final int MESSAGE_TYPE_RETRIEVE_CONF = 0x84;
public static final int MESSAGE_TYPE_ACKNOWLEDGE_IND = 0x85;
public static final int MESSAGE_TYPE_DELIVERY_IND = 0x86;
public static final int MESSAGE_TYPE_READ_REC_IND = 0x87;
public static final int MESSAGE_TYPE_READ_ORIG_IND = 0x88;
public static final int MESSAGE_TYPE_FORWARD_REQ = 0x89;
public static final int MESSAGE_TYPE_FORWARD_CONF = 0x8A;
public static final int MESSAGE_TYPE_MBOX_STORE_REQ = 0x8B;
public static final int MESSAGE_TYPE_MBOX_STORE_CONF = 0x8C;
public static final int MESSAGE_TYPE_MBOX_VIEW_REQ = 0x8D;
public static final int MESSAGE_TYPE_MBOX_VIEW_CONF = 0x8E;
public static final int MESSAGE_TYPE_MBOX_UPLOAD_REQ = 0x8F;
public static final int MESSAGE_TYPE_MBOX_UPLOAD_CONF = 0x90;
public static final int MESSAGE_TYPE_MBOX_DELETE_REQ = 0x91;
public static final int MESSAGE_TYPE_MBOX_DELETE_CONF = 0x92;
public static final int MESSAGE_TYPE_MBOX_DESCR = 0x93;
public static final int MESSAGE_TYPE_DELETE_REQ = 0x94;
public static final int MESSAGE_TYPE_DELETE_CONF = 0x95;
public static final int MESSAGE_TYPE_CANCEL_REQ = 0x96;
public static final int MESSAGE_TYPE_CANCEL_CONF = 0x97;
/**
* X-Mms-Delivery-Report |
* X-Mms-Read-Report |
* X-Mms-Report-Allowed |
* X-Mms-Sender-Visibility |
* X-Mms-Store |
* X-Mms-Stored |
* X-Mms-Totals |
* X-Mms-Quotas |
* X-Mms-Distribution-Indicator |
* X-Mms-DRM-Content |
* X-Mms-Adaptation-Allowed |
* field types.
*/
public static final int VALUE_YES = 0x80;
public static final int VALUE_NO = 0x81;
/**
* Delivery-Time |
* Expiry and Reply-Charging-Deadline |
* field type components.
*/
public static final int VALUE_ABSOLUTE_TOKEN = 0x80;
public static final int VALUE_RELATIVE_TOKEN = 0x81;
/**
* X-Mms-MMS-Version field types.
*/
public static final int MMS_VERSION_1_3 = ((1 << 4) | 3);
public static final int MMS_VERSION_1_2 = ((1 << 4) | 2);
public static final int MMS_VERSION_1_1 = ((1 << 4) | 1);
public static final int MMS_VERSION_1_0 = ((1 << 4) | 0);
// Current version is 1.2.
public static final int CURRENT_MMS_VERSION = MMS_VERSION_1_2;
/**
* From field type components.
*/
public static final int FROM_ADDRESS_PRESENT_TOKEN = 0x80;
public static final int FROM_INSERT_ADDRESS_TOKEN = 0x81;
public static final String FROM_ADDRESS_PRESENT_TOKEN_STR = "address-present-token";
public static final String FROM_INSERT_ADDRESS_TOKEN_STR = "insert-address-token";
/**
* X-Mms-Status Field.
*/
public static final int STATUS_EXPIRED = 0x80;
public static final int STATUS_RETRIEVED = 0x81;
public static final int STATUS_REJECTED = 0x82;
public static final int STATUS_DEFERRED = 0x83;
public static final int STATUS_UNRECOGNIZED = 0x84;
public static final int STATUS_INDETERMINATE = 0x85;
public static final int STATUS_FORWARDED = 0x86;
public static final int STATUS_UNREACHABLE = 0x87;
/**
* MM-Flags field type components.
*/
public static final int MM_FLAGS_ADD_TOKEN = 0x80;
public static final int MM_FLAGS_REMOVE_TOKEN = 0x81;
public static final int MM_FLAGS_FILTER_TOKEN = 0x82;
/**
* X-Mms-Message-Class field types.
*/
public static final int MESSAGE_CLASS_PERSONAL = 0x80;
public static final int MESSAGE_CLASS_ADVERTISEMENT = 0x81;
public static final int MESSAGE_CLASS_INFORMATIONAL = 0x82;
public static final int MESSAGE_CLASS_AUTO = 0x83;
public static final String MESSAGE_CLASS_PERSONAL_STR = "personal";
public static final String MESSAGE_CLASS_ADVERTISEMENT_STR = "advertisement";
public static final String MESSAGE_CLASS_INFORMATIONAL_STR = "informational";
public static final String MESSAGE_CLASS_AUTO_STR = "auto";
/**
* X-Mms-Priority field types.
*/
public static final int PRIORITY_LOW = 0x80;
public static final int PRIORITY_NORMAL = 0x81;
public static final int PRIORITY_HIGH = 0x82;
/**
* X-Mms-Response-Status field types.
*/
public static final int RESPONSE_STATUS_OK = 0x80;
public static final int RESPONSE_STATUS_ERROR_UNSPECIFIED = 0x81;
public static final int RESPONSE_STATUS_ERROR_SERVICE_DENIED = 0x82;
public static final int RESPONSE_STATUS_ERROR_MESSAGE_FORMAT_CORRUPT = 0x83;
public static final int RESPONSE_STATUS_ERROR_SENDING_ADDRESS_UNRESOLVED = 0x84;
public static final int RESPONSE_STATUS_ERROR_MESSAGE_NOT_FOUND = 0x85;
public static final int RESPONSE_STATUS_ERROR_NETWORK_PROBLEM = 0x86;
public static final int RESPONSE_STATUS_ERROR_CONTENT_NOT_ACCEPTED = 0x87;
public static final int RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE = 0x88;
public static final int RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0;
public static final int RESPONSE_STATUS_ERROR_TRANSIENT_SENDNG_ADDRESS_UNRESOLVED = 0xC1;
public static final int RESPONSE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND = 0xC2;
public static final int RESPONSE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC3;
public static final int RESPONSE_STATUS_ERROR_TRANSIENT_PARTIAL_SUCCESS = 0xC4;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 0xE2;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED = 0xE3;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE4;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED = 0xE5;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET = 0xE6;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED = 0xE6;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED = 0xE8;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED = 0xE9;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_ADDRESS_HIDING_NOT_SUPPORTED = 0xEA;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID = 0xEB;
public static final int RESPONSE_STATUS_ERROR_PERMANENT_END = 0xFF;
/**
* X-Mms-Retrieve-Status field types.
*/
public static final int RETRIEVE_STATUS_OK = 0x80;
public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0;
public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND = 0xC1;
public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC2;
public static final int RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0;
public static final int RETRIEVE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1;
public static final int RETRIEVE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE2;
public static final int RETRIEVE_STATUS_ERROR_PERMANENT_CONTENT_UNSUPPORTED = 0xE3;
public static final int RETRIEVE_STATUS_ERROR_END = 0xFF;
/**
* X-Mms-Sender-Visibility field types.
*/
public static final int SENDER_VISIBILITY_HIDE = 0x80;
public static final int SENDER_VISIBILITY_SHOW = 0x81;
/**
* X-Mms-Read-Status field types.
*/
public static final int READ_STATUS_READ = 0x80;
public static final int READ_STATUS__DELETED_WITHOUT_BEING_READ = 0x81;
/**
* X-Mms-Cancel-Status field types.
*/
public static final int CANCEL_STATUS_REQUEST_SUCCESSFULLY_RECEIVED = 0x80;
public static final int CANCEL_STATUS_REQUEST_CORRUPTED = 0x81;
/**
* X-Mms-Reply-Charging field types.
*/
public static final int REPLY_CHARGING_REQUESTED = 0x80;
public static final int REPLY_CHARGING_REQUESTED_TEXT_ONLY = 0x81;
public static final int REPLY_CHARGING_ACCEPTED = 0x82;
public static final int REPLY_CHARGING_ACCEPTED_TEXT_ONLY = 0x83;
/**
* X-Mms-MM-State field types.
*/
public static final int MM_STATE_DRAFT = 0x80;
public static final int MM_STATE_SENT = 0x81;
public static final int MM_STATE_NEW = 0x82;
public static final int MM_STATE_RETRIEVED = 0x83;
public static final int MM_STATE_FORWARDED = 0x84;
/**
* X-Mms-Recommended-Retrieval-Mode field types.
*/
public static final int RECOMMENDED_RETRIEVAL_MODE_MANUAL = 0x80;
/**
* X-Mms-Content-Class field types.
*/
public static final int CONTENT_CLASS_TEXT = 0x80;
public static final int CONTENT_CLASS_IMAGE_BASIC = 0x81;
public static final int CONTENT_CLASS_IMAGE_RICH = 0x82;
public static final int CONTENT_CLASS_VIDEO_BASIC = 0x83;
public static final int CONTENT_CLASS_VIDEO_RICH = 0x84;
public static final int CONTENT_CLASS_MEGAPIXEL = 0x85;
public static final int CONTENT_CLASS_CONTENT_BASIC = 0x86;
public static final int CONTENT_CLASS_CONTENT_RICH = 0x87;
/**
* X-Mms-Store-Status field types.
*/
public static final int STORE_STATUS_SUCCESS = 0x80;
public static final int STORE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0;
public static final int STORE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC1;
public static final int STORE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0;
public static final int STORE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1;
public static final int STORE_STATUS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 0xE2;
public static final int STORE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE3;
public static final int STORE_STATUS_ERROR_PERMANENT_MMBOX_FULL = 0xE4;
public static final int STORE_STATUS_ERROR_END = 0xFF;
/**
* The map contains the value of all headers.
*/
private HashMap<Integer, Object> mHeaderMap = null;
/**
* Constructor of PduHeaders.
*/
public PduHeaders() {
mHeaderMap = new HashMap<Integer, Object>();
}
/**
* Get octet value by header field.
*
* @param field the field
* @return the octet value of the pdu header
* with specified header field. Return 0 if
* the value is not set.
*/
protected int getOctet(int field) {
Integer octet = (Integer) mHeaderMap.get(field);
if (null == octet) {
return 0;
}
return octet;
}
/**
* Set octet value to pdu header by header field.
*
* @param value the value
* @param field the field
* @throws InvalidHeaderValueException if the value is invalid.
*/
protected void setOctet(int value, int field)
throws InvalidHeaderValueException{
/**
* Check whether this field can be set for specific
* header and check validity of the field.
*/
switch (field) {
case REPORT_ALLOWED:
case ADAPTATION_ALLOWED:
case DELIVERY_REPORT:
case DRM_CONTENT:
case DISTRIBUTION_INDICATOR:
case QUOTAS:
case READ_REPORT:
case STORE:
case STORED:
case TOTALS:
case SENDER_VISIBILITY:
if ((VALUE_YES != value) && (VALUE_NO != value)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case READ_STATUS:
if ((READ_STATUS_READ != value) &&
(READ_STATUS__DELETED_WITHOUT_BEING_READ != value)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case CANCEL_STATUS:
if ((CANCEL_STATUS_REQUEST_SUCCESSFULLY_RECEIVED != value) &&
(CANCEL_STATUS_REQUEST_CORRUPTED != value)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case PRIORITY:
if ((value < PRIORITY_LOW) || (value > PRIORITY_HIGH)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case STATUS:
if ((value < STATUS_EXPIRED) || (value > STATUS_UNREACHABLE)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case REPLY_CHARGING:
if ((value < REPLY_CHARGING_REQUESTED)
|| (value > REPLY_CHARGING_ACCEPTED_TEXT_ONLY)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case MM_STATE:
if ((value < MM_STATE_DRAFT) || (value > MM_STATE_FORWARDED)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case RECOMMENDED_RETRIEVAL_MODE:
if (RECOMMENDED_RETRIEVAL_MODE_MANUAL != value) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case CONTENT_CLASS:
if ((value < CONTENT_CLASS_TEXT)
|| (value > CONTENT_CLASS_CONTENT_RICH)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
case RETRIEVE_STATUS:
// According to oma-ts-mms-enc-v1_3, section 7.3.50, we modify the invalid value.
if ((value > RETRIEVE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM) &&
(value < RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE)) {
value = RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE;
} else if ((value > RETRIEVE_STATUS_ERROR_PERMANENT_CONTENT_UNSUPPORTED) &&
(value <= RETRIEVE_STATUS_ERROR_END)) {
value = RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE;
} else if ((value < RETRIEVE_STATUS_OK) ||
((value > RETRIEVE_STATUS_OK) &&
(value < RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
(value > RETRIEVE_STATUS_ERROR_END)) {
value = RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE;
}
break;
case STORE_STATUS:
// According to oma-ts-mms-enc-v1_3, section 7.3.58, we modify the invalid value.
if ((value > STORE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM) &&
(value < STORE_STATUS_ERROR_PERMANENT_FAILURE)) {
value = STORE_STATUS_ERROR_TRANSIENT_FAILURE;
} else if ((value > STORE_STATUS_ERROR_PERMANENT_MMBOX_FULL) &&
(value <= STORE_STATUS_ERROR_END)) {
value = STORE_STATUS_ERROR_PERMANENT_FAILURE;
} else if ((value < STORE_STATUS_SUCCESS) ||
((value > STORE_STATUS_SUCCESS) &&
(value < STORE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
(value > STORE_STATUS_ERROR_END)) {
value = STORE_STATUS_ERROR_PERMANENT_FAILURE;
}
break;
case RESPONSE_STATUS:
// According to oma-ts-mms-enc-v1_3, section 7.3.48, we modify the invalid value.
if ((value > RESPONSE_STATUS_ERROR_TRANSIENT_PARTIAL_SUCCESS) &&
(value < RESPONSE_STATUS_ERROR_PERMANENT_FAILURE)) {
value = RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE;
} else if (((value > RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID) &&
(value <= RESPONSE_STATUS_ERROR_PERMANENT_END)) ||
(value < RESPONSE_STATUS_OK) ||
((value > RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE) &&
(value < RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
(value > RESPONSE_STATUS_ERROR_PERMANENT_END)) {
value = RESPONSE_STATUS_ERROR_PERMANENT_FAILURE;
}
break;
case MMS_VERSION:
if ((value < MMS_VERSION_1_0)|| (value > MMS_VERSION_1_3)) {
value = CURRENT_MMS_VERSION; // Current version is the default value.
}
break;
case MESSAGE_TYPE:
if ((value < MESSAGE_TYPE_SEND_REQ) || (value > MESSAGE_TYPE_CANCEL_CONF)) {
// Invalid value.
throw new InvalidHeaderValueException("Invalid Octet value!");
}
break;
default:
// This header value should not be Octect.
throw new RuntimeException("Invalid header field!");
}
mHeaderMap.put(field, value);
}
/**
* Get TextString value by header field.
*
* @param field the field
* @return the TextString value of the pdu header
* with specified header field
*/
protected byte[] getTextString(int field) {
return (byte[]) mHeaderMap.get(field);
}
/**
* Set TextString value to pdu header by header field.
*
* @param value the value
* @param field the field
* @return the TextString value of the pdu header
* with specified header field
* @throws NullPointerException if the value is null.
*/
protected void setTextString(byte[] value, int field) {
/**
* Check whether this field can be set for specific
* header and check validity of the field.
*/
if (null == value) {
throw new NullPointerException();
}
switch (field) {
case TRANSACTION_ID:
case REPLY_CHARGING_ID:
case AUX_APPLIC_ID:
case APPLIC_ID:
case REPLY_APPLIC_ID:
case MESSAGE_ID:
case REPLACE_ID:
case CANCEL_ID:
case CONTENT_LOCATION:
case MESSAGE_CLASS:
case CONTENT_TYPE:
break;
default:
// This header value should not be Text-String.
throw new RuntimeException("Invalid header field!");
}
mHeaderMap.put(field, value);
}
/**
* Get EncodedStringValue value by header field.
*
* @param field the field
* @return the EncodedStringValue value of the pdu header
* with specified header field
*/
protected EncodedStringValue getEncodedStringValue(int field) {
return (EncodedStringValue) mHeaderMap.get(field);
}
/**
* Get TO, CC or BCC header value.
*
* @param field the field
* @return the EncodeStringValue array of the pdu header
* with specified header field
*/
protected EncodedStringValue[] getEncodedStringValues(int field) {
ArrayList<EncodedStringValue> list =
(ArrayList<EncodedStringValue>) mHeaderMap.get(field);
if (null == list) {
return null;
}
EncodedStringValue[] values = new EncodedStringValue[list.size()];
return list.toArray(values);
}
/**
* Set EncodedStringValue value to pdu header by header field.
*
* @param value the value
* @param field the field
* @return the EncodedStringValue value of the pdu header
* with specified header field
* @throws NullPointerException if the value is null.
*/
protected void setEncodedStringValue(EncodedStringValue value, int field) {
/**
* Check whether this field can be set for specific
* header and check validity of the field.
*/
if (null == value) {
throw new NullPointerException();
}
switch (field) {
case SUBJECT:
case RECOMMENDED_RETRIEVAL_MODE_TEXT:
case RETRIEVE_TEXT:
case STATUS_TEXT:
case STORE_STATUS_TEXT:
case RESPONSE_TEXT:
case FROM:
case PREVIOUSLY_SENT_BY:
case MM_FLAGS:
break;
default:
// This header value should not be Encoded-String-Value.
throw new RuntimeException("Invalid header field!");
}
mHeaderMap.put(field, value);
}
/**
* Set TO, CC or BCC header value.
*
* @param value the value
* @param field the field
* @return the EncodedStringValue value array of the pdu header
* with specified header field
* @throws NullPointerException if the value is null.
*/
protected void setEncodedStringValues(EncodedStringValue[] value, int field) {
/**
* Check whether this field can be set for specific
* header and check validity of the field.
*/
if (null == value) {
throw new NullPointerException();
}
switch (field) {
case BCC:
case CC:
case TO:
break;
default:
// This header value should not be Encoded-String-Value.
throw new RuntimeException("Invalid header field!");
}
ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
for (int i = 0; i < value.length; i++) {
list.add(value[i]);
}
mHeaderMap.put(field, list);
}
/**
* Append one EncodedStringValue to another.
*
* @param value the EncodedStringValue to append
* @param field the field
* @throws NullPointerException if the value is null.
*/
protected void appendEncodedStringValue(EncodedStringValue value,
int field) {
if (null == value) {
throw new NullPointerException();
}
switch (field) {
case BCC:
case CC:
case TO:
break;
default:
throw new RuntimeException("Invalid header field!");
}
ArrayList<EncodedStringValue> list =
(ArrayList<EncodedStringValue>) mHeaderMap.get(field);
if (null == list) {
list = new ArrayList<EncodedStringValue>();
}
list.add(value);
mHeaderMap.put(field, list);
}
/**
* Get LongInteger value by header field.
*
* @param field the field
* @return the LongInteger value of the pdu header
* with specified header field. if return -1, the
* field is not existed in pdu header.
*/
protected long getLongInteger(int field) {
Long longInteger = (Long) mHeaderMap.get(field);
if (null == longInteger) {
return -1;
}
return longInteger.longValue();
}
/**
* Set LongInteger value to pdu header by header field.
*
* @param value the value
* @param field the field
*/
protected void setLongInteger(long value, int field) {
/**
* Check whether this field can be set for specific
* header and check validity of the field.
*/
switch (field) {
case DATE:
case REPLY_CHARGING_SIZE:
case MESSAGE_SIZE:
case MESSAGE_COUNT:
case START:
case LIMIT:
case DELIVERY_TIME:
case EXPIRY:
case REPLY_CHARGING_DEADLINE:
case PREVIOUSLY_SENT_DATE:
break;
default:
// This header value should not be LongInteger.
throw new RuntimeException("Invalid header field!");
}
mHeaderMap.put(field, value);
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,414 +0,0 @@
/*
* Copyright (C) 2007-2008 Esmertec AG.
* Copyright (C) 2007-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import android.net.Uri;
import java.util.HashMap;
import java.util.Map;
/**
* The pdu part.
*/
public class PduPart {
/**
* Well-Known Parameters.
*/
public static final int P_Q = 0x80;
public static final int P_CHARSET = 0x81;
public static final int P_LEVEL = 0x82;
public static final int P_TYPE = 0x83;
public static final int P_DEP_NAME = 0x85;
public static final int P_DEP_FILENAME = 0x86;
public static final int P_DIFFERENCES = 0x87;
public static final int P_PADDING = 0x88;
// This value of "TYPE" s used with Content-Type: multipart/related
public static final int P_CT_MR_TYPE = 0x89;
public static final int P_DEP_START = 0x8A;
public static final int P_DEP_START_INFO = 0x8B;
public static final int P_DEP_COMMENT = 0x8C;
public static final int P_DEP_DOMAIN = 0x8D;
public static final int P_MAX_AGE = 0x8E;
public static final int P_DEP_PATH = 0x8F;
public static final int P_SECURE = 0x90;
public static final int P_SEC = 0x91;
public static final int P_MAC = 0x92;
public static final int P_CREATION_DATE = 0x93;
public static final int P_MODIFICATION_DATE = 0x94;
public static final int P_READ_DATE = 0x95;
public static final int P_SIZE = 0x96;
public static final int P_NAME = 0x97;
public static final int P_FILENAME = 0x98;
public static final int P_START = 0x99;
public static final int P_START_INFO = 0x9A;
public static final int P_COMMENT = 0x9B;
public static final int P_DOMAIN = 0x9C;
public static final int P_PATH = 0x9D;
/**
* Header field names.
*/
public static final int P_CONTENT_TYPE = 0x91;
public static final int P_CONTENT_LOCATION = 0x8E;
public static final int P_CONTENT_ID = 0xC0;
public static final int P_DEP_CONTENT_DISPOSITION = 0xAE;
public static final int P_CONTENT_DISPOSITION = 0xC5;
// The next header is unassigned header, use reserved header(0x48) value.
public static final int P_CONTENT_TRANSFER_ENCODING = 0xC8;
/**
* Content=Transfer-Encoding string.
*/
public static final String CONTENT_TRANSFER_ENCODING =
"Content-Transfer-Encoding";
/**
* Value of Content-Transfer-Encoding.
*/
public static final String P_BINARY = "binary";
public static final String P_7BIT = "7bit";
public static final String P_8BIT = "8bit";
public static final String P_BASE64 = "base64";
public static final String P_QUOTED_PRINTABLE = "quoted-printable";
/**
* Value of disposition can be set to PduPart when the value is octet in
* the PDU.
* "from-data" instead of Form-data<Octet 128>.
* "attachment" instead of Attachment<Octet 129>.
* "inline" instead of Inline<Octet 130>.
*/
static final byte[] DISPOSITION_FROM_DATA = "from-data".getBytes();
static final byte[] DISPOSITION_ATTACHMENT = "attachment".getBytes();
static final byte[] DISPOSITION_INLINE = "inline".getBytes();
/**
* Content-Disposition value.
*/
public static final int P_DISPOSITION_FROM_DATA = 0x80;
public static final int P_DISPOSITION_ATTACHMENT = 0x81;
public static final int P_DISPOSITION_INLINE = 0x82;
/**
* Header of part.
*/
private Map<Integer, Object> mPartHeader = null;
/**
* Data uri.
*/
private Uri mUri = null;
/**
* Part data.
*/
private byte[] mPartData = null;
private static final String TAG = "PduPart";
/**
* Empty Constructor.
*/
public PduPart() {
mPartHeader = new HashMap<Integer, Object>();
}
/**
* Set part data. The data are stored as byte array.
*
* @param data the data
*/
public void setData(byte[] data) {
if(data == null) {
return;
}
mPartData = new byte[data.length];
System.arraycopy(data, 0, mPartData, 0, data.length);
}
/**
* @return A copy of the part data or null if the data wasn't set or
* the data is stored as Uri.
* @see #getDataUri
*/
public byte[] getData() {
if(mPartData == null) {
return null;
}
byte[] byteArray = new byte[mPartData.length];
System.arraycopy(mPartData, 0, byteArray, 0, mPartData.length);
return byteArray;
}
/**
* @return The length of the data, if this object have data, else 0.
*/
public int getDataLength() {
if(mPartData != null){
return mPartData.length;
} else {
return 0;
}
}
/**
* Set data uri. The data are stored as Uri.
*
* @param uri the uri
*/
public void setDataUri(Uri uri) {
mUri = uri;
}
/**
* @return The Uri of the part data or null if the data wasn't set or
* the data is stored as byte array.
* @see #getData
*/
public Uri getDataUri() {
return mUri;
}
/**
* Set Content-id value
*
* @param contentId the content-id value
* @throws NullPointerException if the value is null.
*/
public void setContentId(byte[] contentId) {
if((contentId == null) || (contentId.length == 0)) {
throw new IllegalArgumentException(
"Content-Id may not be null or empty.");
}
if ((contentId.length > 1)
&& ((char) contentId[0] == '<')
&& ((char) contentId[contentId.length - 1] == '>')) {
mPartHeader.put(P_CONTENT_ID, contentId);
return;
}
// Insert beginning '<' and trailing '>' for Content-Id.
byte[] buffer = new byte[contentId.length + 2];
buffer[0] = (byte) (0xff & '<');
buffer[buffer.length - 1] = (byte) (0xff & '>');
System.arraycopy(contentId, 0, buffer, 1, contentId.length);
mPartHeader.put(P_CONTENT_ID, buffer);
}
/**
* Get Content-id value.
*
* @return the value
*/
public byte[] getContentId() {
return (byte[]) mPartHeader.get(P_CONTENT_ID);
}
/**
* Set Char-set value.
*
* @param charset the value
*/
public void setCharset(int charset) {
mPartHeader.put(P_CHARSET, charset);
}
/**
* Get Char-set value
*
* @return the charset value. Return 0 if charset was not set.
*/
public int getCharset() {
Integer charset = (Integer) mPartHeader.get(P_CHARSET);
if(charset == null) {
return 0;
} else {
return charset.intValue();
}
}
/**
* Set Content-Location value.
*
* @param contentLocation the value
* @throws NullPointerException if the value is null.
*/
public void setContentLocation(byte[] contentLocation) {
if(contentLocation == null) {
throw new NullPointerException("null content-location");
}
mPartHeader.put(P_CONTENT_LOCATION, contentLocation);
}
/**
* Get Content-Location value.
*
* @return the value
* return PduPart.disposition[0] instead of <Octet 128> (Form-data).
* return PduPart.disposition[1] instead of <Octet 129> (Attachment).
* return PduPart.disposition[2] instead of <Octet 130> (Inline).
*/
public byte[] getContentLocation() {
return (byte[]) mPartHeader.get(P_CONTENT_LOCATION);
}
/**
* Set Content-Disposition value.
* Use PduPart.disposition[0] instead of <Octet 128> (Form-data).
* Use PduPart.disposition[1] instead of <Octet 129> (Attachment).
* Use PduPart.disposition[2] instead of <Octet 130> (Inline).
*
* @param contentDisposition the value
* @throws NullPointerException if the value is null.
*/
public void setContentDisposition(byte[] contentDisposition) {
if(contentDisposition == null) {
throw new NullPointerException("null content-disposition");
}
mPartHeader.put(P_CONTENT_DISPOSITION, contentDisposition);
}
/**
* Get Content-Disposition value.
*
* @return the value
*/
public byte[] getContentDisposition() {
return (byte[]) mPartHeader.get(P_CONTENT_DISPOSITION);
}
/**
* Set Content-Type value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setContentType(byte[] contentType) {
if(contentType == null) {
throw new NullPointerException("null content-type");
}
mPartHeader.put(P_CONTENT_TYPE, contentType);
}
/**
* Get Content-Type value of part.
*
* @return the value
*/
public byte[] getContentType() {
return (byte[]) mPartHeader.get(P_CONTENT_TYPE);
}
/**
* Set Content-Transfer-Encoding value
*
* @param contentId the content-id value
* @throws NullPointerException if the value is null.
*/
public void setContentTransferEncoding(byte[] contentTransferEncoding) {
if(contentTransferEncoding == null) {
throw new NullPointerException("null content-transfer-encoding");
}
mPartHeader.put(P_CONTENT_TRANSFER_ENCODING, contentTransferEncoding);
}
/**
* Get Content-Transfer-Encoding value.
*
* @return the value
*/
public byte[] getContentTransferEncoding() {
return (byte[]) mPartHeader.get(P_CONTENT_TRANSFER_ENCODING);
}
/**
* Set Content-type parameter: name.
*
* @param name the name value
* @throws NullPointerException if the value is null.
*/
public void setName(byte[] name) {
if(null == name) {
throw new NullPointerException("null content-id");
}
mPartHeader.put(P_NAME, name);
}
/**
* Get content-type parameter: name.
*
* @return the name
*/
public byte[] getName() {
return (byte[]) mPartHeader.get(P_NAME);
}
/**
* Get Content-disposition parameter: filename
*
* @param fileName the filename value
* @throws NullPointerException if the value is null.
*/
public void setFilename(byte[] fileName) {
if(null == fileName) {
throw new NullPointerException("null content-id");
}
mPartHeader.put(P_FILENAME, fileName);
}
/**
* Set Content-disposition parameter: filename
*
* @return the filename
*/
public byte[] getFilename() {
return (byte[]) mPartHeader.get(P_FILENAME);
}
public String generateLocation() {
// Assumption: At least one of the content-location / name / filename
// or content-id should be set. This is guaranteed by the PduParser
// for incoming messages and by MM composer for outgoing messages.
byte[] location = (byte[]) mPartHeader.get(P_NAME);
if(null == location) {
location = (byte[]) mPartHeader.get(P_FILENAME);
if (null == location) {
location = (byte[]) mPartHeader.get(P_CONTENT_LOCATION);
}
}
if (null == location) {
byte[] contentId = (byte[]) mPartHeader.get(P_CONTENT_ID);
return "cid:" + new String(contentId);
} else {
return new String(location);
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,68 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import java.io.ByteArrayOutputStream;
public class QuotedPrintable {
private static byte ESCAPE_CHAR = '=';
/**
* Decodes an array quoted-printable characters into an array of original bytes.
* Escaped characters are converted back to their original representation.
*
* <p>
* This function implements a subset of
* quoted-printable encoding specification (rule #1 and rule #2)
* as defined in RFC 1521.
* </p>
*
* @param bytes array of quoted-printable characters
* @return array of original bytes,
* null if quoted-printable decoding is unsuccessful.
*/
public static final byte[] decodeQuotedPrintable(byte[] bytes) {
if (bytes == null) {
return null;
}
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
for (int i = 0; i < bytes.length; i++) {
int b = bytes[i];
if (b == ESCAPE_CHAR) {
try {
if('\r' == (char)bytes[i + 1] &&
'\n' == (char)bytes[i + 2]) {
i += 2;
continue;
}
int u = Character.digit((char) bytes[++i], 16);
int l = Character.digit((char) bytes[++i], 16);
if (u == -1 || l == -1) {
return null;
}
buffer.write((char) ((u << 4) + l));
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
} else {
buffer.write(b);
}
}
return buffer.toByteArray();
}
}

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

@ -1,153 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
public class ReadOrigInd extends GenericPdu {
/**
* Empty constructor.
* Since the Pdu corresponding to this class is constructed
* by the Proxy-Relay server, this class is only instantiated
* by the Pdu Parser.
*
* @throws InvalidHeaderValueException if error occurs.
*/
public ReadOrigInd() throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_READ_ORIG_IND);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
ReadOrigInd(PduHeaders headers) {
super(headers);
}
/**
* Get Date value.
*
* @return the value
*/
public long getDate() {
return mPduHeaders.getLongInteger(PduHeaders.DATE);
}
/**
* Set Date value.
*
* @param value the value
*/
public void setDate(long value) {
mPduHeaders.setLongInteger(value, PduHeaders.DATE);
}
/**
* Get From value.
* From-value = Value-length
* (Address-present-token Encoded-string-value | Insert-address-token)
*
* @return the value
*/
public EncodedStringValue getFrom() {
return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
}
/**
* Set From value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setFrom(EncodedStringValue value) {
mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
}
/**
* Get Message-ID value.
*
* @return the value
*/
public byte[] getMessageId() {
return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
}
/**
* Set Message-ID value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setMessageId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
}
/**
* Get X-MMS-Read-status value.
*
* @return the value
*/
public int getReadStatus() {
return mPduHeaders.getOctet(PduHeaders.READ_STATUS);
}
/**
* Set X-MMS-Read-status value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setReadStatus(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.READ_STATUS);
}
/**
* Get To value.
*
* @return the value
*/
public EncodedStringValue[] getTo() {
return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
}
/**
* Set To value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setTo(EncodedStringValue[] value) {
mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
}
/*
* Optional, not supported header fields:
*
* public byte[] getApplicId() {return null;}
* public void setApplicId(byte[] value) {}
*
* public byte[] getAuxApplicId() {return null;}
* public void getAuxApplicId(byte[] value) {}
*
* public byte[] getReplyApplicId() {return 0x00;}
* public void setReplyApplicId(byte[] value) {}
*/
}

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

@ -1,144 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
public class ReadRecInd extends GenericPdu {
/**
* Constructor, used when composing a M-ReadRec.ind pdu.
*
* @param from the from value
* @param messageId the message ID value
* @param mmsVersion current viersion of mms
* @param readStatus the read status value
* @param to the to value
* @throws InvalidHeaderValueException if parameters are invalid.
* NullPointerException if messageId or to is null.
*/
public ReadRecInd(EncodedStringValue from,
byte[] messageId,
int mmsVersion,
int readStatus,
EncodedStringValue[] to) throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_READ_REC_IND);
setFrom(from);
setMessageId(messageId);
setMmsVersion(mmsVersion);
setTo(to);
setReadStatus(readStatus);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
ReadRecInd(PduHeaders headers) {
super(headers);
}
/**
* Get Date value.
*
* @return the value
*/
public long getDate() {
return mPduHeaders.getLongInteger(PduHeaders.DATE);
}
/**
* Set Date value.
*
* @param value the value
*/
public void setDate(long value) {
mPduHeaders.setLongInteger(value, PduHeaders.DATE);
}
/**
* Get Message-ID value.
*
* @return the value
*/
public byte[] getMessageId() {
return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
}
/**
* Set Message-ID value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setMessageId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
}
/**
* Get To value.
*
* @return the value
*/
public EncodedStringValue[] getTo() {
return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
}
/**
* Set To value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setTo(EncodedStringValue[] value) {
mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
}
/**
* Get X-MMS-Read-status value.
*
* @return the value
*/
public int getReadStatus() {
return mPduHeaders.getOctet(PduHeaders.READ_STATUS);
}
/**
* Set X-MMS-Read-status value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setReadStatus(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.READ_STATUS);
}
/*
* Optional, not supported header fields:
*
* public byte[] getApplicId() {return null;}
* public void setApplicId(byte[] value) {}
*
* public byte[] getAuxApplicId() {return null;}
* public void getAuxApplicId(byte[] value) {}
*
* public byte[] getReplyApplicId() {return 0x00;}
* public void setReplyApplicId(byte[] value) {}
*/
}

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

@ -1,300 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
/**
* M-Retrive.conf Pdu.
*/
public class RetrieveConf extends MultimediaMessagePdu {
/**
* Empty constructor.
* Since the Pdu corresponding to this class is constructed
* by the Proxy-Relay server, this class is only instantiated
* by the Pdu Parser.
*
* @throws InvalidHeaderValueException if error occurs.
*/
public RetrieveConf() throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
RetrieveConf(PduHeaders headers) {
super(headers);
}
/**
* Constructor with given headers and body
*
* @param headers Headers for this PDU.
* @param body Body of this PDu.
*/
RetrieveConf(PduHeaders headers, PduBody body) {
super(headers, body);
}
/**
* Get CC value.
*
* @return the value
*/
public EncodedStringValue[] getCc() {
return mPduHeaders.getEncodedStringValues(PduHeaders.CC);
}
/**
* Add a "CC" value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void addCc(EncodedStringValue value) {
mPduHeaders.appendEncodedStringValue(value, PduHeaders.CC);
}
/**
* Get Content-type value.
*
* @return the value
*/
public byte[] getContentType() {
return mPduHeaders.getTextString(PduHeaders.CONTENT_TYPE);
}
/**
* Set Content-type value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setContentType(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.CONTENT_TYPE);
}
/**
* Get X-Mms-Delivery-Report value.
*
* @return the value
*/
public int getDeliveryReport() {
return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT);
}
/**
* Set X-Mms-Delivery-Report value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setDeliveryReport(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT);
}
/**
* Get From value.
* From-value = Value-length
* (Address-present-token Encoded-string-value | Insert-address-token)
*
* @return the value
*/
public EncodedStringValue getFrom() {
return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
}
/**
* Set From value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setFrom(EncodedStringValue value) {
mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
}
/**
* Get X-Mms-Message-Class value.
* Message-class-value = Class-identifier | Token-text
* Class-identifier = Personal | Advertisement | Informational | Auto
*
* @return the value
*/
public byte[] getMessageClass() {
return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS);
}
/**
* Set X-Mms-Message-Class value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setMessageClass(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS);
}
/**
* Get Message-ID value.
*
* @return the value
*/
public byte[] getMessageId() {
return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
}
/**
* Set Message-ID value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setMessageId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
}
/**
* Get X-Mms-Read-Report value.
*
* @return the value
*/
public int getReadReport() {
return mPduHeaders.getOctet(PduHeaders.READ_REPORT);
}
/**
* Set X-Mms-Read-Report value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setReadReport(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.READ_REPORT);
}
/**
* Get X-Mms-Retrieve-Status value.
*
* @return the value
*/
public int getRetrieveStatus() {
return mPduHeaders.getOctet(PduHeaders.RETRIEVE_STATUS);
}
/**
* Set X-Mms-Retrieve-Status value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setRetrieveStatus(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.RETRIEVE_STATUS);
}
/**
* Get X-Mms-Retrieve-Text value.
*
* @return the value
*/
public EncodedStringValue getRetrieveText() {
return mPduHeaders.getEncodedStringValue(PduHeaders.RETRIEVE_TEXT);
}
/**
* Set X-Mms-Retrieve-Text value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setRetrieveText(EncodedStringValue value) {
mPduHeaders.setEncodedStringValue(value, PduHeaders.RETRIEVE_TEXT);
}
/**
* Get X-Mms-Transaction-Id.
*
* @return the value
*/
public byte[] getTransactionId() {
return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
}
/**
* Set X-Mms-Transaction-Id.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setTransactionId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
}
/*
* Optional, not supported header fields:
*
* public byte[] getApplicId() {return null;}
* public void setApplicId(byte[] value) {}
*
* public byte[] getAuxApplicId() {return null;}
* public void getAuxApplicId(byte[] value) {}
*
* public byte getContentClass() {return 0x00;}
* public void setApplicId(byte value) {}
*
* public byte getDrmContent() {return 0x00;}
* public void setDrmContent(byte value) {}
*
* public byte getDistributionIndicator() {return 0x00;}
* public void setDistributionIndicator(byte value) {}
*
* public PreviouslySentByValue getPreviouslySentBy() {return null;}
* public void setPreviouslySentBy(PreviouslySentByValue value) {}
*
* public PreviouslySentDateValue getPreviouslySentDate() {}
* public void setPreviouslySentDate(PreviouslySentDateValue value) {}
*
* public MmFlagsValue getMmFlags() {return null;}
* public void setMmFlags(MmFlagsValue value) {}
*
* public MmStateValue getMmState() {return null;}
* public void getMmState(MmStateValue value) {}
*
* public byte[] getReplaceId() {return 0x00;}
* public void setReplaceId(byte[] value) {}
*
* public byte[] getReplyApplicId() {return 0x00;}
* public void setReplyApplicId(byte[] value) {}
*
* public byte getReplyCharging() {return 0x00;}
* public void setReplyCharging(byte value) {}
*
* public byte getReplyChargingDeadline() {return 0x00;}
* public void setReplyChargingDeadline(byte value) {}
*
* public byte[] getReplyChargingId() {return 0x00;}
* public void setReplyChargingId(byte[] value) {}
*
* public long getReplyChargingSize() {return 0;}
* public void setReplyChargingSize(long value) {}
*/
}

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

@ -1,117 +0,0 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import com.google.android.mms.InvalidHeaderValueException;
public class SendConf extends GenericPdu {
/**
* Empty constructor.
* Since the Pdu corresponding to this class is constructed
* by the Proxy-Relay server, this class is only instantiated
* by the Pdu Parser.
*
* @throws InvalidHeaderValueException if error occurs.
*/
public SendConf() throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_SEND_CONF);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
SendConf(PduHeaders headers) {
super(headers);
}
/**
* Get Message-ID value.
*
* @return the value
*/
public byte[] getMessageId() {
return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
}
/**
* Set Message-ID value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setMessageId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
}
/**
* Get X-Mms-Response-Status.
*
* @return the value
*/
public int getResponseStatus() {
return mPduHeaders.getOctet(PduHeaders.RESPONSE_STATUS);
}
/**
* Set X-Mms-Response-Status.
*
* @param value the values
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setResponseStatus(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.RESPONSE_STATUS);
}
/**
* Get X-Mms-Transaction-Id field value.
*
* @return the X-Mms-Report-Allowed value
*/
public byte[] getTransactionId() {
return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
}
/**
* Set X-Mms-Transaction-Id field value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setTransactionId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
}
/*
* Optional, not supported header fields:
*
* public byte[] getContentLocation() {return null;}
* public void setContentLocation(byte[] value) {}
*
* public EncodedStringValue getResponseText() {return null;}
* public void setResponseText(EncodedStringValue value) {}
*
* public byte getStoreStatus() {return 0x00;}
* public void setStoreStatus(byte value) {}
*
* public byte[] getStoreStatusText() {return null;}
* public void setStoreStatusText(byte[] value) {}
*/
}

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

@ -1,345 +0,0 @@
/*
* Copyright (C) 2007-2008 Esmertec AG.
* Copyright (C) 2007-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.pdu;
import android.util.Log;
import com.google.android.mms.InvalidHeaderValueException;
public class SendReq extends MultimediaMessagePdu {
private static final String TAG = "SendReq";
public SendReq() {
super();
try {
setMessageType(PduHeaders.MESSAGE_TYPE_SEND_REQ);
setMmsVersion(PduHeaders.CURRENT_MMS_VERSION);
// FIXME: Content-type must be decided according to whether
// SMIL part present.
setContentType("application/vnd.wap.multipart.related".getBytes());
setFrom(new EncodedStringValue(PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR.getBytes()));
setTransactionId(generateTransactionId());
} catch (InvalidHeaderValueException e) {
// Impossible to reach here since all headers we set above are valid.
Log.e(TAG, "Unexpected InvalidHeaderValueException.", e);
throw new RuntimeException(e);
}
}
private byte[] generateTransactionId() {
String transactionId = "T" + Long.toHexString(System.currentTimeMillis());
return transactionId.getBytes();
}
/**
* Constructor, used when composing a M-Send.req pdu.
*
* @param contentType the content type value
* @param from the from value
* @param mmsVersion current viersion of mms
* @param transactionId the transaction-id value
* @throws InvalidHeaderValueException if parameters are invalid.
* NullPointerException if contentType, form or transactionId is null.
*/
public SendReq(byte[] contentType,
EncodedStringValue from,
int mmsVersion,
byte[] transactionId) throws InvalidHeaderValueException {
super();
setMessageType(PduHeaders.MESSAGE_TYPE_SEND_REQ);
setContentType(contentType);
setFrom(from);
setMmsVersion(mmsVersion);
setTransactionId(transactionId);
}
/**
* Constructor with given headers.
*
* @param headers Headers for this PDU.
*/
SendReq(PduHeaders headers) {
super(headers);
}
/**
* Constructor with given headers and body
*
* @param headers Headers for this PDU.
* @param body Body of this PDu.
*/
SendReq(PduHeaders headers, PduBody body) {
super(headers, body);
}
/**
* Get Bcc value.
*
* @return the value
*/
public EncodedStringValue[] getBcc() {
return mPduHeaders.getEncodedStringValues(PduHeaders.BCC);
}
/**
* Add a "BCC" value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void addBcc(EncodedStringValue value) {
mPduHeaders.appendEncodedStringValue(value, PduHeaders.BCC);
}
/**
* Set "BCC" value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setBcc(EncodedStringValue[] value) {
mPduHeaders.setEncodedStringValues(value, PduHeaders.BCC);
}
/**
* Get CC value.
*
* @return the value
*/
public EncodedStringValue[] getCc() {
return mPduHeaders.getEncodedStringValues(PduHeaders.CC);
}
/**
* Add a "CC" value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void addCc(EncodedStringValue value) {
mPduHeaders.appendEncodedStringValue(value, PduHeaders.CC);
}
/**
* Set "CC" value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setCc(EncodedStringValue[] value) {
mPduHeaders.setEncodedStringValues(value, PduHeaders.CC);
}
/**
* Get Content-type value.
*
* @return the value
*/
public byte[] getContentType() {
return mPduHeaders.getTextString(PduHeaders.CONTENT_TYPE);
}
/**
* Set Content-type value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setContentType(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.CONTENT_TYPE);
}
/**
* Get X-Mms-Delivery-Report value.
*
* @return the value
*/
public int getDeliveryReport() {
return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT);
}
/**
* Set X-Mms-Delivery-Report value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setDeliveryReport(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT);
}
/**
* Get X-Mms-Expiry value.
*
* Expiry-value = Value-length
* (Absolute-token Date-value | Relative-token Delta-seconds-value)
*
* @return the value
*/
public long getExpiry() {
return mPduHeaders.getLongInteger(PduHeaders.EXPIRY);
}
/**
* Set X-Mms-Expiry value.
*
* @param value the value
*/
public void setExpiry(long value) {
mPduHeaders.setLongInteger(value, PduHeaders.EXPIRY);
}
/**
* Get X-Mms-MessageSize value.
*
* Expiry-value = size of message
*
* @return the value
*/
public long getMessageSize() {
return mPduHeaders.getLongInteger(PduHeaders.MESSAGE_SIZE);
}
/**
* Set X-Mms-MessageSize value.
*
* @param value the value
*/
public void setMessageSize(long value) {
mPduHeaders.setLongInteger(value, PduHeaders.MESSAGE_SIZE);
}
/**
* Get X-Mms-Message-Class value.
* Message-class-value = Class-identifier | Token-text
* Class-identifier = Personal | Advertisement | Informational | Auto
*
* @return the value
*/
public byte[] getMessageClass() {
return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS);
}
/**
* Set X-Mms-Message-Class value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setMessageClass(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS);
}
/**
* Get X-Mms-Read-Report value.
*
* @return the value
*/
public int getReadReport() {
return mPduHeaders.getOctet(PduHeaders.READ_REPORT);
}
/**
* Set X-Mms-Read-Report value.
*
* @param value the value
* @throws InvalidHeaderValueException if the value is invalid.
*/
public void setReadReport(int value) throws InvalidHeaderValueException {
mPduHeaders.setOctet(value, PduHeaders.READ_REPORT);
}
/**
* Set "To" value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setTo(EncodedStringValue[] value) {
mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
}
/**
* Get X-Mms-Transaction-Id field value.
*
* @return the X-Mms-Report-Allowed value
*/
public byte[] getTransactionId() {
return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
}
/**
* Set X-Mms-Transaction-Id field value.
*
* @param value the value
* @throws NullPointerException if the value is null.
*/
public void setTransactionId(byte[] value) {
mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
}
/*
* Optional, not supported header fields:
*
* public byte getAdaptationAllowed() {return 0};
* public void setAdaptationAllowed(btye value) {};
*
* public byte[] getApplicId() {return null;}
* public void setApplicId(byte[] value) {}
*
* public byte[] getAuxApplicId() {return null;}
* public void getAuxApplicId(byte[] value) {}
*
* public byte getContentClass() {return 0x00;}
* public void setApplicId(byte value) {}
*
* public long getDeliveryTime() {return 0};
* public void setDeliveryTime(long value) {};
*
* public byte getDrmContent() {return 0x00;}
* public void setDrmContent(byte value) {}
*
* public MmFlagsValue getMmFlags() {return null;}
* public void setMmFlags(MmFlagsValue value) {}
*
* public MmStateValue getMmState() {return null;}
* public void getMmState(MmStateValue value) {}
*
* public byte[] getReplyApplicId() {return 0x00;}
* public void setReplyApplicId(byte[] value) {}
*
* public byte getReplyCharging() {return 0x00;}
* public void setReplyCharging(byte value) {}
*
* public byte getReplyChargingDeadline() {return 0x00;}
* public void setReplyChargingDeadline(byte value) {}
*
* public byte[] getReplyChargingId() {return 0x00;}
* public void setReplyChargingId(byte[] value) {}
*
* public long getReplyChargingSize() {return 0;}
* public void setReplyChargingSize(long value) {}
*
* public byte[] getReplyApplicId() {return 0x00;}
* public void setReplyApplicId(byte[] value) {}
*
* public byte getStore() {return 0x00;}
* public void setStore(byte value) {}
*/
}

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

@ -1,112 +0,0 @@
/*
* Copyright (C) 2008 Esmertec AG.
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.util;
import android.util.Log;
import java.util.HashMap;
public abstract class AbstractCache<K, V> {
private static final String TAG = "AbstractCache";
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private static final int MAX_CACHED_ITEMS = 500;
private final HashMap<K, CacheEntry<V>> mCacheMap;
protected AbstractCache() {
mCacheMap = new HashMap<K, CacheEntry<V>>();
}
public boolean put(K key, V value) {
if (LOCAL_LOGV) {
Log.v(TAG, "Trying to put " + key + " into cache.");
}
if (mCacheMap.size() >= MAX_CACHED_ITEMS) {
// TODO Should remove the oldest or least hit cached entry
// and then cache the new one.
if (LOCAL_LOGV) {
Log.v(TAG, "Failed! size limitation reached.");
}
return false;
}
if (key != null) {
CacheEntry<V> cacheEntry = new CacheEntry<V>();
cacheEntry.value = value;
mCacheMap.put(key, cacheEntry);
if (LOCAL_LOGV) {
Log.v(TAG, key + " cached, " + mCacheMap.size() + " items total.");
}
return true;
}
return false;
}
public V get(K key) {
if (LOCAL_LOGV) {
Log.v(TAG, "Trying to get " + key + " from cache.");
}
if (key != null) {
CacheEntry<V> cacheEntry = mCacheMap.get(key);
if (cacheEntry != null) {
cacheEntry.hit++;
if (LOCAL_LOGV) {
Log.v(TAG, key + " hit " + cacheEntry.hit + " times.");
}
return cacheEntry.value;
}
}
return null;
}
public V purge(K key) {
if (LOCAL_LOGV) {
Log.v(TAG, "Trying to purge " + key);
}
CacheEntry<V> v = mCacheMap.remove(key);
if (LOCAL_LOGV) {
Log.v(TAG, mCacheMap.size() + " items cached.");
}
return v != null ? v.value : null;
}
public void purgeAll() {
if (LOCAL_LOGV) {
Log.v(TAG, "Purging cache, " + mCacheMap.size()
+ " items dropped.");
}
mCacheMap.clear();
}
public int size() {
return mCacheMap.size();
}
private static class CacheEntry<V> {
int hit;
V value;
}
}

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

@ -1,261 +0,0 @@
/*
* Copyright (C) 2008 Esmertec AG.
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.util;
import android.content.ContentUris;
import android.content.UriMatcher;
import android.net.Uri;
import android.provider.Telephony.Mms;
import android.util.Log;
import java.util.HashMap;
import java.util.HashSet;
public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
private static final String TAG = "PduCache";
private static final boolean DEBUG = false;
private static final boolean LOCAL_LOGV = false;
private static final int MMS_ALL = 0;
private static final int MMS_ALL_ID = 1;
private static final int MMS_INBOX = 2;
private static final int MMS_INBOX_ID = 3;
private static final int MMS_SENT = 4;
private static final int MMS_SENT_ID = 5;
private static final int MMS_DRAFTS = 6;
private static final int MMS_DRAFTS_ID = 7;
private static final int MMS_OUTBOX = 8;
private static final int MMS_OUTBOX_ID = 9;
private static final int MMS_CONVERSATION = 10;
private static final int MMS_CONVERSATION_ID = 11;
private static final UriMatcher URI_MATCHER;
private static final HashMap<Integer, Integer> MATCH_TO_MSGBOX_ID_MAP;
private static PduCache sInstance;
static {
URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
URI_MATCHER.addURI("mms", null, MMS_ALL);
URI_MATCHER.addURI("mms", "#", MMS_ALL_ID);
URI_MATCHER.addURI("mms", "inbox", MMS_INBOX);
URI_MATCHER.addURI("mms", "inbox/#", MMS_INBOX_ID);
URI_MATCHER.addURI("mms", "sent", MMS_SENT);
URI_MATCHER.addURI("mms", "sent/#", MMS_SENT_ID);
URI_MATCHER.addURI("mms", "drafts", MMS_DRAFTS);
URI_MATCHER.addURI("mms", "drafts/#", MMS_DRAFTS_ID);
URI_MATCHER.addURI("mms", "outbox", MMS_OUTBOX);
URI_MATCHER.addURI("mms", "outbox/#", MMS_OUTBOX_ID);
URI_MATCHER.addURI("mms-sms", "conversations", MMS_CONVERSATION);
URI_MATCHER.addURI("mms-sms", "conversations/#", MMS_CONVERSATION_ID);
MATCH_TO_MSGBOX_ID_MAP = new HashMap<Integer, Integer>();
MATCH_TO_MSGBOX_ID_MAP.put(MMS_INBOX, Mms.MESSAGE_BOX_INBOX);
MATCH_TO_MSGBOX_ID_MAP.put(MMS_SENT, Mms.MESSAGE_BOX_SENT);
MATCH_TO_MSGBOX_ID_MAP.put(MMS_DRAFTS, Mms.MESSAGE_BOX_DRAFTS);
MATCH_TO_MSGBOX_ID_MAP.put(MMS_OUTBOX, Mms.MESSAGE_BOX_OUTBOX);
}
private final HashMap<Integer, HashSet<Uri>> mMessageBoxes;
private final HashMap<Long, HashSet<Uri>> mThreads;
private final HashSet<Uri> mUpdating;
private PduCache() {
mMessageBoxes = new HashMap<Integer, HashSet<Uri>>();
mThreads = new HashMap<Long, HashSet<Uri>>();
mUpdating = new HashSet<Uri>();
}
synchronized public static final PduCache getInstance() {
if (sInstance == null) {
if (LOCAL_LOGV) {
Log.v(TAG, "Constructing new PduCache instance.");
}
sInstance = new PduCache();
}
return sInstance;
}
@Override
synchronized public boolean put(Uri uri, PduCacheEntry entry) {
int msgBoxId = entry.getMessageBox();
HashSet<Uri> msgBox = mMessageBoxes.get(msgBoxId);
if (msgBox == null) {
msgBox = new HashSet<Uri>();
mMessageBoxes.put(msgBoxId, msgBox);
}
long threadId = entry.getThreadId();
HashSet<Uri> thread = mThreads.get(threadId);
if (thread == null) {
thread = new HashSet<Uri>();
mThreads.put(threadId, thread);
}
Uri finalKey = normalizeKey(uri);
boolean result = super.put(finalKey, entry);
if (result) {
msgBox.add(finalKey);
thread.add(finalKey);
}
setUpdating(uri, false);
return result;
}
synchronized public void setUpdating(Uri uri, boolean updating) {
if (updating) {
mUpdating.add(uri);
} else {
mUpdating.remove(uri);
}
}
synchronized public boolean isUpdating(Uri uri) {
return mUpdating.contains(uri);
}
@Override
synchronized public PduCacheEntry purge(Uri uri) {
int match = URI_MATCHER.match(uri);
switch (match) {
case MMS_ALL_ID:
return purgeSingleEntry(uri);
case MMS_INBOX_ID:
case MMS_SENT_ID:
case MMS_DRAFTS_ID:
case MMS_OUTBOX_ID:
String msgId = uri.getLastPathSegment();
return purgeSingleEntry(Uri.withAppendedPath(Mms.CONTENT_URI, msgId));
// Implicit batch of purge, return null.
case MMS_ALL:
case MMS_CONVERSATION:
purgeAll();
return null;
case MMS_INBOX:
case MMS_SENT:
case MMS_DRAFTS:
case MMS_OUTBOX:
purgeByMessageBox(MATCH_TO_MSGBOX_ID_MAP.get(match));
return null;
case MMS_CONVERSATION_ID:
purgeByThreadId(ContentUris.parseId(uri));
return null;
default:
return null;
}
}
private PduCacheEntry purgeSingleEntry(Uri key) {
mUpdating.remove(key);
PduCacheEntry entry = super.purge(key);
if (entry != null) {
removeFromThreads(key, entry);
removeFromMessageBoxes(key, entry);
return entry;
}
return null;
}
@Override
synchronized public void purgeAll() {
super.purgeAll();
mMessageBoxes.clear();
mThreads.clear();
mUpdating.clear();
}
/**
* @param uri The Uri to be normalized.
* @return Uri The normalized key of cached entry.
*/
private Uri normalizeKey(Uri uri) {
int match = URI_MATCHER.match(uri);
Uri normalizedKey = null;
switch (match) {
case MMS_ALL_ID:
normalizedKey = uri;
break;
case MMS_INBOX_ID:
case MMS_SENT_ID:
case MMS_DRAFTS_ID:
case MMS_OUTBOX_ID:
String msgId = uri.getLastPathSegment();
normalizedKey = Uri.withAppendedPath(Mms.CONTENT_URI, msgId);
break;
default:
return null;
}
if (LOCAL_LOGV) {
Log.v(TAG, uri + " -> " + normalizedKey);
}
return normalizedKey;
}
private void purgeByMessageBox(Integer msgBoxId) {
if (LOCAL_LOGV) {
Log.v(TAG, "Purge cache in message box: " + msgBoxId);
}
if (msgBoxId != null) {
HashSet<Uri> msgBox = mMessageBoxes.remove(msgBoxId);
if (msgBox != null) {
for (Uri key : msgBox) {
mUpdating.remove(key);
PduCacheEntry entry = super.purge(key);
if (entry != null) {
removeFromThreads(key, entry);
}
}
}
}
}
private void removeFromThreads(Uri key, PduCacheEntry entry) {
HashSet<Uri> thread = mThreads.get(entry.getThreadId());
if (thread != null) {
thread.remove(key);
}
}
private void purgeByThreadId(long threadId) {
if (LOCAL_LOGV) {
Log.v(TAG, "Purge cache in thread: " + threadId);
}
HashSet<Uri> thread = mThreads.remove(threadId);
if (thread != null) {
for (Uri key : thread) {
mUpdating.remove(key);
PduCacheEntry entry = super.purge(key);
if (entry != null) {
removeFromMessageBoxes(key, entry);
}
}
}
}
private void removeFromMessageBoxes(Uri key, PduCacheEntry entry) {
HashSet<Uri> msgBox = mThreads.get(Long.valueOf(entry.getMessageBox()));
if (msgBox != null) {
msgBox.remove(key);
}
}
}

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

@ -1,44 +0,0 @@
/*
* Copyright (C) 2008 Esmertec AG.
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.util;
import com.google.android.mms.pdu.GenericPdu;
public final class PduCacheEntry {
private final GenericPdu mPdu;
private final int mMessageBox;
private final long mThreadId;
public PduCacheEntry(GenericPdu pdu, int msgBox, long threadId) {
mPdu = pdu;
mMessageBox = msgBox;
mThreadId = threadId;
}
public GenericPdu getPdu() {
return mPdu;
}
public int getMessageBox() {
return mMessageBox;
}
public long getThreadId() {
return mThreadId;
}
}

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

@ -1,120 +0,0 @@
/*
* Copyright (C) 2008 Esmertec AG.
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.mms.util;
import android.app.ActivityManager;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;
public final class SqliteWrapper {
private static final String TAG = "SqliteWrapper";
private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE
= "unable to open database file";
private SqliteWrapper() {
// Forbidden being instantiated.
}
// FIXME: It looks like outInfo.lowMemory does not work well as we expected.
// after run command: adb shell fillup -p 100, outInfo.lowMemory is still false.
private static boolean isLowMemory(Context context) {
if (null == context) {
return false;
}
ActivityManager am = (ActivityManager)
context.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo();
am.getMemoryInfo(outInfo);
return outInfo.lowMemory;
}
// FIXME: need to optimize this method.
private static boolean isLowMemory(SQLiteException e) {
return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
}
public static void checkSQLiteException(Context context, SQLiteException e) {
if (isLowMemory(e)) {
Toast.makeText(context, org.mozilla.b2gdroid.R.string.low_memory,
Toast.LENGTH_SHORT).show();
} else {
throw e;
}
}
public static Cursor query(Context context, ContentResolver resolver, Uri uri,
String[] projection, String selection, String[] selectionArgs, String sortOrder) {
try {
return resolver.query(uri, projection, selection, selectionArgs, sortOrder);
} catch (SQLiteException e) {
Log.e(TAG, "Catch a SQLiteException when query: ", e);
checkSQLiteException(context, e);
return null;
}
}
public static boolean requery(Context context, Cursor cursor) {
try {
return cursor.requery();
} catch (SQLiteException e) {
Log.e(TAG, "Catch a SQLiteException when requery: ", e);
checkSQLiteException(context, e);
return false;
}
}
public static int update(Context context, ContentResolver resolver, Uri uri,
ContentValues values, String where, String[] selectionArgs) {
try {
return resolver.update(uri, values, where, selectionArgs);
} catch (SQLiteException e) {
Log.e(TAG, "Catch a SQLiteException when update: ", e);
checkSQLiteException(context, e);
return -1;
}
}
public static int delete(Context context, ContentResolver resolver, Uri uri,
String where, String[] selectionArgs) {
try {
return resolver.delete(uri, where, selectionArgs);
} catch (SQLiteException e) {
Log.e(TAG, "Catch a SQLiteException when delete: ", e);
checkSQLiteException(context, e);
return -1;
}
}
public static Uri insert(Context context, ContentResolver resolver,
Uri uri, ContentValues values) {
try {
return resolver.insert(uri, values);
} catch (SQLiteException e) {
Log.e(TAG, "Catch a SQLiteException when insert: ", e);
checkSQLiteException(context, e);
return null;
}
}
}

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

@ -1,158 +0,0 @@
/* 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.b2gdroid;
import java.io.ByteArrayOutputStream;
import java.util.Iterator;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.util.Base64;
import android.util.Log;
import org.json.JSONObject;
import org.json.JSONArray;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
class Apps extends BroadcastReceiver
implements GeckoEventListener {
private static final String LOGTAG = "B2G:Apps";
private Context mContext;
Apps(Context context) {
mContext = context;
EventDispatcher.getInstance()
.registerGeckoThreadListener(this,
"Apps:GetList",
"Apps:Launch",
"Apps:Uninstall");
// Observe app installation and removal.
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addDataScheme("package");
mContext.registerReceiver(this, filter);
}
void destroy() {
mContext.unregisterReceiver(this);
EventDispatcher.getInstance()
.unregisterGeckoThreadListener(this,
"Apps:GetList",
"Apps:Launch",
"Apps:Uninstall");
}
JSONObject activityInfoToJson(ActivityInfo info, PackageManager pm) {
JSONObject obj = new JSONObject();
try {
obj.put("name", info.loadLabel(pm).toString());
obj.put("packagename", info.packageName);
obj.put("classname", info.name);
final ApplicationInfo appInfo = info.applicationInfo;
// Pre-installed apps can't be uninstalled.
final boolean removable =
(appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0;
obj.put("removable", removable);
obj.put("icon", "android://icon/" + appInfo.packageName);
} catch(Exception ex) {
Log.wtf(LOGTAG, "Error building ActivityInfo JSON", ex);
}
return obj;
}
public void handleMessage(String event, JSONObject message) {
Log.w(LOGTAG, "Received " + event);
if ("Apps:GetList".equals(event)) {
JSONObject ret = new JSONObject();
JSONArray array = new JSONArray();
PackageManager pm = mContext.getPackageManager();
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final Iterator<ResolveInfo> i = pm.queryIntentActivities(mainIntent, 0).iterator();
try {
while (i.hasNext()) {
ActivityInfo info = i.next().activityInfo;
array.put(activityInfoToJson(info, pm));
}
ret.put("apps", array);
} catch(Exception ex) {
Log.wtf(LOGTAG, "error, making list of apps", ex);
}
EventDispatcher.sendResponse(message, ret);
} else if ("Apps:Launch".equals(event)) {
try {
String className = message.getString("classname");
String packageName = message.getString("packagename");
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setClassName(packageName, className);
mContext.startActivity(intent);
} catch(Exception ex) {
Log.wtf(LOGTAG, "Error launching app", ex);
}
} else if ("Apps:Uninstall".equals(event)) {
try {
String packageName = message.getString("packagename");
Uri packageUri = Uri.parse("package:" + packageName);
final Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
mContext.startActivity(intent);
} catch(Exception ex) {
Log.wtf(LOGTAG, "Error uninstalling app", ex);
}
}
}
@Override
public void onReceive(Context context, Intent intent) {
Log.d(LOGTAG, intent.getAction() + " " + intent.getDataString());
String packageName = intent.getDataString().substring(8);
String action = intent.getAction();
if ("android.intent.action.PACKAGE_ADDED".equals(action)) {
PackageManager pm = mContext.getPackageManager();
Intent launch = pm.getLaunchIntentForPackage(packageName);
if (launch == null) {
Log.d(LOGTAG, "No launchable intent for " + packageName);
return;
}
ActivityInfo info = launch.resolveActivityInfo(pm, 0);
JSONObject obj = activityInfoToJson(info, pm);
GeckoEvent e = GeckoEvent.createBroadcastEvent("Android:Apps:Installed", obj.toString());
GeckoAppShell.sendEventToGecko(e);
} else if ("android.intent.action.PACKAGE_REMOVED".equals(action)) {
JSONObject obj = new JSONObject();
try {
obj.put("packagename", packageName);
} catch(Exception ex) {
Log.wtf(LOGTAG, "Error building PACKAGE_REMOVED JSON", ex);
}
GeckoEvent e = GeckoEvent.createBroadcastEvent("Android:Apps:Uninstalled", obj.toString());
GeckoAppShell.sendEventToGecko(e);
}
}
}

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

@ -1,60 +0,0 @@
/* vim: set ts=4 sw=4 tw=80 et :
* 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.b2gdroid;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.AppConstants;
/**
* A generic 'GeckoEvent' Intent receiver.
*
* A Context running in a different process to the main Context may wish to
* send a GeckoEvent. Using GeckoAppShell.sendEventToGecko from other
* processes will silently fail. Instead, broadcast an Intent containing the
* GeckoEvent data and the GeckoEventReceiver registered with the primary
* Context will forward the Event to Gecko.
*/
public class GeckoEventReceiver extends BroadcastReceiver {
private static final String LOGTAG = "B2GDroid:GeckoEventReceiver";
private static final String SEND_GECKO_EVENT = AppConstants.ANDROID_PACKAGE_NAME + ".SEND_GECKO_EVENT";
private static final String EXTRA_SUBJECT = "SUBJECT";
private static final String EXTRA_DATA = "DATA";
public static Intent createBroadcastEventIntent(String subject, String data) {
Intent intent = new Intent(SEND_GECKO_EVENT);
intent.putExtra(EXTRA_SUBJECT, subject);
intent.putExtra(EXTRA_DATA, data);
return intent;
}
public void registerWithContext(Context aContext) {
aContext.registerReceiver(this, new IntentFilter(SEND_GECKO_EVENT));
}
public void destroy(Context aContext) {
aContext.unregisterReceiver(this);
}
@Override
public void onReceive(Context aContext, Intent aIntent) {
String geckoEventSubject = aIntent.getStringExtra(EXTRA_SUBJECT);
String geckoEventJSON = aIntent.getStringExtra(EXTRA_DATA);
Log.i(LOGTAG, "onReceive(" + geckoEventSubject + ")");
GeckoEvent e = GeckoEvent.createBroadcastEvent(geckoEventSubject, geckoEventJSON);
GeckoAppShell.sendEventToGecko(e);
}
}

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

@ -1,40 +0,0 @@
/* 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.b2gdroid;
import android.app.IntentService;
import android.content.Intent;
import android.os.Bundle;
import org.mozilla.gecko.GeckoAppShell;
public class HeadlessSmsSendService extends IntentService {
private final static String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
public HeadlessSmsSendService() {
super("HeadlessSmsSendService");
}
@Override
protected void onHandleIntent(Intent intent) {
if (!ACTION_RESPOND_VIA_MESSAGE.equals(intent.getAction())) {
return;
}
Bundle extras = intent.getExtras();
if (extras == null) {
return;
}
String recipient = intent.getData().getPath();
String message = extras.getString(Intent.EXTRA_TEXT);
if (recipient.length() == 0 || message.length() == 0) {
return;
}
GeckoAppShell.sendMessage(recipient, message, 0, /* shouldNotify */ false);
}
}

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

@ -1,320 +0,0 @@
/* 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.b2gdroid;
import java.util.Date;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.PixelFormat;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import org.json.JSONObject;
import org.json.JSONException;
import org.mozilla.gecko.BaseGeckoInterface;
import org.mozilla.gecko.ContactService;
import org.mozilla.gecko.ContextGetter;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoBatteryManager;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.GeckoThread;
import org.mozilla.gecko.IntentHelper;
import org.mozilla.gecko.AppNotificationClient;
import org.mozilla.gecko.updater.UpdateServiceHelper;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.b2gdroid.ScreenStateObserver;
import org.mozilla.b2gdroid.Apps;
import org.mozilla.b2gdroid.SettingsMapper;
public class Launcher extends FragmentActivity
implements GeckoEventListener, ContextGetter {
private static final String LOGTAG = "B2G";
private ContactService mContactService;
private ScreenStateObserver mScreenStateObserver;
private Apps mApps;
private SettingsMapper mSettings;
private GeckoEventReceiver mGeckoEventReceiver;
private RemoteGeckoEventProxy mGeckoEventProxy;
private View mDisableStatusBarView = null;
private static final long kHomeRepeat = 2;
private static final long kHomeDelay = 500; // delay in ms to tap kHomeRepeat times.
private long mFirstHome;
private long mLastHome;
private long mHomeCount;
final class GeckoInterface extends BaseGeckoInterface
implements LocationListener {
public GeckoInterface(Context context) {
super(context);
}
public LocationListener getLocationListener() {
return this;
}
@Override
public void onLocationChanged(Location location) {
GeckoAppShell.sendEventToGecko(GeckoEvent.createLocationEvent(location));
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
}
/** ContextGetter */
public Context getContext() {
return this;
}
public SharedPreferences getSharedPreferences() {
return null;
}
/** Initializes Gecko APIs */
private void initGecko() {
GeckoAppShell.setContextGetter(this);
GeckoAppShell.setNotificationClient(new AppNotificationClient(this));
GeckoBatteryManager.getInstance().start(this);
mContactService = new ContactService(EventDispatcher.getInstance(), this);
mApps = new Apps(this);
mSettings = new SettingsMapper(this, null);
}
private void hideSplashScreen() {
final View splash = findViewById(R.id.splashscreen);
runOnUiThread(new Runnable() {
@Override public void run() {
splash.setVisibility(View.GONE);
}
});
}
private View getStatusBarOverlay() {
if (mDisableStatusBarView != null) {
return mDisableStatusBarView;
}
mDisableStatusBarView = new View(this);
mDisableStatusBarView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent ev) {
// Pass the touch event down to the GeckoView
Launcher.this.findViewById(R.id.gecko_view).dispatchTouchEvent(ev);
return true;
}
});
WindowManager.LayoutParams handleParams = new WindowManager.LayoutParams(
// Fill the width of the screen
WindowManager.LayoutParams.FILL_PARENT,
// Arbitrary value to cover the edge of the top of the screen to interrupt the gesture.
// This value was found through trial and error on a large screen L and a Z3C on KK
25,
// display over everything
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
// Prevent events from capturing in other views beneath this
// one
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
// Allows the View to receive touch events so we can pass them
// to Gecko
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
// Draw over status bar area
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
// Draw transparent
PixelFormat.TRANSPARENT);
handleParams.gravity = Gravity.TOP;
WindowManager manager = ((WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE));
manager.addView(mDisableStatusBarView, handleParams);
return mDisableStatusBarView;
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Log.w(LOGTAG, "onCreate");
super.onCreate(savedInstanceState);
IntentHelper.init(this);
mScreenStateObserver = new ScreenStateObserver(this);
initGecko();
mGeckoEventProxy = new RemoteGeckoEventProxy(this);
mGeckoEventReceiver = new GeckoEventReceiver();
mGeckoEventReceiver.registerWithContext(this);
GeckoAppShell.setGeckoInterface(new GeckoInterface(this));
UpdateServiceHelper.registerForUpdates(this);
EventDispatcher.getInstance().registerGeckoThreadListener(this,
"Launcher:Ready");
// Register the RemoteGeckoEventProxy with the Notification Opened
// event, Notifications are handled in a different process as a
// service, so we need to forward them to the remote service
EventDispatcher.getInstance().registerGeckoThreadListener(mGeckoEventProxy,
"Android:NotificationOpened");
// Initialize status bar overlay
getStatusBarOverlay();
setContentView(R.layout.launcher);
mHomeCount = 0;
mFirstHome = 0;
mLastHome = 0;
}
@Override
public void onResume() {
super.onResume();
if (GeckoThread.isRunning()) {
hideSplashScreen();
NotificationObserver.registerForNativeNotifications(this);
}
}
@Override
public void onDestroy() {
Log.w(LOGTAG, "onDestroy");
super.onDestroy();
IntentHelper.destroy();
mGeckoEventReceiver.destroy(this);
mGeckoEventReceiver = null;
mScreenStateObserver.destroy(this);
mScreenStateObserver = null;
EventDispatcher.getInstance().unregisterGeckoThreadListener(this,
"Launcher:Ready");
mContactService.destroy();
mApps.destroy();
mSettings.destroy();
}
@Override
protected void onNewIntent(Intent intent) {
final String action = intent.getAction();
Log.w(LOGTAG, "onNewIntent " + action);
if (Intent.ACTION_VIEW.equals(action)) {
Log.w(LOGTAG, "Asking gecko to view " + intent.getDataString());
JSONObject obj = new JSONObject();
try {
obj.put("action", "view");
obj.put("url", intent.getDataString());
} catch(JSONException ex) {
Log.wtf(LOGTAG, "Error building Android:Launcher view message", ex);
}
GeckoEvent e = GeckoEvent.createBroadcastEvent("Android:Launcher", obj.toString());
GeckoAppShell.sendEventToGecko(e);
} else if (Intent.ACTION_MAIN.equals(action)) {
String message = "home-key";
// Check if we did a multiple home tap to trigger the task switcher.
long now = (new Date()).getTime();
if (now - mLastHome > kHomeDelay) {
mHomeCount = 0;
}
if (mHomeCount == 0) {
mFirstHome = now;
}
mHomeCount++;
if (mHomeCount == kHomeRepeat) {
mHomeCount = 0;
if (now - mFirstHome < kHomeDelay) {
message = "task-switcher";
}
}
mLastHome = now;
Log.d(LOGTAG, "Let's dispatch a '" + message + "' key event");
JSONObject obj = new JSONObject();
try {
obj.put("action", message);
} catch(JSONException ex) {
Log.wtf(LOGTAG, "Error building Android:Launcher message", ex);
}
GeckoEvent e = GeckoEvent.createBroadcastEvent("Android:Launcher", obj.toString());
GeckoAppShell.sendEventToGecko(e);
} else if (Intent.ACTION_SENDTO.equals(action) ||
Intent.ACTION_SEND.equals(action)) {
Log.d(LOGTAG, "Sending new SMS intent to Gecko");
JSONObject obj = new JSONObject();
try {
obj.put("action", "send_sms");
if (Intent.ACTION_SENDTO.equals(action)) {
obj.put("number", intent.getData().getPath());
}
obj.put("body", intent.getStringExtra("sms_body"));
} catch (JSONException ex) {
Log.wtf(LOGTAG, "Error building Android:Launcher message", ex);
}
GeckoEvent e = GeckoEvent.createBroadcastEvent("Android:Launcher", obj.toString());
GeckoAppShell.sendEventToGecko(e);
}
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
Log.d(LOGTAG, "onWindowFocusChanged hasFocus=" + hasFocus);
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getStatusBarOverlay().setVisibility(View.VISIBLE);
findViewById(R.id.main_layout).setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_FULLSCREEN
);
} else {
getStatusBarOverlay().setVisibility(View.INVISIBLE);
}
}
@Override
public void onBackPressed() {
GeckoEvent e = GeckoEvent.createBroadcastEvent("Android:Launcher", "{\"action\":\"back-key\"}");
GeckoAppShell.sendEventToGecko(e);
}
public void handleMessage(String event, JSONObject message) {
Log.w(LOGTAG, "Launcher received " + event);
if ("Launcher:Ready".equals(event)) {
hideSplashScreen();
}
}
}

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

@ -1,202 +0,0 @@
/* 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.b2gdroid;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.os.Build;
import android.provider.Telephony;
import android.telephony.SmsManager;
import android.util.Log;
import static com.google.android.mms.pdu.PduHeaders.MESSAGE_TYPE_DELIVERY_IND;
import static com.google.android.mms.pdu.PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND;
import static com.google.android.mms.pdu.PduHeaders.MESSAGE_TYPE_READ_ORIG_IND;
import com.google.android.mms.MmsException;
import com.google.android.mms.pdu.DeliveryInd;
import com.google.android.mms.pdu.GenericPdu;
import com.google.android.mms.pdu.NotificationInd;
import com.google.android.mms.pdu.PduHeaders;
import com.google.android.mms.pdu.PduParser;
import com.google.android.mms.pdu.PduPersister;
import com.google.android.mms.pdu.ReadOrigInd;
import com.google.android.mms.util.SqliteWrapper;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoSmsManager;
public class MmsService extends BroadcastReceiver {
private final static String LOGTAG = "MmsService";
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Telephony.Sms.Intents.WAP_PUSH_DELIVER_ACTION)) {
final byte[] data = intent.getByteArrayExtra("data");
writeInboxMessage(data);
}
}
private static boolean shouldParseContentDisposition() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return SmsManager.getDefault().getCarrierConfigValues().getBoolean(SmsManager.MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION, true);
} else {
return false;
}
}
private void writeInboxMessage(byte[] pushData) {
final Context context = GeckoAppShell.getContext();
final GenericPdu pdu = new PduParser(pushData, shouldParseContentDisposition()).parse();
if (pdu == null) {
Log.e(LOGTAG, "Invalid PUSH PDU");
}
final PduPersister persister = PduPersister.getPduPersister(context);
final int type = pdu.getMessageType();
try {
switch (type) {
case MESSAGE_TYPE_DELIVERY_IND:
case MESSAGE_TYPE_READ_ORIG_IND: {
final long threadId = getDeliveryOrReadReportThreadId(context, pdu);
if (threadId == -1) {
// The associated SendReq isn't found, therefore skip
// processing this PDU.
Log.e(LOGTAG, "Failed to find delivery or read report's thread id");
break;
}
final Uri uri = persister.persist(
pdu,
Telephony.Mms.Inbox.CONTENT_URI,
true/*createThreadId*/,
true/*groupMmsEnabled*/,
null/*preOpenedFiles*/);
if (uri == null) {
Log.e(LOGTAG, "Failed to persist delivery or read report");
break;
}
// Update thread ID for ReadOrigInd & DeliveryInd.
final ContentValues values = new ContentValues(1);
values.put(Telephony.Mms.THREAD_ID, threadId);
if (SqliteWrapper.update(
context,
context.getContentResolver(),
uri,
values,
null/*where*/,
null/*selectionArgs*/) != 1) {
Log.e(LOGTAG, "Failed to update delivery or read report thread id");
}
break;
}
case MESSAGE_TYPE_NOTIFICATION_IND: {
final NotificationInd nInd = (NotificationInd) pdu;
if (!isDuplicateNotification(context, nInd)) {
final Uri uri = persister.persist(
pdu,
Telephony.Mms.Inbox.CONTENT_URI,
true/*createThreadId*/,
true/*groupMmsEnabled*/,
null/*preOpenedFiles*/);
if (uri == null) {
Log.e(LOGTAG, "Failed to save MMS WAP push notification ind");
}
} else {
Log.d(LOGTAG, "Skip storing duplicate MMS WAP push notification ind: "
+ new String(nInd.getContentLocation()));
}
break;
}
default:
Log.e(LOGTAG, "Received unrecognized WAP Push PDU.");
}
} catch (MmsException e) {
Log.e(LOGTAG, "Failed to save MMS WAP push data: type=" + type, e);
} catch (RuntimeException e) {
Log.e(LOGTAG, "Unexpected RuntimeException in persisting MMS WAP push data", e);
}
}
private static final String THREAD_ID_SELECTION =
Telephony.Mms.MESSAGE_ID + "=? AND " + Telephony.Mms.MESSAGE_TYPE + "=?";
private static long getDeliveryOrReadReportThreadId(Context context, GenericPdu pdu) {
String messageId;
if (pdu instanceof DeliveryInd) {
messageId = new String(((DeliveryInd) pdu).getMessageId());
} else if (pdu instanceof ReadOrigInd) {
messageId = new String(((ReadOrigInd) pdu).getMessageId());
} else {
Log.e(LOGTAG, "WAP Push data is neither delivery or read report type: "
+ pdu.getClass().getCanonicalName());
return -1L;
}
Cursor cursor = null;
try {
cursor = SqliteWrapper.query(
context,
context.getContentResolver(),
Telephony.Mms.CONTENT_URI,
new String[]{ Telephony.Mms.THREAD_ID },
THREAD_ID_SELECTION,
new String[]{
DatabaseUtils.sqlEscapeString(messageId),
Integer.toString(PduHeaders.MESSAGE_TYPE_SEND_REQ)
},
null/*sortOrder*/);
if (cursor != null && cursor.moveToFirst()) {
return cursor.getLong(0);
}
} catch (SQLiteException e) {
Log.e(LOGTAG, "Failed to query delivery or read report thread id", e);
} finally {
if (cursor != null) {
cursor.close();
}
}
return -1L;
}
private static final String LOCATION_SELECTION =
Telephony.Mms.MESSAGE_TYPE + "=? AND " + Telephony.Mms.CONTENT_LOCATION + " =?";
private static boolean isDuplicateNotification(Context context, NotificationInd nInd) {
final byte[] rawLocation = nInd.getContentLocation();
if (rawLocation != null) {
String location = new String(rawLocation);
String[] selectionArgs = new String[] { location };
Cursor cursor = null;
try {
cursor = SqliteWrapper.query(
context,
context.getContentResolver(),
Telephony.Mms.CONTENT_URI,
new String[]{Telephony.Mms._ID},
LOCATION_SELECTION,
new String[]{
Integer.toString(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND),
new String(rawLocation)
},
null/*sortOrder*/);
if (cursor != null && cursor.getCount() > 0) {
// We already received the same notification before.
return true;
}
} catch (SQLiteException e) {
Log.e(LOGTAG, "failed to query existing notification ind", e);
} finally {
if (cursor != null) {
cursor.close();
}
}
}
return false;
}
}

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

@ -1,227 +0,0 @@
/* vim: set ts=4 sw=4 tw=78 et :
* 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.b2gdroid;
import java.io.ByteArrayOutputStream;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.app.PendingIntent;
import android.app.Notification;
import android.app.NotificationManager;
import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;
import android.util.Log;
import org.json.JSONObject;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.util.GeckoEventListener;
public class NotificationObserver extends NotificationListenerService
implements GeckoEventListener {
private static final String LOGTAG = "B2GDroid:NotificationObserver";
private static final String ACTION_REGISTER_FOR_NOTIFICATIONS = AppConstants.ANDROID_PACKAGE_NAME + ".ACTION_REGISTER_FOR_NOTIFICATIONS";
// Map a unique identifier consisting of the notification's
// tag and id. If the notification does not have a tag, the notification
// is keyed on the package name and id to attempt to namespace it
private Map<String, StatusBarNotification> mCurrentNotifications = new HashMap<String, StatusBarNotification>();
@Override
public void onCreate() {
Log.i(LOGTAG, "onCreate()");
super.onCreate();
RemoteGeckoEventProxy.registerRemoteGeckoThreadListener(this, this, "Android:NotificationOpened", "Android:NotificationClosed");
}
@Override
public void onNotificationPosted(StatusBarNotification aNotification, RankingMap aRanking) {
Log.i(LOGTAG, "onNotificationPosted(aNotification, aRanking)");
this.onNotificationPosted(aNotification);
}
@Override
public void onNotificationPosted(StatusBarNotification aNotification) {
Log.i(LOGTAG, "onNotificationPosted(aNotification, aRanking)");
Notification notification = aNotification.getNotification();
CharSequence title = notification.extras.getCharSequence(Notification.EXTRA_TITLE);
CharSequence extraText = notification.extras.getCharSequence(Notification.EXTRA_TEXT);
String notificationKey = getNotificationKey(aNotification);
JSONObject notificationData = new JSONObject();
JSONObject behaviors = new JSONObject();
try {
notificationData.put("_action", "post");
notificationData.put("id", notificationKey);
notificationData.put("title", title.toString());
notificationData.put("text", extraText.toString());
notificationData.put("manifestURL", "android://" + aNotification.getPackageName().toLowerCase() + "/manifest.webapp");
notificationData.put("icon", getBase64Icon(aNotification));
notificationData.put("timestamp", aNotification.getPostTime());
if ((Notification.FLAG_ONGOING_EVENT & notification.flags) != 0) {
notificationData.put("noNotify", true);
}
behaviors.put("vibrationPattern", Arrays.asList(notification.vibrate));
if ((Notification.FLAG_NO_CLEAR & notification.flags) != 0) {
behaviors.put("noclear", true);
}
notificationData.put("mozbehavior", behaviors);
} catch(Exception ex) {
Log.wtf(LOGTAG, "Error building android notification message " + ex.getMessage());
return;
}
mCurrentNotifications.put(notificationKey, aNotification);
sendBroadcast(GeckoEventReceiver.createBroadcastEventIntent("Android:Notification", notificationData.toString()));
}
@Override
public void onNotificationRemoved(StatusBarNotification aNotification, RankingMap aRanking) {
Log.i(LOGTAG, "onNotifciationRemoved(aNotification, aRanking)");
onNotificationRemoved(aNotification);
}
@Override
public void onNotificationRemoved(StatusBarNotification aNotification) {
Log.i(LOGTAG, "onNotificationRemoved(aNotification)");
String notificationKey = getNotificationKey(aNotification);
removeNotificationFromGaia(notificationKey);
}
private void removeNotificationFromGaia(String aNotificationKey) {
Log.i(LOGTAG, "removeNotificationFromGaia(aNotificationKey=" + aNotificationKey + ")");
JSONObject notificationData = new JSONObject();
mCurrentNotifications.remove(aNotificationKey);
try {
notificationData.put("_action", "remove");
notificationData.put("id", aNotificationKey);
} catch(Exception ex) {
Log.wtf(LOGTAG, "Error building android notification message " + ex.getMessage());
return;
}
sendBroadcast(GeckoEventReceiver.createBroadcastEventIntent("Android:Notification", notificationData.toString()));
}
private String getNotificationKey(StatusBarNotification aNotification) {
// API Level 20 has a 'getKey' method, however for backwards we
// implement this getNotificationKey
String notificationTag = aNotification.getTag();
if (notificationTag == null) {
notificationTag = aNotification.getPackageName();
}
return notificationTag + "#" + Integer.toString(aNotification.getId());
}
private String getBase64Icon(StatusBarNotification aStatusBarNotification) {
Notification notification = aStatusBarNotification.getNotification();
PackageManager manager = getPackageManager();
Resources notifyingPackageResources;
Bitmap bitmap = null;
try {
notifyingPackageResources = manager.getResourcesForApplication(aStatusBarNotification.getPackageName());
int resourceId = notification.icon;
bitmap = BitmapFactory.decodeResource(notifyingPackageResources, resourceId);
} catch(NameNotFoundException ex) {
Log.i(LOGTAG, "Could not find package name: " + ex.getMessage());
}
if (bitmap == null) {
// Try and get the icon directly from the notification
if (notification.largeIcon != null) {
bitmap = notification.largeIcon;
} else {
Log.i(LOGTAG, "No image found for notification");
return "";
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
return "data:image/png;base64," + Base64.encodeToString(baos.toByteArray(), Base64.NO_WRAP);
}
/* GeckoEventListener */
public void handleMessage(String aEvent, JSONObject message) {
Log.i(LOGTAG, "handleMessage(aEvent=" + aEvent + ")");
String notificationId;
try {
notificationId = message.getString("id");
} catch(Exception ex) {
Log.i(LOGTAG, "Malformed Android:NotificationOpened JSON - missing ID");
return;
}
StatusBarNotification sbNotification = mCurrentNotifications.get(notificationId);
if (sbNotification == null) {
Log.w(LOGTAG, "No notification found for ID: " + notificationId);
return;
}
if ("Android:NotificationOpened".equals(aEvent)) {
PendingIntent contentIntent = sbNotification.getNotification().contentIntent;
try {
contentIntent.send();
} catch(Exception ex) {
Log.i(LOGTAG, "Intent was cancelled");
}
removeNotificationFromGaia(notificationId);
return;
} else if("Android:NotificationClose".equals(aEvent)) {
NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
notificationManager.cancel(sbNotification.getTag(), sbNotification.getId());
mCurrentNotifications.remove(notificationId);
}
}
public static void registerForNativeNotifications(Context context) {
Intent intent = createNotificationIntent(context, ACTION_REGISTER_FOR_NOTIFICATIONS);
context.startService(intent);
}
private static Intent createNotificationIntent(Context context, String action) {
return new Intent(action, /* URI */ null, context, NotificationObserver.class);
}
}

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

@ -1,96 +0,0 @@
/* vim: set ts=4 sw=4 tw=78 et :
* 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.b2gdroid;
import android.util.Log;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.Context;
import android.content.BroadcastReceiver;
import org.json.JSONObject;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.AppConstants;
/**
* Proxy GeckoEvents from the Java UI Thread to other processes owned by this
* app - deferring processing to those processes.
*
* Usage:
*
* // In remote process `context` given GeckoEventListener `listener`
* RemoteGeckoEventProxy
* .registerRemoteGeckoThreadListener(context, listener, "Message:Message");
*
* // In UI Thread (Main Activity `context`)
* RemoteGeckoEventProxy mGeckoEventProxy = new RemoteGeckoEventProxy(context);
* EventDispatcher
* .getInstance()
* .registerGeckoThreadListener(mGeckoEventProxy, "Message:Message");
*/
class RemoteGeckoEventProxy implements GeckoEventListener {
private static final String LOGTAG = "RemoteGeckoEventProxy";
private static final String RECEIVE_GECKO_EVENT = AppConstants.ANDROID_PACKAGE_NAME + ".RECEIVE_GECKO_EVENT";
private static final String EXTRA_DATA = "DATA";
private static final String EXTRA_SUBJECT = "SUBJECT";
private Context mSenderContext;
public static void registerRemoteGeckoThreadListener(Context aContext, GeckoEventListener mListener, String... aMessages) {
for (String message : aMessages) {
IntentFilter intentFilter = new IntentFilter(RECEIVE_GECKO_EVENT + "." + message);
aContext.registerReceiver(new GeckoEventProxyReceiver(mListener), intentFilter);
}
}
public RemoteGeckoEventProxy(Context aSenderContext) {
mSenderContext = aSenderContext;
}
public void handleMessage(String aEvent, JSONObject aMessage) {
Intent broadcastIntent = createBroadcastIntent(aEvent, aMessage.toString());
mSenderContext.sendBroadcast(broadcastIntent);
}
private static Intent createBroadcastIntent(String aEvent, String aMessage) {
Intent intent = new Intent(RECEIVE_GECKO_EVENT + "." + aEvent);
intent.putExtra(EXTRA_SUBJECT, aEvent);
intent.putExtra(EXTRA_DATA, aMessage);
return intent;
}
static class GeckoEventProxyReceiver extends BroadcastReceiver {
private GeckoEventListener mGeckoEventListener;
public GeckoEventProxyReceiver(GeckoEventListener aEventListener) {
mGeckoEventListener = aEventListener;
}
@Override
public void onReceive(Context aContext, Intent aIntent) {
String geckoEventSubject = aIntent.getStringExtra(EXTRA_SUBJECT);
String geckoEventJSON = aIntent.getStringExtra(EXTRA_DATA);
// Unwrap the message data and invoke the GeckoEventListener
JSONObject obj;
try {
obj = new JSONObject(geckoEventJSON);
obj = obj.getJSONObject("value");
} catch(Exception ex) {
Log.wtf(RemoteGeckoEventProxy.LOGTAG, "Could not decode JSON payload for message: " + geckoEventSubject);
return;
}
mGeckoEventListener.handleMessage(geckoEventSubject, obj);
}
}
}

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

@ -1,57 +0,0 @@
/* 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.b2gdroid;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
class ScreenStateObserver extends BroadcastReceiver {
private static final String LOGTAG = "B2G";
ScreenStateObserver(Context context) {
Log.d(LOGTAG, "ScreenStateObserver constructor");
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_SCREEN_OFF);
context.registerReceiver(this, filter);
}
void destroy(Context context) {
Log.d(LOGTAG, "ScreenStateObserver::unint");
context.unregisterReceiver(this);
}
@Override
public void onReceive(Context context, Intent intent) {
Log.d(LOGTAG, "ScreenStateObserver: " + intent.getAction());
String action = "no_op";
switch(intent.getAction()) {
case "android.intent.action.SCREEN_ON":
action = "screen_on";
break;
case "android.intent.action.SCREEN_OFF":
action = "screen_off";
break;
}
JSONObject obj = new JSONObject();
try {
obj.put("action", action);
} catch(JSONException ex) {
Log.wtf(LOGTAG, "Error building Android:Launcher message", ex);
}
GeckoEvent e = GeckoEvent.createBroadcastEvent("Android:Launcher", obj.toString());
GeckoAppShell.sendEventToGecko(e);
}
}

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

@ -1,306 +0,0 @@
/* 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.b2gdroid;
import java.io.ByteArrayOutputStream;
import java.util.Hashtable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.WallpaperManager;
import android.content.Context;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Handler;
import android.provider.Settings.System;
import android.telephony.TelephonyManager;
import android.util.Base64;
import android.util.Log;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.util.GeckoEventListener;
// This class communicates back and forth with MessagesBridge.jsm to
// map Android configuration settings and gaia settings.
// Each setting extends the base BaseMapping class to normalize values
// when needed.
class SettingsMapper extends ContentObserver implements GeckoEventListener {
private static final String LOGTAG = "SettingsMapper";
private Context mContext;
private Hashtable<String, BaseMapping> mGeckoSettings;
private Hashtable<String, BaseMapping> mAndroidSettings;
abstract class BaseMapping {
// Returns the list of gaia settings that are managed this class.
abstract String[] getGeckoSettings();
// Returns the list of android settings that are managed this class.
abstract String[] getAndroidSettings();
// Called when we a registered gecko setting changes.
abstract void onGeckoChange(String setting, JSONObject message);
// Called when we a registered android setting changes.
abstract void onAndroidChange(Uri uri);
void sendGeckoSetting(String name, String value) {
JSONObject obj = new JSONObject();
try {
obj.put(name, value);
sendGeckoSetting(obj);
} catch(JSONException e) {
Log.d(LOGTAG, e.toString());
}
}
void sendGeckoSetting(String name, long value) {
JSONObject obj = new JSONObject();
try {
obj.put(name, value);
sendGeckoSetting(obj);
} catch(JSONException e) {
Log.d(LOGTAG, e.toString());
}
}
void sendGeckoSetting(JSONObject obj) {
GeckoEvent e = GeckoEvent.createBroadcastEvent("Android:Setting", obj.toString());
GeckoAppShell.sendEventToGecko(e);
}
}
class ScreenTimeoutMapping extends BaseMapping {
ScreenTimeoutMapping() {}
String[] getGeckoSettings() {
String props[] = {"screen.timeout"};
return props;
}
String[] getAndroidSettings() {
String props[] = {"content://settings/system/screen_off_timeout"};
return props;
}
void onGeckoChange(String setting, JSONObject message) {
try {
int timeout = message.getInt("value");
// b2g uses seconds for the timeout while Android expects ms.
// "never" is 0 in b2g, -1 in Android.
if (timeout == 0) {
timeout = -1;
} else {
timeout *= 1000;
}
System.putInt(mContext.getContentResolver(),
System.SCREEN_OFF_TIMEOUT,
timeout);
} catch(Exception ex) {
Log.d(LOGTAG, "Error setting screen.timeout value", ex);
}
}
void onAndroidChange(Uri uri) {
try {
int timeout = System.getInt(mContext.getContentResolver(),
System.SCREEN_OFF_TIMEOUT);
Log.d(LOGTAG, "Android set timeout to " + timeout);
// Convert to a gaia timeout.
timeout /= 1000;
sendGeckoSetting("screen.timeout", timeout);
} catch(Exception e) {}
}
}
class WallpaperMapping extends BaseMapping {
private Context mContext;
WallpaperMapping(Context context) {
mContext = context;
}
String[] getGeckoSettings() {
String props[] = {"wallpaper.image"};
return props;
}
String[] getAndroidSettings() {
String props[] = {};
return props;
}
void onGeckoChange(String setting, JSONObject message) {
try {
final String url = message.getString("value");
Log.d(LOGTAG, "wallpaper.image is now " + url);
WallpaperManager manager = WallpaperManager.getInstance(mContext);
// Remove the data:image/png;base64, prefix from the url.
byte[] raw = Base64.decode(url.substring(22), Base64.NO_WRAP);
Bitmap bitmap = BitmapFactory.decodeByteArray(raw, 0, raw.length);
if (bitmap == null) {
Log.d(LOGTAG, "Unable to create a bitmap!");
}
manager.setBitmap(bitmap);
} catch(Exception ex) {
Log.d(LOGTAG, "Error setting wallpaper", ex);
}
}
// Android doesn't notify on wallpaper changes.
void onAndroidChange(Uri uri) { }
}
SettingsMapper(Context context, Handler handler) {
super(handler);
mContext = context;
EventDispatcher.getInstance()
.registerGeckoThreadListener(this,
"Settings:Change",
"Android:GetIMEI",
"Android:GetWallpaper");
mContext.getContentResolver()
.registerContentObserver(System.CONTENT_URI,
true,
this);
mGeckoSettings = new Hashtable<String, BaseMapping>();
mAndroidSettings = new Hashtable<String, BaseMapping>();
// Add all the mappings.
addMapping(new ScreenTimeoutMapping());
addMapping(new WallpaperMapping(mContext));
}
void addMapping(BaseMapping mapping) {
String[] props = mapping.getGeckoSettings();
for (int i = 0; i < props.length; i++) {
mGeckoSettings.put(props[i], mapping);
}
props = mapping.getAndroidSettings();
for (int i = 0; i < props.length; i++) {
mAndroidSettings.put(props[i], mapping);
}
}
void destroy() {
EventDispatcher.getInstance()
.unregisterGeckoThreadListener(this,
"Settings:Change",
"Android:GetIMEI",
"Android:GetWallpaper");
mGeckoSettings.clear();
mGeckoSettings = null;
mAndroidSettings.clear();
mAndroidSettings = null;
mContext.getContentResolver().unregisterContentObserver(this);
}
public void handleMessage(String event, JSONObject message) {
Log.w(LOGTAG, "Received " + event);
if ("Settings:Change".equals(event)) {
try {
String setting = message.getString("setting");
BaseMapping mapping = mGeckoSettings.get(setting);
if (mapping != null) {
Log.d(LOGTAG, "Changing gecko setting " + setting);
mapping.onGeckoChange(setting, message);
} else {
Log.d(LOGTAG, "No gecko mapping registered for " + setting);
}
} catch(Exception ex) {
Log.d(LOGTAG, "Error getting setting name", ex);
}
} else if ("Android:GetIMEI".equals(event)) {
TelephonyManager telManager =
(TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE);
JSONObject ret = new JSONObject();
Log.d(LOGTAG, "Getting IMEI: " + telManager.getDeviceId());
try {
ret.put("imei", telManager.getDeviceId());
} catch(Exception jsonEx) {
Log.wtf(LOGTAG, "Error getting IMEI", jsonEx);
}
EventDispatcher.sendResponse(message, ret);
} else if ("Android:GetWallpaper".equals(event)) {
WallpaperManager wpManager = WallpaperManager.getInstance(mContext);
Drawable drawable = wpManager.getDrawable();
// Convert the drawable to a base64 url, using a bitmap.
Bitmap bitmap = null;
if (drawable instanceof BitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
if(bitmapDrawable.getBitmap() != null) {
bitmap = bitmapDrawable.getBitmap();
}
}
if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Single color bitmap will be created of 1x1 pixel
} else {
bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(),
Bitmap.Config.ARGB_8888);
}
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
byte b [] = baos.toByteArray();
final String uri = "data:image/png;base64," + Base64.encodeToString(b, Base64.NO_WRAP);
JSONObject ret = new JSONObject();
try {
ret.put("wallpaper", uri);
} catch(Exception jsonEx) {
Log.wtf(LOGTAG, "Error getting Wallpaper", jsonEx);
}
EventDispatcher.sendResponse(message, ret);
}
}
// ContentObserver, see
// http://developer.android.com/reference/android/database/ContentObserver.html
@Override
public boolean deliverSelfNotifications() {
return false;
}
@Override
public void onChange(boolean selfChange) {
onChange(selfChange, null);
}
@Override
public void onChange(boolean selfChange, Uri uri) {
super.onChange(selfChange);
Log.d(LOGTAG, "Settings change detected uri=" + uri);
BaseMapping mapping = mAndroidSettings.get(uri.toString());
if (mapping != null) {
Log.d(LOGTAG, "Changing android setting " + uri);
mapping.onAndroidChange(uri);
} else {
Log.d(LOGTAG, "No android mapping registered for " + uri);
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 10 KiB

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

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/main_layout">
<org.mozilla.gecko.GeckoView android:id="@+id/gecko_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<RelativeLayout android:id="@+id/splashscreen"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView android:id="@+id/splashscreen_icon"
android:minWidth="128dip"
android:minHeight="128dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/b2g"/>
<ProgressBar android:id="@+id/splashscreen_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:paddingBottom="30dip"/>
</RelativeLayout>
</RelativeLayout>

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

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="b2g">Firefox OS developer preview</string>
<!-- If MMS discovers there isn't much space left on the device, it will show a toast with this message. -->
<string name="low_memory" product="tablet">Tablet storage is full! Delete some files to free space.</string>
<!-- If MMS discovers there isn't much space left on the device, it will show a toast with this message. -->
<string name="low_memory" product="default">Phone storage is full! Delete some files to free space.</string>
</resources>

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

@ -1,8 +0,0 @@
# 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/.
ANDROID_PACKAGE_NAME=org.mozilla.b2gdroid_`echo $USER | sed 's/-/_/g'`
MOZ_APP_DISPLAYNAME="B2GDroid `echo $USER | sed 's/-/_/g'`"
MOZ_UPDATER=1
MOZ_ANDROID_ANR_REPORTER=

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.9 KiB

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

@ -1,9 +0,0 @@
# 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/.
chrome.jar:
% content branding %content/branding/ contentaccessible=yes
content/branding/about.png (about.png)
content/branding/favicon32.png (favicon32.png)
content/branding/favicon64.png (favicon64.png)

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

@ -1,7 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
JAR_MANIFESTS += ['jar.mn']

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

@ -1,7 +0,0 @@
<!-- 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/. -->
<!ENTITY brandShortName "B2GDroid">
<!ENTITY brandFullName "Mozilla B2GDroid">
<!ENTITY vendorShortName "Mozilla">

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

@ -1,6 +0,0 @@
# 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/.
brandShortName=B2GDroid
brandFullName=Mozilla B2GDroid

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

@ -1,11 +0,0 @@
#filter substitution
# 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/.
@AB_CD@.jar:
% locale branding @AB_CD@ %locale/branding/
# Nightly branding only exists in en-US
locale/branding/brand.dtd (en-US/brand.dtd)
locale/branding/brand.properties (en-US/brand.properties)

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

@ -1,7 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
JAR_MANIFESTS += ['jar.mn']

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

@ -1,7 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DIRS += ['content', 'locales']

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.0 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 21 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 18 KiB

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

@ -1,63 +0,0 @@
# 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/.
include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
installer:
@$(MAKE) -C mobile/android/b2gdroid/installer installer
package:
@$(MAKE) -C mobile/android/b2gdroid/installer
ifeq ($(OS_TARGET),Android)
ifneq ($(MOZ_ANDROID_INSTALL_TARGET),)
ANDROID_SERIAL = $(MOZ_ANDROID_INSTALL_TARGET)
endif
ifneq ($(ANDROID_SERIAL),)
export ANDROID_SERIAL
else
# Determine if there's more than one device connected
android_devices=$(filter device,$(shell $(ADB) devices))
ifeq ($(android_devices),)
install::
@echo 'No devices are connected. Connect a device or start an emulator.'
@exit 1
else
ifneq ($(android_devices),device)
install::
@echo 'Multiple devices are connected. Define ANDROID_SERIAL to specify the install target.'
$(ADB) devices
@exit 1
endif
endif
endif
install::
$(ADB) install -r $(DIST)/$(PKG_PATH)$(PKG_BASENAME).apk
else
@echo 'B2GDroid can't be installed directly.'
@exit 1
endif
deb: package
@$(MAKE) -C mobile/android/b2gdroid/installer deb
upload::
@$(MAKE) -C mobile/android/b2gdroid/installer upload
ifdef ENABLE_TESTS
# Implemented in testing/testsuite-targets.mk
mochitest-browser-chrome:
$(RUN_MOCHITEST) --browser-chrome
$(CHECK_TEST_ERROR)
mochitest:: mochitest-browser-chrome
.PHONY: mochitest-browser-chrome
endif
ifeq ($(OS_TARGET),Linux)
deb: installer
endif

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

@ -1,224 +0,0 @@
/* 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/. */
this.EXPORTED_SYMBOLS = ["MessagesBridge"];
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/SystemAppProxy.jsm");
Cu.import("resource://gre/modules/Messaging.jsm");
Cu.import("resource://gre/modules/AppsUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "appsService",
"@mozilla.org/AppsService;1",
"nsIAppsService");
XPCOMUtils.defineLazyServiceGetter(this, "settings",
"@mozilla.org/settingsService;1",
"nsISettingsService");
// This module receives messages from Launcher.java as observer notifications.
// It also listens for settings changes to relay them back to Android.
function debug() {
dump("-*- MessagesBridge " + Array.slice(arguments) + "\n");
}
function getWindow() {
return SystemAppProxy.getFrame().contentWindow ||
Services.wm.getMostRecentWindow("navigator:browser");
}
// To prevent roundtrips like android -> gecko -> android we keep track of
// in flight setting changes.
var _blockedSettings = new Set();
this.MessagesBridge = {
init: function() {
Services.obs.addObserver(this.onAndroidMessage, "Android:Launcher", false);
Services.obs.addObserver(this.onAndroidSetting, "Android:Setting", false);
Services.obs.addObserver(this.onSettingChange, "mozsettings-changed", false);
Services.obs.addObserver(this.onAndroidNotification, "Android:Notification", false);
Services.obs.addObserver(this, "xpcom-shutdown", false);
SystemAppProxy.addEventListener("mozContentNotificationEvent", this);
// Send a request to get the device's IMEI.
Messaging.sendRequestForResult({ type: "Android:GetIMEI" })
.then(aData => {
debug("Got IMEI: " + aData.imei);
let lock = settings.createLock();
lock.set("deviceinfo.imei", aData.imei, null);
});
},
handleEvent: function(evt) {
let detail = evt.detail;
switch(detail.type) {
case "desktop-notification-click":
debug("Sending Android:NotificationOpened");
Messaging.sendRequest({ type: "Android:NotificationOpened", value: { id: detail.id }});
break;
case "desktop-notification-close":
// On receipt of a notification close, send the id to the Android layer
// so it can be removed from the Android NotificationManager.
debug("Sending Android:NotificationClosed");
Messaging.sendRequest({ type: "Android:NotificationClosed", value: { id: detail.id }});
break;
}
},
onAndroidNotification: function(aSubject, aTopic, aData) {
let data = JSON.parse(aData);
debug("Got android notification: " + data._action);
switch(data._action) {
case "post":
debug("showNotification(id=" + data.id + ")");
showNotification(data);
break;
case "remove":
debug("removeNotification(id=" + data.id + ")");
removeNotification(data);
break;
}
},
onAndroidMessage: function(aSubject, aTopic, aData) {
let data = JSON.parse(aData);
debug(`Got Android:Launcher message ${data.action}`);
let window = getWindow();
switch (data.action) {
case "screen_on":
case "screen_off":
// In both cases, make it look like pressing the power button
// by dispatching keydown & keyup on the system app window.
window.dispatchEvent(new window.KeyboardEvent("keydown", { key: "Power" }));
window.dispatchEvent(new window.KeyboardEvent("keyup", { key: "Power" }));
break;
case "view":
let a = new window.MozActivity({ name: "view",
data: { type: "url",
url: data.url } });
break;
case "send_sms":
new window.MozActivity({
name: "new",
data: {
type: "websms/sms",
number: data.number,
body: data.body
}
});
break;
case "home-key":
window.dispatchEvent(new window.KeyboardEvent("keydown", { key: "Home" }));
window.dispatchEvent(new window.KeyboardEvent("keyup", { key: "Home" }));
break;
case "task-switcher":
window.dispatchEvent(new window.CustomEvent("taskmanagershow", {}));
break;
case "back-key":
Services.obs.notifyObservers(null, "back-docommand", null);
break;
}
},
onAndroidSetting: function(aSubject, aTopic, aData) {
let data = JSON.parse(aData);
let lock = settings.createLock();
let key = Object.keys(data)[0];
debug(`Got Android:Setting message ${key} -> ${data[key]}`);
// Don't relay back to android the same setting change.
_blockedSettings.add(key);
lock.set(key, data[key], null);
},
onSettingChange: function(aSubject, aTopic, aData) {
if ("wrappedJSObject" in aSubject) {
aSubject = aSubject.wrappedJSObject;
}
if (aSubject) {
debug("Got setting change: " + aSubject.key + " -> " + aSubject.value);
if (_blockedSettings.has(aSubject.key)) {
_blockedSettings.delete(aSubject.key);
debug("Rejecting blocked setting change for " + aSubject.key);
return;
}
let window = getWindow();
if (aSubject.value instanceof window.Blob) {
debug(aSubject.key + " is a Blob");
let reader = new window.FileReader();
reader.readAsDataURL(aSubject.value);
reader.onloadend = function() {
Messaging.sendRequest({ type: "Settings:Change",
setting: aSubject.key,
value: reader.result });
}
} else {
Messaging.sendRequest({ type: "Settings:Change",
setting: aSubject.key,
value: aSubject.value });
}
}
},
observe: function(aSubject, aTopic, aData) {
if (aTopic == "xpcom-shutdown") {
Services.obs.removeObserver(this.onAndroidMessage, "Android:Launcher");
Services.obs.removeObserver(this.onAndroidSetting, "Android:Setting");
Services.obs.removeObserver(this.onSettingChange, "mozsettings-changed");
Services.obs.removeObserver(this.onAndroidNotification, "Android:Notification");
Services.obs.removeObserver(this, "xpcom-shutdown");
}
}
}
function removeNotification(aDetail) {
// Remove the notification
SystemAppProxy._sendCustomEvent("mozChromeNotificationEvent", {
type: "desktop-notification-close",
id: aDetail.id
});
}
function showNotification(aDetail) {
const manifestURL = aDetail.manifestURL;
function send(appName) {
aDetail.type = "desktop-notification";
aDetail.appName = appName;
SystemAppProxy._sendCustomEvent("mozChromeNotificationEvent", aDetail);
}
if (!manifestURL|| !manifestURL.length) {
send(null);
return;
}
// If we have a manifest URL, get the app title from the manifest
// to prevent spoofing.
appsService.getManifestFor(manifestURL).then((manifest) => {
let app = appsService.getAppByManifestURL(manifestURL);
// Sometimes an android notification may be created by a service rather
// than an app. In this case, don't use the appName.
if (!app) {
send(null);
return;
}
let helper = new ManifestHelper(manifest, app.origin, manifestURL);
send(helper.name);
});
}
this.MessagesBridge.init();

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

@ -1,270 +0,0 @@
/* 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/. */
"use strict";
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/MessagesBridge.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppsUtils",
"resource://gre/modules/AppsUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "settings",
"@mozilla.org/settingsService;1",
"nsISettingsService");
function debug() {
dump("-*- B2GDroidSetup " + Array.slice(arguments) + "\n");
}
function B2GDroidSetup() {
this.wrappedJSObject = this;
this.isFirstRun = true;
}
B2GDroidSetup.prototype = {
classID: Components.ID('{8bc88ef2-3aab-4e94-a40c-e2c80added2c}'),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
// Returns a promise that resolves once we have set the wallpaper.image
// setting in sync with Android's wallpaper.
setWallpaper: function() {
if (!this.isFirstRun) {
return Promise.resolve();
}
debug("Getting wallpaper");
Cu.import("resource://gre/modules/Messaging.jsm");
return Messaging.sendRequestForResult({ type: "Android:GetWallpaper" })
.then(aData => {
settings.createLock().set("wallpaper.image", aData.wallpaper, null);
return Promise.resolve();
});
},
getApk: function() {
let registry = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
let url = registry.convertChromeURL(
Services.io.newURI("chrome://b2g/content/shell.html", null, null)).spec;
// url is something like jar:jar:file:///data/app/org.mozilla.fennec_fabrice-1.apk!/assets/omni.ja!/chrome/chrome/content/shell.html
// and we just need the apk file path.
let path = url.substring(url.indexOf("///") + 2, url.indexOf(".apk") + 4);
debug("apk path: " + path);
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(path);
return file;
},
installWebapps: function(aDir) {
debug("Extracting webapps");
let apk = this.getApk();
let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"]
.createInstance(Ci.nsIZipReader);
zipReader.open(apk);
// Get the target file for a zip entry, normalizing it to remove the
// assets/gaia part.
function getTargetFile(aDir, entry) {
let target = aDir.clone();
let part = 0;
entry.split("/").forEach(aPart => {
if (part > 1) {
target.append(aPart);
}
part++;
});
return target;
}
try {
// create directories first
let entries = zipReader.findEntries("assets/gaia/webapps/*");
while (entries.hasMore()) {
let entryName = entries.getNext();
let entry = zipReader.getEntry(entryName);
let target = getTargetFile(aDir, entryName);
if (!target.exists() && entry.isDirectory) {
try {
debug("Creating " + entryName);
target.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
}
catch (e) {
debug("extractFiles: failed to create directory " + target.path + " : " + e);
}
}
}
entries = zipReader.findEntries("assets/gaia/webapps/*");
while (entries.hasMore()) {
let entryName = entries.getNext();
let target = getTargetFile(aDir, entryName);
if (target.exists())
continue;
debug("Extracting " + entryName + " to " + target.path);
zipReader.extract(entryName, target);
try {
target.permissions |= FileUtils.PERMS_FILE;
}
catch (e) {
debug("Failed to set permissions " + aPermissions.toString(8) + " on " + target.path);
}
}
}
finally {
zipReader.close();
}
debug("Webapps extracted");
},
installSettings: function(aDir) {
debug("Installing default settings");
let apk = this.getApk();
let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"]
.createInstance(Ci.nsIZipReader);
zipReader.open(apk);
try {
let dest = aDir.clone();
dest.append("settings.json")
zipReader.extract("assets/gaia/settings.json", dest);
debug("Default settings installed to " + dest.path);
}
catch(e) {
dump("Error extracting settings.json : " + e);
}
finally {
zipReader.close();
}
},
shellStartup: function(aWindow) {
Services.androidBridge.browserApp = {
selectedTab: function() {
debug("browserApp::selectedTab");
return null;
},
getBrowserTab: function(aTabId) {
debug("browserApp::getBrowserTab " + aTabId);
return null;
},
getPreferences: function(aRequestId, aPrefNames, aCount) {
debug("browserApp::getPreferences " + uneval(aPrefNames));
let prefs = [];
for (let prefName of aPrefNames) {
let pref = {
name: prefName,
type: "",
value: null
};
try {
switch (Services.prefs.getPrefType(prefName)) {
case Ci.nsIPrefBranch.PREF_BOOL:
pref.type = "bool";
pref.value = Services.prefs.getBoolPref(prefName);
break;
case Ci.nsIPrefBranch.PREF_INT:
pref.type = "int";
pref.value = Services.prefs.getIntPref(prefName);
break;
case Ci.nsIPrefBranch.PREF_STRING:
default:
pref.type = "string";
try {
// Try in case it's a localized string (will throw an exception if not)
pref.value = Services.prefs.getComplexValue(prefName, Ci.nsIPrefLocalizedString).data;
} catch (e) {
pref.value = Services.prefs.getCharPref(prefName);
}
break;
}
} catch (e) {
debug("Error reading pref [" + prefName + "]: " + e);
// preference does not exist; do not send it
continue;
}
prefs.push(pref);
}
Messaging.sendRequest({
type: "Preferences:Data",
requestId: aRequestId, // opaque request identifier, can be any string/int/whatever
preferences: prefs
});
},
observePreferences: function(requestId, prefNames, count) {
debug("browserApp::observePreferences " + prefNames);
},
removePreferenceObservers: function(aRequestId) {
debug("browserApp::removePreferenceObservers");
},
getUITelemetryObserver: function() {
debug("browserApp:getUITelemetryObserver");
return null;
}
};
Cu.import("resource://gre/modules/Messaging.jsm");
Messaging.sendRequest({ type: "Launcher:Ready" });
Messaging.sendRequest({ type: "Gecko:Ready" });
debug("Sent Gecko:Ready");
aWindow.top.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).isFirstPaint = true;
Services.androidBridge.contentDocumentChanged();
},
observe: function (aSubject, aTopic, aData) {
debug("observer notification: " + aTopic);
if (aTopic === "shell-startup") {
this.shellStartup(aSubject);
return;
}
if (aTopic !== "profile-after-change") {
return;
}
// At first run of after updates, unpack gaia.
let branch = Services.prefs.getBranch("b2gdroid");
if (!AppsUtils.isFirstRun(branch)) {
debug("No need to unpack gaia again.");
this.isFirstRun = false;
return;
}
let profile = Services.dirsvc.get("DefRt", Ci.nsIFile);
debug("profile directory is " + profile.path);
let webapps = profile.clone();
webapps.append("webapps");
webapps.append("webapps.json");
this.installWebapps(profile);
let settings = profile.clone();
settings.append("settings.json");
this.installSettings(profile);
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([B2GDroidSetup]);

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

@ -1,4 +0,0 @@
# Setup.js
component {8bc88ef2-3aab-4e94-a40c-e2c80added2c} Setup.js process=main
contract @mozilla.org/b2g/b2gdroid-setup;1 {8bc88ef2-3aab-4e94-a40c-e2c80added2c} process=main
category profile-after-change B2GDroidSetup @mozilla.org/b2g/b2gdroid-setup;1 process=main

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

@ -1,12 +0,0 @@
# 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/.
EXTRA_COMPONENTS += [
'b2gdroid.manifest',
'Setup.js',
]
EXTRA_JS_MODULES += [
'MessagesBridge.jsm',
]

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

@ -1,74 +0,0 @@
# 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/.
# This file is included at the top of all native android mozconfigs
if [ "x$IS_NIGHTLY" = "xyes" ]; then
MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
fi
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/build/mozconfig.common"
# In TaskCluster, the Java JRE/JDK are installed from tooltool, but that
# install doesn't work on the old Buildbot mock builders (CentOS 6.2), so
# the relevant env vars are not set up in that case, leaving the build to
# run from the JRE/JDK in /usr/lib/jvm.
if [ ! -f /etc/redhat-release ] || [ "$(< /etc/redhat-release)" != "CentOS release 6.2 (Final)" ]; then
# set JAVA_HOME to find the JRE/JDK from tooltool. Several scripts in the JDK
# assume `java` is in PATH, so set that too. To see how this tarball is built,
# see testing/taskcluster/scripts/misc/repackage-jdk.sh
export JAVA_HOME="$topsrcdir/java_home"
export PATH="$PATH:$topsrcdir/java_home/bin"
mk_add_options "export JAVA_HOME=$topsrcdir/java_home"
mk_add_options "export PATH=$PATH:$topsrcdir/java_home/bin"
fi
# Set the most aggressive settings for szip. Not the default because it's
# much slower and we didn't want to slow down developers builds.
# Has no effect when MOZ_ENABLE_SZIP is not set in mobile/android/confvars.sh.
MOZ_SZIP_FLAGS="-D auto -f auto"
ac_add_options --enable-elf-hack
ANDROID_NDK_VERSION="r10e"
ANDROID_NDK_VERSION_32BIT="r10c"
# Build B2GDroid
ac_add_options --enable-application=mobile/android/b2gdroid
ac_add_options --with-android-min-sdk=15
ac_add_options --with-android-ndk="$topsrcdir/android-ndk-r10e"
ac_add_options --with-android-sdk="$topsrcdir/android-sdk-linux"
ac_add_options --with-android-gnu-compiler-version=4.9
ac_add_options --with-android-version=9
ac_add_options --with-system-zlib
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
ac_add_options --with-mozilla-api-keyfile=/builds/mozilla-fennec-geoloc-api.key
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
# Use ccache
. "$topsrcdir/build/mozconfig.cache"
HOST_CC="$topsrcdir/gcc/bin/gcc"
HOST_CXX="$topsrcdir/gcc/bin/g++"
# Avoid dependency on libstdc++ 4.7
ac_add_options --enable-stdcxx-compat
JS_BINARY="$topsrcdir/mobile/android/config/js_wrapper.sh"
# Configure gaia
GAIADIR=$topsrcdir/gaia
# Add moz-tt fonts
MOZTTDIR=$topsrcdir/moz-tt

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

@ -1,8 +0,0 @@
# 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/.
# This file is included at the bottom of all native android mozconfigs
. "$topsrcdir/build/mozconfig.common.override"
. "$topsrcdir/build/mozconfig.cache"

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

@ -1,17 +0,0 @@
. "$topsrcdir/mobile/android/b2gdroid/config/mozconfigs/common"
ac_add_options --enable-profiling
# Android
ac_add_options --target=arm-linux-androideabi
ac_add_options --with-branding=mobile/android/b2gdroid/branding/unofficial
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling with eideticker. See bug 788680
STRIP_FLAGS="--strip-debug"
export MOZILLA_OFFICIAL=1
export MOZ_TELEMETRY_REPORTING=1
. "$topsrcdir/mobile/android/b2gdroid/config/mozconfigs/common.override"

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

@ -1,108 +0,0 @@
# 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/.
MOZ_APP_BASENAME=B2GDroid
MOZ_APP_VENDOR=Mozilla
MOZ_B2GDROID=1
MOZ_B2G=1
MOZ_APP_VERSION=$FIREFOX_VERSION
MOZ_APP_UA_NAME=Firefox
MOZ_UA_OS_AGNOSTIC=1
MOZ_B2G_VERSION=2.6.0.0-prerelease
MOZ_B2G_OS_NAME=Boot2Gecko
MOZ_BRANDING_DIRECTORY=mobile/android/b2gdroid/branding/unofficial
MOZ_OFFICIAL_BRANDING_DIRECTORY=mobile/android/b2gdroid/branding/official
# MOZ_APP_DISPLAYNAME is set by branding/configure.sh
# We support Android SDK version 15 and up by default.
# See the --enable-android-min-sdk and --enable-android-max-sdk arguments in configure.in.
MOZ_ANDROID_MIN_SDK_VERSION=15
# There are several entry points into the Firefox application. These are the names of some of the classes that are
# listed in the Android manifest. They are specified in here to avoid hard-coding them in source code files.
MOZ_ANDROID_APPLICATION_CLASS=org.mozilla.gecko.GeckoApplication
MOZ_ANDROID_BROWSER_INTENT_CLASS=org.mozilla.gecko.BrowserApp
MOZ_ANDROID_SEARCH_INTENT_CLASS=org.mozilla.search.SearchActivity
MOZ_SAFE_BROWSING=1
MOZ_NO_SMART_CARDS=1
# Enable getUserMedia
MOZ_MEDIA_NAVIGATOR=1
# Enable NFC permission
MOZ_ANDROID_BEAM=1
MOZ_XULRUNNER=
MOZ_CAPTURE=1
MOZ_RAW=1
MOZ_PLACES=
MOZ_SOCIAL=
MOZ_ANDROID_HISTORY=1
MOZ_ANDROID_APZ=1
# use custom widget for html:select
MOZ_USE_NATIVE_POPUP_WINDOWS=1
MOZ_APP_ID={f7b06d8d-139c-459a-85fa-46bc6c52e2b7}
MOZ_APP_STATIC_INI=1
# Enable on-demand decompression. This requires a host compile toolchain to
# build szip to use during packaging.
if test "$COMPILE_ENVIRONMENT"; then
MOZ_ENABLE_SZIP=1
fi
# Enable navigator.mozPay
MOZ_PAY=1
# Enable UI for healthreporter
MOZ_SERVICES_HEALTHREPORT=1
# Enable runtime locale switching.
MOZ_LOCALE_SWITCHER=1
# Enable second screen and casting support for external devices.
MOZ_DEVICES=1
# Enable second screen using native Android libraries, provided we're
# not resource constrained.
if test -z "$MOZ_ANDROID_RESOURCE_CONSTRAINED"; then
MOZ_NATIVE_DEVICES=1
fi
# Enable install tracking SDK if we have Google Play support; MOZ_NATIVE_DEVICES
# is a proxy flag for that support.
if test "$RELEASE_BUILD"; then
if test "$MOZ_NATIVE_DEVICES"; then
MOZ_INSTALL_TRACKING=1
fi
fi
# Mark as WebGL conformant
MOZ_WEBGL_CONFORMANT=1
# Use the low-memory GC tuning.
export JS_GC_SMALL_CHUNK_SIZE=1
# Enable checking that add-ons are signed by the trusted root
MOZ_ADDON_SIGNING=1
if test "$MOZ_OFFICIAL_BRANDING"; then
if test "$MOZ_UPDATE_CHANNEL" = "beta" -o \
"$MOZ_UPDATE_CHANNEL" = "release"; then
MOZ_REQUIRE_SIGNING=1
fi
fi
MOZ_JSDOWNLOADS=1
MOZ_TIME_MANAGER=1
MOZ_WEBSMS_BACKEND=1

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

@ -1,86 +0,0 @@
# 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/.
STANDALONE_MAKEFILE := 1
# overwrite mobile-l10n.js with a matchOS=true one for multi-locale builds
ifeq ($(AB_CD),multi)
L10N_PREF_JS_EXPORTS = $(srcdir)/mobile-l10n.js
L10N_PREF_JS_EXPORTS_PATH = $(FINAL_TARGET)/$(PREF_DIR)
L10N_PREF_JS_EXPORTS_FLAGS = $(PREF_PPFLAGS) --silence-missing-directive-warnings
PP_TARGETS += L10N_PREF_JS_EXPORTS
endif
include $(topsrcdir)/config/rules.mk
MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.in
DEFINES += \
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-DPREF_DIR=$(PREF_DIR) \
-DJAREXT= \
-DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) \
-DMOZ_CHILD_PROCESS_NAME_PIE=$(MOZ_CHILD_PROCESS_NAME_PIE) \
-DANDROID_CPU_ARCH=$(ANDROID_CPU_ARCH) \
$(NULL)
ifdef MOZ_DEBUG
DEFINES += -DMOZ_DEBUG=1
endif
ifdef MOZ_PKG_MANIFEST_P
MOZ_PKG_MANIFEST = package-manifest
endif
MOZ_PACKAGER_MINIFY=1
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
# Note that JS_BINARY can be defined in packager.mk, so this test must come
# after including that file. MOZ_PACKAGER_MINIFY_JS is used in packager.mk, but
# since recipe evaluation is deferred, we can set it here after the inclusion.
ifneq (,$(JS_BINARY))
ifndef MOZ_DEBUG
ifndef NIGHTLY_BUILD
MOZ_PACKAGER_MINIFY_JS=1
endif
endif
endif
ifeq (bundle, $(MOZ_FS_LAYOUT))
BINPATH = $(_BINPATH)
DEFINES += -DAPPNAME=$(_APPNAME)
else
# Every other platform just winds up in dist/bin
BINPATH = bin
endif
DEFINES += -DBINPATH=$(BINPATH)
ifdef ENABLE_MARIONETTE
DEFINES += -DENABLE_MARIONETTE=1
endif
ifdef MOZ_PKG_MANIFEST_P
# When MOZ_CHROME_MULTILOCALE is defined, we write multilocale.json like:
# {"locales": ["en-US", "de", "ar", ...]}
$(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) $(GLOBAL_DEPS) FORCE
$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $< -o $@)
ifdef MOZ_CHROME_MULTILOCALE
printf '\n[multilocale]\n' >> $@
printf '@BINPATH@/res/multilocale.json\n' >> $@
for LOCALE in en-US $(MOZ_CHROME_MULTILOCALE) ;\
do \
printf '$(BINPATH)/chrome/'"$$LOCALE"'$(JAREXT)\n' >> $@; \
printf '$(BINPATH)/chrome/'"$$LOCALE"'.manifest\n' >> $@; \
done
COMMA=,
echo '{"locales": [$(foreach l,$(MOZ_CHROME_MULTILOCALE),"$(l)"$(COMMA)) "en-US"]}' \
> $(FINAL_TARGET)/res/multilocale.json
endif
GARBAGE += $(MOZ_PKG_MANIFEST)
endif

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

@ -1,6 +0,0 @@
/* 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/. */
// Inherit locale from the OS, used for multi-locale builds
pref("intl.locale.matchOS", true);

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

@ -1,6 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.

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

@ -1,685 +0,0 @@
; 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 file for the Fennec build.
;
; File format:
;
; [] designates a toplevel component. Example: [xpcom]
; - in front of a file specifies it to be removed from the destination
; * wildcard support to recursively copy the entire directory
; ; file comment
;
#filter substitution
[@AB_CD@]
@BINPATH@/chrome/@AB_CD@@JAREXT@
@BINPATH@/chrome/@AB_CD@.manifest
@BINPATH@/@PREF_DIR@/mobile-l10n.js
@BINPATH@/searchplugins/*
#ifdef MOZ_UPDATER
@BINPATH@/update.locale
@BINPATH@/updater.ini
#endif
@BINPATH@/dictionaries/*
@BINPATH@/hyphenation/*
[assets destdir="assets/@ANDROID_CPU_ARCH@"]
#ifndef MOZ_STATIC_JS
@BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
#endif
#ifdef MOZ_DMD
@BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@
#endif
#ifndef MOZ_FOLD_LIBS
@BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
#endif
@BINPATH@/@DLL_PREFIX@lgpllibs@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxplugin@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxplugingb@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxplugingb235@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxpluginhc@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxpluginkk@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@nssckbi@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@nss3@DLL_SUFFIX@
#ifndef MOZ_FOLD_LIBS
@BINPATH@/@DLL_PREFIX@nssutil3@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@smime3@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@ssl3@DLL_SUFFIX@
#endif
@BINPATH@/@DLL_PREFIX@softokn3@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@freebl3@DLL_SUFFIX@
#ifndef CROSS_COMPILE
@BINPATH@/@DLL_PREFIX@freebl3.chk
@BINPATH@/@DLL_PREFIX@softokn3.chk
#endif
#ifndef NSS_DISABLE_DBM
@BINPATH@/@DLL_PREFIX@nssdbm3@DLL_SUFFIX@
#ifndef CROSS_COMPILE
@BINPATH@/@DLL_PREFIX@nssdbm3.chk
#endif
#endif
#ifndef MOZ_FOLD_LIBS
@BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif
[lib destdir="lib/@ANDROID_CPU_ARCH@"]
@BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
# This should be MOZ_CHILD_PROCESS_NAME, but that has a "lib/" prefix.
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
@BINPATH@/@MOZ_CHILD_PROCESS_NAME_PIE@
[xpcom]
@BINPATH@/dependentlibs.list
@BINPATH@/AndroidManifest.xml
@BINPATH@/resources.arsc
@BINPATH@/package-name.txt
@BINPATH@/classes.dex
@BINPATH@/res/drawable
@BINPATH@/res/drawable-hdpi
@BINPATH@/res/layout
@BINPATH@/distribution/*
[browser]
; [Base Browser Files]
#ifndef XP_UNIX
@BINPATH@/@MOZ_APP_NAME@.exe
#else
@BINPATH@/@MOZ_APP_NAME@-bin
@BINPATH@/@MOZ_APP_NAME@
#endif
@BINPATH@/application.ini
@BINPATH@/platform.ini
@BINPATH@/blocklist.xml
#ifdef XP_UNIX
@BINPATH@/run-mozilla.sh
#endif
; [Components]
@BINPATH@/components/components.manifest
@BINPATH@/components/alerts.xpt
#ifdef ACCESSIBILITY
@BINPATH@/components/accessibility.xpt
#endif
@BINPATH@/components/appshell.xpt
@BINPATH@/components/appstartup.xpt
@BINPATH@/components/autocomplete.xpt
@BINPATH@/components/autoconfig.xpt
@BINPATH@/components/browsercompsbase.xpt
@BINPATH@/components/browser-element.xpt
@BINPATH@/components/browser-feeds.xpt
@BINPATH@/components/browser-newtab.xpt
@BINPATH@/components/caps.xpt
@BINPATH@/components/chardet.xpt
@BINPATH@/components/chrome.xpt
@BINPATH@/components/commandhandler.xpt
@BINPATH@/components/commandlines.xpt
@BINPATH@/components/composer.xpt
@BINPATH@/components/content_events.xpt
@BINPATH@/components/content_geckomediaplugins.xpt
@BINPATH@/components/content_html.xpt
@BINPATH@/components/content_webrtc.xpt
@BINPATH@/components/content_xslt.xpt
@BINPATH@/components/cookie.xpt
@BINPATH@/components/devtools_security.xpt
@BINPATH@/components/directory.xpt
@BINPATH@/components/docshell.xpt
@BINPATH@/components/dom.xpt
@BINPATH@/components/dom_activities.xpt
@BINPATH@/components/dom_apps.xpt
@BINPATH@/components/dom_newapps.xpt
@BINPATH@/components/dom_base.xpt
@BINPATH@/components/dom_canvas.xpt
@BINPATH@/components/dom_core.xpt
@BINPATH@/components/dom_css.xpt
@BINPATH@/components/dom_events.xpt
@BINPATH@/components/dom_geolocation.xpt
@BINPATH@/components/dom_media.xpt
@BINPATH@/components/dom_messages.xpt
@BINPATH@/components/dom_network.xpt
@BINPATH@/components/dom_notification.xpt
@BINPATH@/components/dom_html.xpt
@BINPATH@/components/dom_offline.xpt
@BINPATH@/components/dom_json.xpt
@BINPATH@/components/dom_payment.xpt
@BINPATH@/components/dom_power.xpt
@BINPATH@/components/dom_quota.xpt
@BINPATH@/components/dom_range.xpt
@BINPATH@/components/dom_security.xpt
@BINPATH@/components/dom_settings.xpt
@BINPATH@/components/dom_permissionsettings.xpt
@BINPATH@/components/dom_sidebar.xpt
@BINPATH@/components/dom_mobilemessage.xpt
@BINPATH@/components/dom_storage.xpt
@BINPATH@/components/dom_stylesheets.xpt
@BINPATH@/components/dom_system.xpt
@BINPATH@/components/dom_workers.xpt
@BINPATH@/components/dom_threads.xpt
@BINPATH@/components/dom_traversal.xpt
@BINPATH@/components/dom_tv.xpt
@BINPATH@/components/dom_views.xpt
#ifdef MOZ_WEBSPEECH
@BINPATH@/components/dom_webspeechrecognition.xpt
#endif
@BINPATH@/components/dom_xbl.xpt
@BINPATH@/components/dom_xpath.xpt
@BINPATH@/components/dom_xul.xpt
#ifdef MOZ_GAMEPAD
@BINPATH@/components/dom_gamepad.xpt
#endif
@BINPATH@/components/dom_presentation.xpt
@BINPATH@/components/downloads.xpt
@BINPATH@/components/editor.xpt
@BINPATH@/components/embed_base.xpt
@BINPATH@/components/extensions.xpt
@BINPATH@/components/exthandler.xpt
@BINPATH@/components/exthelper.xpt
@BINPATH@/components/fastfind.xpt
@BINPATH@/components/feeds.xpt
@BINPATH@/components/find.xpt
@BINPATH@/components/gfx.xpt
@BINPATH@/components/html5.xpt
@BINPATH@/components/htmlparser.xpt
@BINPATH@/components/imglib2.xpt
@BINPATH@/components/inspector.xpt
@BINPATH@/components/intl.xpt
@BINPATH@/components/jar.xpt
@BINPATH@/components/jsdebugger.xpt
@BINPATH@/components/jsdownloads.xpt
@BINPATH@/components/jsinspector.xpt
@BINPATH@/components/layout_base.xpt
#ifdef NS_PRINTING
@BINPATH@/components/layout_printing.xpt
#endif
@BINPATH@/components/layout_xul_tree.xpt
@BINPATH@/components/layout_xul.xpt
@BINPATH@/components/locale.xpt
@BINPATH@/components/lwbrk.xpt
@BINPATH@/components/migration.xpt
@BINPATH@/components/mimetype.xpt
@BINPATH@/components/mozfind.xpt
@BINPATH@/components/necko_about.xpt
@BINPATH@/components/necko_cache.xpt
@BINPATH@/components/necko_cache2.xpt
@BINPATH@/components/necko_cookie.xpt
@BINPATH@/components/necko_dns.xpt
@BINPATH@/components/necko_file.xpt
@BINPATH@/components/necko_ftp.xpt
@BINPATH@/components/necko_http.xpt
@BINPATH@/components/necko_mdns.xpt
@BINPATH@/components/necko_res.xpt
@BINPATH@/components/necko_socket.xpt
@BINPATH@/components/necko_strconv.xpt
@BINPATH@/components/necko_viewsource.xpt
@BINPATH@/components/necko_websocket.xpt
@BINPATH@/components/necko_wifi.xpt
@BINPATH@/components/necko_wyciwyg.xpt
@BINPATH@/components/necko.xpt
@BINPATH@/components/loginmgr.xpt
@BINPATH@/components/parentalcontrols.xpt
#ifdef MOZ_WEBRTC
@BINPATH@/components/peerconnection.xpt
#endif
@BINPATH@/components/plugin.xpt
@BINPATH@/components/pref.xpt
@BINPATH@/components/prefetch.xpt
#ifdef MOZ_ENABLE_PROFILER_SPS
@BINPATH@/components/profiler.xpt
#endif
@BINPATH@/components/proxyObject.xpt
@BINPATH@/components/rdf.xpt
@BINPATH@/components/satchel.xpt
@BINPATH@/components/saxparser.xpt
@BINPATH@/components/sessionstore.xpt
@BINPATH@/components/services-crypto-component.xpt
@BINPATH@/components/captivedetect.xpt
@BINPATH@/components/shellservice.xpt
@BINPATH@/components/shistory.xpt
@BINPATH@/components/spellchecker.xpt
@BINPATH@/components/storage.xpt
@BINPATH@/components/telemetry.xpt
@BINPATH@/components/toolkit_asyncshutdown.xpt
@BINPATH@/components/toolkit_filewatcher.xpt
@BINPATH@/components/toolkit_finalizationwitness.xpt
@BINPATH@/components/toolkit_formautofill.xpt
@BINPATH@/components/toolkit_osfile.xpt
@BINPATH@/components/toolkit_securityreporter.xpt
@BINPATH@/components/toolkit_perfmonitoring.xpt
@BINPATH@/components/toolkit_xulstore.xpt
@BINPATH@/components/toolkitprofile.xpt
#ifdef MOZ_ENABLE_XREMOTE
@BINPATH@/components/toolkitremote.xpt
#endif
@BINPATH@/components/txtsvc.xpt
@BINPATH@/components/txmgr.xpt
@BINPATH@/components/uconv.xpt
@BINPATH@/components/unicharutil.xpt
@BINPATH@/components/update.xpt
@BINPATH@/components/uriloader.xpt
@BINPATH@/components/urlformatter.xpt
@BINPATH@/components/webBrowser_core.xpt
@BINPATH@/components/webbrowserpersist.xpt
@BINPATH@/components/webshell_idls.xpt
@BINPATH@/components/widget.xpt
@BINPATH@/components/widget_android.xpt
@BINPATH@/components/windowds.xpt
@BINPATH@/components/windowwatcher.xpt
@BINPATH@/components/xpcom_base.xpt
@BINPATH@/components/xpcom_system.xpt
@BINPATH@/components/xpcom_components.xpt
@BINPATH@/components/xpcom_ds.xpt
@BINPATH@/components/xpcom_io.xpt
@BINPATH@/components/xpcom_threads.xpt
@BINPATH@/components/xpcom_xpti.xpt
@BINPATH@/components/xpconnect.xpt
@BINPATH@/components/xulapp.xpt
@BINPATH@/components/xul.xpt
@BINPATH@/components/xultmpl.xpt
@BINPATH@/components/zipwriter.xpt
; JavaScript components
@BINPATH@/components/RequestSync.manifest
@BINPATH@/components/RequestSyncManager.js
@BINPATH@/components/RequestSyncScheduler.js
@BINPATH@/components/ChromeNotifications.js
@BINPATH@/components/ChromeNotifications.manifest
@BINPATH@/components/ConsoleAPI.manifest
@BINPATH@/components/ConsoleAPIStorage.js
@BINPATH@/components/ContactManager.js
@BINPATH@/components/ContactManager.manifest
@BINPATH@/components/PhoneNumberService.js
@BINPATH@/components/PhoneNumberService.manifest
@BINPATH@/components/NotificationStorage.js
@BINPATH@/components/NotificationStorage.manifest
@BINPATH@/components/SettingsManager.js
@BINPATH@/components/SettingsManager.manifest
@BINPATH@/components/SettingsService.js
@BINPATH@/components/SettingsService.manifest
@BINPATH@/components/BrowserElementParent.manifest
@BINPATH@/components/BrowserElementParent.js
@BINPATH@/components/BrowserElementProxy.manifest
@BINPATH@/components/BrowserElementProxy.js
@BINPATH@/components/PackagedAppUtils.manifest
@BINPATH@/components/PackagedAppUtils.js
@BINPATH@/components/BrowserFeeds.manifest
@BINPATH@/components/FeedConverter.js
@BINPATH@/components/FeedWriter.js
@BINPATH@/components/PermissionSettings.js
@BINPATH@/components/PermissionSettings.manifest
@BINPATH@/components/PermissionPromptService.js
@BINPATH@/components/PermissionPromptService.manifest
@BINPATH@/components/WebContentConverter.js
@BINPATH@/components/BrowserComponents.manifest
@BINPATH@/components/nsBrowserContentHandler.js
@BINPATH@/components/nsBrowserGlue.js
@BINPATH@/components/nsDNSServiceDiscovery.manifest
@BINPATH@/components/nsDNSServiceDiscovery.js
@BINPATH@/components/nsSetDefaultBrowser.manifest
@BINPATH@/components/nsSetDefaultBrowser.js
@BINPATH@/components/toolkitsearch.manifest
@BINPATH@/components/nsSearchService.js
@BINPATH@/components/nsSearchSuggestions.js
@BINPATH@/components/passwordmgr.manifest
@BINPATH@/components/nsLoginInfo.js
@BINPATH@/components/nsLoginManager.js
@BINPATH@/components/nsLoginManagerPrompter.js
@BINPATH@/components/storage-mozStorage.js
@BINPATH@/components/crypto-SDR.js
@BINPATH@/components/jsconsole-clhandler.manifest
@BINPATH@/components/jsconsole-clhandler.js
@BINPATH@/components/nsHelperAppDlg.manifest
@BINPATH@/components/nsHelperAppDlg.js
@BINPATH@/components/NetworkGeolocationProvider.manifest
@BINPATH@/components/NetworkGeolocationProvider.js
@BINPATH@/components/nsSidebar.manifest
@BINPATH@/components/nsSidebar.js
@BINPATH@/components/extensions.manifest
@BINPATH@/components/addonManager.js
@BINPATH@/components/amContentHandler.js
@BINPATH@/components/amInstallTrigger.js
@BINPATH@/components/amWebInstallListener.js
@BINPATH@/components/nsBlocklistService.js
#ifndef RELEASE_BUILD
@BINPATH@/components/TabSource.js
#endif
@BINPATH@/components/webvtt.xpt
@BINPATH@/components/WebVTT.manifest
@BINPATH@/components/WebVTTParserWrapper.js
#ifdef MOZ_UPDATER
@BINPATH@/components/nsUpdateService.manifest
@BINPATH@/components/nsUpdateService.js
@BINPATH@/components/nsUpdateServiceStub.js
#endif
@BINPATH@/components/nsUpdateTimerManager.manifest
@BINPATH@/components/nsUpdateTimerManager.js
@BINPATH@/components/pluginGlue.manifest
@BINPATH@/components/ProcessSingleton.manifest
@BINPATH@/components/MainProcessSingleton.js
@BINPATH@/components/ContentProcessSingleton.js
@BINPATH@/components/nsSessionStore.manifest
@BINPATH@/components/nsSessionStartup.js
@BINPATH@/components/nsSessionStore.js
@BINPATH@/components/nsURLFormatter.manifest
@BINPATH@/components/nsURLFormatter.js
@BINPATH@/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
@BINPATH@/components/txEXSLTRegExFunctions.manifest
@BINPATH@/components/txEXSLTRegExFunctions.js
@BINPATH@/components/nsContentPrefService.manifest
@BINPATH@/components/nsContentPrefService.js
@BINPATH@/components/nsContentDispatchChooser.manifest
@BINPATH@/components/nsContentDispatchChooser.js
@BINPATH@/components/nsHandlerService.manifest
@BINPATH@/components/nsHandlerService.js
@BINPATH@/components/nsWebHandlerApp.manifest
@BINPATH@/components/nsWebHandlerApp.js
@BINPATH@/components/satchel.manifest
@BINPATH@/components/nsFormAutoComplete.js
@BINPATH@/components/nsFormHistory.js
@BINPATH@/components/FormHistoryStartup.js
@BINPATH@/components/nsInputListAutoComplete.js
@BINPATH@/components/formautofill.manifest
@BINPATH@/components/FormAutofillContentService.js
@BINPATH@/components/FormAutofillStartup.js
@BINPATH@/components/CSSUnprefixingService.js
@BINPATH@/components/CSSUnprefixingService.manifest
@BINPATH@/components/contentAreaDropListener.manifest
@BINPATH@/components/contentAreaDropListener.js
@BINPATH@/components/messageWakeupService.js
@BINPATH@/components/messageWakeupService.manifest
@BINPATH@/components/nsINIProcessor.manifest
@BINPATH@/components/nsINIProcessor.js
@BINPATH@/components/nsPrompter.manifest
@BINPATH@/components/nsPrompter.js
@BINPATH@/components/servicesComponents.manifest
@BINPATH@/components/cryptoComponents.manifest
@BINPATH@/components/TelemetryStartup.js
@BINPATH@/components/TelemetryStartup.manifest
@BINPATH@/components/XULStore.js
@BINPATH@/components/XULStore.manifest
@BINPATH@/components/Webapps.js
@BINPATH@/components/Webapps.manifest
@BINPATH@/components/AppsService.js
@BINPATH@/components/AppsService.manifest
@BINPATH@/components/htmlMenuBuilder.js
@BINPATH@/components/htmlMenuBuilder.manifest
@BINPATH@/components/Activities.manifest
@BINPATH@/components/AndroidActivitiesGlue.js
@BINPATH@/components/ActivitiesGlue.js
@BINPATH@/components/ActivityProxy.js
@BINPATH@/components/ActivityRequestHandler.js
@BINPATH@/components/ActivityWrapper.js
@BINPATH@/components/ActivityMessageConfigurator.js
#ifdef MOZ_WEBRTC
@BINPATH@/components/PeerConnection.js
@BINPATH@/components/PeerConnection.manifest
#endif
@BINPATH@/components/CaptivePortalDetectComponents.manifest
@BINPATH@/components/captivedetect.js
#ifdef MOZ_WEBSPEECH
@BINPATH@/components/dom_webspeechsynth.xpt
#endif
#ifdef MOZ_DEBUG
@BINPATH@/components/TestInterfaceJS.js
@BINPATH@/components/TestInterfaceJS.manifest
@BINPATH@/components/TestInterfaceJSMaplike.js
#endif
@BINPATH@/components/nsAsyncShutdown.manifest
@BINPATH@/components/nsAsyncShutdown.js
@BINPATH@/components/Downloads.manifest
@BINPATH@/components/DownloadLegacy.js
@BINPATH@/components/PresentationDeviceInfoManager.manifest
@BINPATH@/components/PresentationDeviceInfoManager.js
@BINPATH@/components/BuiltinProviders.manifest
@BINPATH@/components/TCPPresentationServer.js
@BINPATH@/components/PACGenerator.js
@BINPATH@/components/PACGenerator.manifest
; Modules
@BINPATH@/modules/*
#ifdef MOZ_SAFE_BROWSING
; Safe Browsing
@BINPATH@/components/nsURLClassifier.manifest
@BINPATH@/components/nsUrlClassifierHashCompleter.js
@BINPATH@/components/nsUrlClassifierListManager.js
@BINPATH@/components/nsUrlClassifierLib.js
@BINPATH@/components/PrivateBrowsingTrackingProtectionWhitelist.js
@BINPATH@/components/url-classifier.xpt
#endif
; Security Reports
@BINPATH@/components/SecurityReporter.manifest
@BINPATH@/components/SecurityReporter.js
; [Browser Chrome Files]
@BINPATH@/chrome/browser@JAREXT@
@BINPATH@/chrome/browser.manifest
@BINPATH@/chrome/toolkit@JAREXT@
@BINPATH@/chrome/toolkit.manifest
#ifdef XP_UNIX
@BINPATH@/chrome/icons/default/default16.png
@BINPATH@/chrome/icons/default/default32.png
@BINPATH@/chrome/icons/default/default48.png
#endif
; DevTools
@BINPATH@/chrome/devtools@JAREXT@
@BINPATH@/chrome/devtools.manifest
; shell icons
#ifdef XP_UNIX
@BINPATH@/icons/*.xpm
@BINPATH@/icons/*.png
#endif
; [Default Preferences]
; All the pref files must be part of base to prevent migration bugs
@BINPATH@/@PREF_DIR@/mobile.js
@BINPATH@/@PREF_DIR@/mobile-branding.js
@BINPATH@/@PREF_DIR@/channel-prefs.js
@BINPATH@/ua-update.json
@BINPATH@/greprefs.js
@BINPATH@/defaults/autoconfig/prefcalls.js
; [Layout Engine Resources]
; Style Sheets, Graphics and other Resources used by the layout engine.
@BINPATH@/res/EditorOverride.css
@BINPATH@/res/contenteditable.css
@BINPATH@/res/designmode.css
@BINPATH@/res/TopLevelImageDocument.css
@BINPATH@/res/TopLevelVideoDocument.css
@BINPATH@/res/table-add-column-after-active.gif
@BINPATH@/res/table-add-column-after-hover.gif
@BINPATH@/res/table-add-column-after.gif
@BINPATH@/res/table-add-column-before-active.gif
@BINPATH@/res/table-add-column-before-hover.gif
@BINPATH@/res/table-add-column-before.gif
@BINPATH@/res/table-add-row-after-active.gif
@BINPATH@/res/table-add-row-after-hover.gif
@BINPATH@/res/table-add-row-after.gif
@BINPATH@/res/table-add-row-before-active.gif
@BINPATH@/res/table-add-row-before-hover.gif
@BINPATH@/res/table-add-row-before.gif
@BINPATH@/res/table-remove-column-active.gif
@BINPATH@/res/table-remove-column-hover.gif
@BINPATH@/res/table-remove-column.gif
@BINPATH@/res/table-remove-row-active.gif
@BINPATH@/res/table-remove-row-hover.gif
@BINPATH@/res/table-remove-row.gif
@BINPATH@/res/grabber.gif
@BINPATH@/res/dtd/*
@BINPATH@/res/html/*
@BINPATH@/res/language.properties
@BINPATH@/res/entityTables/*
#ifndef MOZ_ANDROID_EXCLUDE_FONTS
@BINPATH@/res/fonts/*
#else
@BINPATH@/res/fonts/*.properties
#endif
; svg
@BINPATH@/res/svg.css
@BINPATH@/components/dom_svg.xpt
@BINPATH@/components/dom_smil.xpt
; [Personal Security Manager]
;
@BINPATH@/components/pipboot.xpt
@BINPATH@/components/pipnss.xpt
; For process sandboxing
#if defined(MOZ_SANDBOX)
@BINPATH@/@DLL_PREFIX@mozsandbox@DLL_SUFFIX@
#endif
; for Solaris SPARC
#ifdef SOLARIS
bin/libfreebl_32fpu_3.chk
bin/libfreebl_32fpu_3.so
bin/libfreebl_32int_3.chk
bin/libfreebl_32int_3.so
bin/libfreebl_32int64_3.chk
bin/libfreebl_32int64_3.so
#endif
; [Updater]
;
#ifdef MOZ_UPDATER
@BINPATH@/updater@BIN_SUFFIX@
#endif
; [Crash Reporter]
;
#ifdef MOZ_CRASHREPORTER
@BINPATH@/components/CrashService.manifest
@BINPATH@/components/CrashService.js
@BINPATH@/crashreporter@BIN_SUFFIX@
@BINPATH@/crashreporter.crt
@BINPATH@/crashreporter.ini
#ifdef XP_UNIX
@BINPATH@/Throbber-small.gif
#endif
@BINPATH@/crashreporter-override.ini
#endif
[mobile]
@BINPATH@/chrome/icons/
@BINPATH@/chrome/chrome@JAREXT@
@BINPATH@/chrome/chrome.manifest
@BINPATH@/components/AboutRedirector.js
@BINPATH@/components/AddonUpdateService.js
@BINPATH@/components/BlocklistPrompt.js
@BINPATH@/components/BrowserCLH.js
@BINPATH@/components/ColorPicker.js
@BINPATH@/components/ContentDispatchChooser.js
@BINPATH@/components/ContentPermissionPrompt.js
@BINPATH@/components/DirectoryProvider.js
@BINPATH@/components/LoginManagerPrompter.js
@BINPATH@/components/MobileComponents.manifest
@BINPATH@/components/MobileComponents.xpt
@BINPATH@/components/NSSDialogService.js
@BINPATH@/components/PromptService.js
@BINPATH@/components/SessionStore.js
@BINPATH@/components/Sidebar.js
@BINPATH@/components/SiteSpecificUserAgent.js
@BINPATH@/components/Snippets.js
@BINPATH@/components/Payment.js
@BINPATH@/components/PaymentFlowInfo.js
@BINPATH@/components/PaymentProvider.js
@BINPATH@/components/Payment.manifest
@BINPATH@/components/PaymentsUI.js
@BINPATH@/components/PaymentProviderStrategy.js
#ifdef MOZ_SAFE_BROWSING
@BINPATH@/components/SafeBrowsing.jsm
#endif
@BINPATH@/components/XPIDialogService.js
@BINPATH@/components/browsercomps.xpt
#ifdef ENABLE_MARIONETTE
@BINPATH@/chrome/marionette@JAREXT@
@BINPATH@/chrome/marionette.manifest
@BINPATH@/components/MarionetteComponents.manifest
@BINPATH@/components/marionettecomponent.js
#endif
@BINPATH@/components/DataStore.manifest
@BINPATH@/components/DataStoreImpl.js
@BINPATH@/components/dom_datastore.xpt
# b2g and b2gdroid components
@BINPATH@/components/b2gdroid.manifest
@BINPATH@/components/Setup.js
@BINPATH@/components/dom_alarm.xpt
@BINPATH@/components/AlarmsManager.js
@BINPATH@/components/AlarmsManager.manifest
@BINPATH@/components/InterAppComm.manifest
@BINPATH@/components/InterAppCommService.js
@BINPATH@/components/InterAppConnection.js
@BINPATH@/components/InterAppMessagePort.js
@BINPATH@/components/nsDOMIdentity.js
@BINPATH@/components/nsIDService.js
@BINPATH@/components/Identity.manifest
@BINPATH@/components/SystemMessageInternal.js
@BINPATH@/components/SystemMessageManager.js
@BINPATH@/components/SystemMessageCache.js
@BINPATH@/components/SystemMessageManager.manifest
@BINPATH@/components/InstallPackagedWebapp.manifest
@BINPATH@/components/InstallPackagedWebapp.js
@BINPATH@/components/B2GComponents.manifest
@BINPATH@/components/AlertsService.js
@BINPATH@/components/ContentPermissionPrompt.js
@BINPATH@/components/ActivitiesGlue.js
@BINPATH@/components/InterAppCommUIGlue.js
@BINPATH@/components/SystemMessageGlue.js
@BINPATH@/components/ProcessGlobal.js
@BINPATH@/components/OMAContentHandler.js
@BINPATH@/components/PaymentGlue.js
@BINPATH@/components/TelProtocolHandler.js
@BINPATH@/components/SmsProtocolHandler.js
@BINPATH@/components/MailtoProtocolHandler.js
@BINPATH@/components/RecoveryService.js
@BINPATH@/components/B2GAboutRedirector.js
@BINPATH@/components/FilePicker.js
@BINPATH@/components/WebappsUpdateTimer.js
@BINPATH@/components/FxAccountsUIGlue.js
@BINPATH@/components/HelperAppDialog.js
@BINPATH@/components/MobileIdentityUIGlue.js
@BINPATH@/components/B2GAppMigrator.js
@BINPATH@/components/B2GPresentationDevicePrompt.js
@BINPATH@/components/BootstrapCommandLine.js
#ifdef MOZ_UPDATER
@BINPATH@/components/UpdatePrompt.js
#endif
@BINPATH@/components/DownloadsAPI.js
@BINPATH@/components/DownloadsAPI.manifest
; InputMethod API
@BINPATH@/components/MozKeyboard.js
@BINPATH@/components/InputMethod.manifest
@BINPATH@/@PREF_DIR@/b2gdroid.js

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

@ -1,4 +0,0 @@
update.locale
README.txt
defaults/preferences/healthreport-prefs.js
components/dom_webspeech.xpt

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

@ -1,29 +0,0 @@
# 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/.
CONFIGURE_SUBST_FILES += ['installer/Makefile']
# These are used to localize the GeckoView Android and Gecko resources, but not
# yet to localize the b2gdroid Android resources.
DIRS += [
'../../locales',
'../locales',
]
DIRS += [
'components',
'../components',
'../modules',
'../javaaddons',
'../base',
'../fonts',
'../geckoview_library',
'/b2g/components',
'/b2g/chrome',
'/b2g/gaia',
# We must build the libs target of app after building the libs target of
# /b2g/gaia, since the gaia directory is packed into the APK as an assets/
# directory. This relies on the serial nature of the libs tier recursion.
'app',
]

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

@ -1,7 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
include('../../../b2g/common.configure')