Bug 1363843 - Remove Java Addons support from Fennec, Part 2 draft
authorVarun Iyer <dev.varuniyer@gmail.com>
Tue, 30 May 2017 16:12:46 -0700
changeset 586870 e2048e7385ac9e6d1c8abb177e12e55ffb56b2c9
parent 586626 fbe0e3f31233cc7846a2168c613452a1d7147cc2
child 631134 852ff4034ac06976e715c6a08eb5dbea7d2305da
push id61561
push userbmo:dev.varuniyer@gmail.com
push dateWed, 31 May 2017 07:48:30 +0000
bugs1363843
milestone55.0a1
Bug 1363843 - Remove Java Addons support from Fennec, Part 2 MozReview-Commit-ID: 7LwRxINcs3y
mobile/android/base/java/org/mozilla/gecko/AboutPages.java
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
mobile/android/base/java/org/mozilla/gecko/GeckoService.java
mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java
mobile/android/base/java/org/mozilla/gecko/restrictions/GuestProfileConfiguration.java
mobile/android/base/java/org/mozilla/gecko/restrictions/Restrictable.java
mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictedProfileConfiguration.java
mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictionCache.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/resources/menu-large/browser_app_menu.xml
mobile/android/base/resources/menu-xlarge/browser_app_menu.xml
mobile/android/base/resources/menu/browser_app_menu.xml
mobile/android/base/strings.xml.in
--- a/mobile/android/base/java/org/mozilla/gecko/AboutPages.java
+++ b/mobile/android/base/java/org/mozilla/gecko/AboutPages.java
@@ -12,17 +12,16 @@ import org.mozilla.gecko.util.StringUtil
 
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
 public class AboutPages {
     // All of our special pages.
     public static final String ACCOUNTS        = "about:accounts";
-    public static final String ADDONS          = "about:addons";
     public static final String CONFIG          = "about:config";
     public static final String DOWNLOADS       = "about:downloads";
     public static final String FIREFOX         = "about:firefox";
     public static final String HEALTHREPORT    = "about:healthreport";
     public static final String HOME            = "about:home";
     public static final String LOGINS          = "about:logins";
     public static final String PRIVATEBROWSING = "about:privatebrowsing";
     public static final String READER          = "about:reader";
@@ -58,33 +57,28 @@ public class AboutPages {
     public static boolean isAboutReader(final String url) {
         return isAboutPage(READER, url);
     }
 
     public static boolean isAboutConfig(final String url) {
         return isAboutPage(CONFIG, url);
     }
 
-    public static boolean isAboutAddons(final String url) {
-        return isAboutPage(ADDONS, url);
-    }
-
     public static boolean isAboutPrivateBrowsing(final String url) {
         return isAboutPage(PRIVATEBROWSING, url);
     }
 
     public static boolean isAboutPage(String page, String url) {
         return url != null && url.toLowerCase().startsWith(page);
 
     }
 
     public static final List<String> DEFAULT_ICON_PAGES = Collections.unmodifiableList(Arrays.asList(
             HOME,
             ACCOUNTS,
-            ADDONS,
             CONFIG,
             DOWNLOADS,
             FIREFOX,
             HEALTHREPORT,
             UPDATER
     ));
 
     public static boolean isBuiltinIconPage(final String url) {
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3647,20 +3647,16 @@ public class BrowserApp extends GeckoApp
         } else {
             enterGuestMode.setVisible(true);
         }
 
         if (!Restrictions.isAllowed(this, Restrictable.GUEST_BROWSING)) {
             MenuUtils.safeSetVisible(aMenu, R.id.new_guest_session, false);
         }
 
-        if (!Restrictions.isAllowed(this, Restrictable.INSTALL_EXTENSION)) {
-            MenuUtils.safeSetVisible(aMenu, R.id.addons, false);
-        }
-
         // Hide panel menu items if the panels themselves are hidden.
         // If we don't know whether the panels are hidden, just show the menu items.
         bookmarksList.setVisible(prefs.getBoolean(HomeConfig.PREF_KEY_BOOKMARKS_PANEL_ENABLED, true));
         historyList.setVisible(prefs.getBoolean(HomeConfig.PREF_KEY_HISTORY_PANEL_ENABLED, true));
 
         return true;
     }
 
@@ -3794,21 +3790,16 @@ public class BrowserApp extends GeckoApp
             final String OS = AppConstants.OS_TARGET;
             final String LOCALE = Locales.getLanguageTag(Locale.getDefault());
 
             final String URL = getResources().getString(R.string.help_link, VERSION, OS, LOCALE);
             Tabs.getInstance().loadUrlInTab(URL);
             return true;
         }
 
-        if (itemId == R.id.addons) {
-            Tabs.getInstance().loadUrlInTab(AboutPages.ADDONS);
-            return true;
-        }
-
         if (itemId == R.id.logins) {
             Tabs.getInstance().loadUrlInTab(AboutPages.LOGINS);
             return true;
         }
 
         if (itemId == R.id.downloads) {
             Tabs.getInstance().loadUrlInTab(AboutPages.DOWNLOADS);
             return true;
--- a/mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
@@ -286,19 +286,17 @@ public class DoorHangerPopup extends Anc
             dismiss();
             return;
         }
 
         showDividers();
 
         final String baseDomain = tab.getBaseDomain();
 
-        if (firstDoorhanger.getType() == Type.ADDON) {
-            firstDoorhanger.showTitle(null, mContext.getString(R.string.addons));
-        } else if (TextUtils.isEmpty(baseDomain)) {
+        if (TextUtils.isEmpty(baseDomain)) {
             firstDoorhanger.hideTitle();
         } else {
             firstDoorhanger.showTitle(tab.getFavicon(), baseDomain);
         }
 
         if (isShowing()) {
             show();
             return;
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
@@ -24,17 +24,16 @@ import org.mozilla.gecko.util.EventCallb
 public class GeckoService extends Service {
 
     private static final String LOGTAG = "GeckoService";
     private static final boolean DEBUG = false;
 
     private static final String INTENT_PROFILE_NAME = "org.mozilla.gecko.intent.PROFILE_NAME";
     private static final String INTENT_PROFILE_DIR = "org.mozilla.gecko.intent.PROFILE_DIR";
 
-    private static final String INTENT_ACTION_UPDATE_ADDONS = "update-addons";
     private static final String INTENT_ACTION_CREATE_SERVICES = "create-services";
     private static final String INTENT_ACTION_LOAD_LIBS = "load-libs";
     private static final String INTENT_ACTION_START_GECKO = "start-gecko";
 
     private static final String INTENT_SERVICE_CATEGORY = "category";
     private static final String INTENT_SERVICE_DATA = "data";
 
     private static class EventListener implements BundleEventListener {
@@ -185,17 +184,16 @@ public class GeckoService extends Servic
         if (!initGecko(intent)) {
             stopSelf(startId);
             return Service.START_NOT_STICKY;
         }
 
         GeckoThread.launch();
 
         switch (intent.getAction()) {
-        case INTENT_ACTION_UPDATE_ADDONS:
             // Run the add-on update service. Because the service is automatically invoked
             // when loading Gecko, we don't have to do anything else here.
         case INTENT_ACTION_LOAD_LIBS:
             // Load libs only. Don't take any additional actions.
         case INTENT_ACTION_START_GECKO:
             // Load libs and start Gecko. Don't take any additional actions.
             break;
 
--- a/mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java
@@ -251,19 +251,18 @@ public class LocalBrowserDB extends Brow
             final Matcher m = p.matcher(name);
             if (!m.find()) {
                 continue;
             }
 
             try {
                 if (Restrictions.isRestrictedProfile(context)) {
                     // matching on variable name from strings.xml.in
-                    final String addons = "bookmarkdefaults_title_addons";
                     final String regularSumo = "bookmarkdefaults_title_support";
-                    if (name.equals(addons) || name.equals(regularSumo)) {
+                    if (name.equals(regularSumo)) {
                         continue;
                     }
                 }
                 if (!Restrictions.isRestrictedProfile(context)) {
                     // if we're not in kidfox, skip the kidfox specific bookmark(s)
                     if (name.startsWith("bookmarkdefaults_title_restricted")) {
                         continue;
                     }
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/GuestProfileConfiguration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/GuestProfileConfiguration.java
@@ -11,18 +11,18 @@ import java.util.Arrays;
 import java.util.List;
 
 /**
  * RestrictionConfiguration implementation for guest profiles.
  */
 public class GuestProfileConfiguration implements RestrictionConfiguration {
     static List<Restrictable> DISABLED_FEATURES = Arrays.asList(
             Restrictable.DOWNLOAD,
+            Restrictable.INSTALL_APPS,
             Restrictable.INSTALL_EXTENSION,
-            Restrictable.INSTALL_APPS,
             Restrictable.BROWSE,
             Restrictable.SHARE,
             Restrictable.BOOKMARK,
             Restrictable.ADD_CONTACT,
             Restrictable.SET_IMAGE,
             Restrictable.MODIFY_ACCOUNTS,
             Restrictable.REMOTE_DEBUGGING,
             Restrictable.IMPORT_SETTINGS,
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/Restrictable.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/Restrictable.java
@@ -1,32 +1,31 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.restrictions;
 
 import org.mozilla.gecko.R;
-
 import android.content.Context;
 import android.support.annotation.StringRes;
 
 /**
  * This is a list of things we can restrict you from doing. Some of these are reflected in Android UserManager constants.
  * Others are specific to us.
  * These constants should be in sync with the ones from toolkit/components/parentalcontrols/nsIParentalControlsService.idl
  */
 public enum Restrictable {
     DOWNLOAD(1, "downloads", 0, 0),
 
     INSTALL_EXTENSION(
-            2, "no_install_extensions",
-            R.string.restrictable_feature_addons_installation,
-            R.string.restrictable_feature_addons_installation_description),
+        2, "no_install_extensions",
+        R.string.restrictable_feature_addons_installation,
+        R.string.restrictable_feature_addons_installation_description),
 
     // UserManager.DISALLOW_INSTALL_APPS
     INSTALL_APPS(3, "no_install_apps", 0 , 0),
 
     BROWSE(4, "browse", 0, 0),
 
     SHARE(5, "share", 0, 0),
 
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictedProfileConfiguration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictedProfileConfiguration.java
@@ -83,17 +83,17 @@ public class RestrictedProfileConfigurat
             return true;
         }
 
         return RestrictionCache.getApplicationRestriction(context, restrictable.name, configuration.get(restrictable));
     }
 
     @Override
     public boolean canLoadUrl(String url) {
-        if (!isAllowed(Restrictable.INSTALL_EXTENSION) && AboutPages.isAboutAddons(url)) {
+        if (!isAllowed(Restrictable.INSTALL_EXTENSION)) {
             return false;
         }
 
         if (!isAllowed(Restrictable.PRIVATE_BROWSING) && AboutPages.isAboutPrivateBrowsing(url)) {
             return false;
         }
 
         if (AboutPages.isAboutConfig(url)) {
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictionCache.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictionCache.java
@@ -75,20 +75,16 @@ public class RestrictionCache {
             StrictMode.setThreadPolicy(policy);
         }
     }
 
     /**
      * This method migrates the old set of DISALLOW_ restrictions to the new restrictable feature ones (Bug 1189336).
      */
     /* package-private */ static void migrateRestrictionsIfNeeded(Bundle bundle) {
-        if (!bundle.containsKey(Restrictable.INSTALL_EXTENSION.name) && bundle.containsKey("no_install_extensions")) {
-            bundle.putBoolean(Restrictable.INSTALL_EXTENSION.name, !bundle.getBoolean("no_install_extensions"));
-        }
-
         if (!bundle.containsKey(Restrictable.PRIVATE_BROWSING.name) && bundle.containsKey("no_private_browsing")) {
             bundle.putBoolean(Restrictable.PRIVATE_BROWSING.name, !bundle.getBoolean("no_private_browsing"));
         }
 
         if (!bundle.containsKey(Restrictable.CLEAR_HISTORY.name) && bundle.containsKey("no_clear_history")) {
             bundle.putBoolean(Restrictable.CLEAR_HISTORY.name, !bundle.getBoolean("no_clear_history"));
         }
 
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -453,17 +453,16 @@
 <!ENTITY pref_update_autodownload_never "Never">
 <!ENTITY pref_update_autodownload_always "Always">
 
 <!-- Localization note (help_menu) : This string is used in the main menu-->
 <!ENTITY help_menu "Help">
 
 <!ENTITY quit "Quit">
 
-<!ENTITY addons "Add-ons">
 <!ENTITY logins "Logins">
 <!ENTITY downloads "Downloads">
 <!ENTITY char_encoding "Character Encoding">
 
 <!ENTITY share "Share">
 <!ENTITY share_title "Share via">
 <!ENTITY share_image_failed "Unable to share this image">
 <!ENTITY save_as_pdf "Save as PDF">
@@ -774,34 +773,30 @@ just addresses the organization to follo
      code has already been displayed by the client trying to connect (such as
      desktop Firefox via WebIDE), so you just need to aim this device at the QR
      code. -->
 <!ENTITY devtools_auth_scan_header "Scanning for the QR code displayed on your other device">
 
 <!-- Restrictable features -->
 <!-- Localization note: These are features the device owner (e.g. parent) can enable or disable for
      a restricted profile (e.g. child). Used inside the Android settings UI. -->
-<!ENTITY restrictable_feature_addons_installation "Add-ons">
-<!ENTITY restrictable_feature_addons_installation_description "Add features or functionality to Firefox. Note: Add-ons can disable certain restrictions.">
 <!ENTITY restrictable_feature_private_browsing "Private Browsing">
 <!ENTITY restrictable_feature_private_browsing_description "Allows family members to browse without saving information about the sites and pages they\'ve visited.">
 <!ENTITY restrictable_feature_clear_history "Clear History">
 <!ENTITY restrictable_feature_clear_history_description "Allows family members to delete information about the sites and pages they\'ve visited.">
 <!ENTITY restrictable_feature_advanced_settings "Advanced Settings">
 <!ENTITY restrictable_feature_advanced_settings_description "This includes importing bookmarks, restoring tabs and automated updates. Turn off for simplified settings suitable for any family member.">
 <!ENTITY restrictable_feature_camera_microphone "Camera &amp; Microphone">
 <!ENTITY restrictable_feature_camera_microphone_description "Allows family members to engage in real time communication on websites.">
 <!ENTITY restrictable_feature_block_list "Block List">
 <!ENTITY restrictable_feature_block_list_description "Block websites that include sensitive content.">
 
 <!-- Default Bookmarks titles-->
 <!-- LOCALIZATION NOTE (bookmarks_about_browser): link title for about:fennec -->
 <!ENTITY bookmarks_about_browser "Firefox: About your browser">
-<!-- LOCALIZATION NOTE (bookmarks_addons): link title for https://addons.mozilla.org/en-US/mobile -->
-<!ENTITY bookmarks_addons "Firefox: Customize with add-ons">
 <!-- LOCALIZATION NOTE (bookmarks_support): link title for https://support.mozilla.org/ -->
 <!ENTITY bookmarks_support "Firefox: Support">
 <!-- LOCALIZATION NOTE (bookmarks_restricted_support): link title for https://support.mozilla.org/kb/controlledaccess -->
 <!ENTITY bookmarks_restricted_support2 "Firefox Help and Support for restricted profiles on Android tablets">
 <!-- LOCALIZATION NOTE (bookmarks_restricted_webmaker):link title for https://webmaker.org -->
 <!ENTITY bookmarks_restricted_webmaker "Learn the Web: Mozilla Webmaker">
 
 <!-- LOCALIZATION NOTE (unsupported_sdk_version): The user installed a build of this app that does not support
--- a/mobile/android/base/resources/menu-large/browser_app_menu.xml
+++ b/mobile/android/base/resources/menu-large/browser_app_menu.xml
@@ -83,19 +83,16 @@
     <item android:id="@+id/tools"
           android:title="@string/tools">
 
         <menu>
 
             <item android:id="@+id/downloads"
                   android:title="@string/downloads"/>
 
-            <item android:id="@+id/addons"
-                  android:title="@string/addons"/>
-
             <item android:id="@+id/logins"
                   android:title="@string/logins"/>
 
             <item android:id="@+id/new_guest_session"
                   android:visible="false"
                   android:title="@string/new_guest_session"/>
 
             <item android:id="@+id/exit_guest_session"
--- a/mobile/android/base/resources/menu-xlarge/browser_app_menu.xml
+++ b/mobile/android/base/resources/menu-xlarge/browser_app_menu.xml
@@ -84,19 +84,16 @@
     <item android:id="@+id/tools"
           android:title="@string/tools">
 
         <menu>
 
             <item android:id="@+id/downloads"
                   android:title="@string/downloads"/>
 
-            <item android:id="@+id/addons"
-                  android:title="@string/addons"/>
-
             <item android:id="@+id/logins"
                   android:title="@string/logins"/>
 
             <item android:id="@+id/new_guest_session"
                   android:visible="false"
                   android:title="@string/new_guest_session"/>
 
             <item android:id="@+id/exit_guest_session"
--- a/mobile/android/base/resources/menu/browser_app_menu.xml
+++ b/mobile/android/base/resources/menu/browser_app_menu.xml
@@ -83,19 +83,16 @@
     <item android:id="@+id/tools"
           android:title="@string/tools">
 
         <menu>
 
             <item android:id="@+id/downloads"
                   android:title="@string/downloads"/>
 
-            <item android:id="@+id/addons"
-                  android:title="@string/addons"/>
-
             <item android:id="@+id/logins"
                   android:title="@string/logins"/>
 
             <item android:id="@+id/new_guest_session"
                   android:visible="false"
                   android:title="@string/new_guest_session"/>
 
             <item android:id="@+id/exit_guest_session"
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -485,20 +485,16 @@
   <string name="filepicker_image_title">&filepicker_image_title;</string>
   <string name="filepicker_video_title">&filepicker_video_title;</string>
 
   <!-- Default bookmarks. We used to use bookmark titles shared with XUL from mobile's
        profile/bookmarks.inc (see bug 964946). Don't expose the URLs to L10N. -->
   <string name="bookmarkdefaults_title_aboutfirefox">&bookmarks_about_browser;</string>
   <string name="bookmarkdefaults_url_aboutfirefox">about:firefox</string>
 
-  <!-- Icon is automatically generated from R.drawable.bookmarkdefaults_favicon_addons -->
-  <string name="bookmarkdefaults_title_addons">&bookmarks_addons;</string>
-  <string name="bookmarkdefaults_url_addons">https://addons.mozilla.org/android?utm_source=inproduct&amp;utm_medium=default-bookmarks&amp;utm_campaign=mobileandroid</string>
-
   <!-- Icon is automatically generated from R.drawable.bookmarkdefaults_favicon_support -->
   <string name="bookmarkdefaults_title_support">&bookmarks_support;</string>
   <string name="bookmarkdefaults_url_support">https://support.mozilla.org/products/mobile?utm_source=inproduct&amp;utm_medium=default-bookmarks&amp;utm_campaign=mobileandroid</string>
 
   <string name="bookmarkdefaults_title_restricted_webmaker">&bookmarks_restricted_webmaker;</string>
   <string name="bookmarkdefaults_url_restricted_webmaker">https://webmaker.org/</string>
 
   <string name="bookmarkdefaults_title_restricted_support">&bookmarks_restricted_support2;</string>