Add homepage URL and Bookmarks for partner networks
* Add Bookmark folders.
* Add Bookmarks for operators based on requirements.
* Add Homepage URL for Chrome.
Issue: PRJ8901-371
Issue: PRJ8901-718
Issue: PRJ8901-966
Issue: PRJ8901-1516
Issue: PRJ8901-1517
Issue: PRJ8901-1527
Issue: PRJ8901-1651
Issue: PRJ8901-1652
Issue: PRJ8901-1665
Issue: FP3-A11#160
Issue: FP3-A11#166
Issue: FP3-A11#231
Change-Id: I7d3b790fd27d72ed3331ea57571e22414ce21cab
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index cdc215c..5de30ad 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -22,5 +22,8 @@
<provider android:name="PartnerBookmarksProvider"
android:authorities="com.android.partnerbookmarks"
android:exported="true" />
+ <provider android:name="PartnerHomepageProvider"
+ android:authorities="com.android.partnerbrowsercustomizations"
+ android:exported="true" />
</application>
</manifest>
diff --git a/res/values-mcc204-mnc04/strings.xml b/res/values-mcc204-mnc04/strings.xml
new file mode 100644
index 0000000..6e0c028
--- /dev/null
+++ b/res/values-mcc204-mnc04/strings.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">https://www.vodafone.nl</string>
+ <string name="bookmarks_folder_name" translatable="false">Vodafone Favorieten</string>
+ <string-array name="bookmarks">
+ <item>Vodafone</item>
+ <item>https://www.vodafone.nl</item>
+ <item>My Vodafone</item>
+ <item>https://www.vodafone.nl/my</item>
+ </string-array>
+</resources>
diff --git a/res/values-mcc204-mnc08/strings.xml b/res/values-mcc204-mnc08/strings.xml
new file mode 100644
index 0000000..07666bb
--- /dev/null
+++ b/res/values-mcc204-mnc08/strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">http://www.kpnvandaag.nl</string>
+</resources>
diff --git a/res/values-mcc204-mnc12/strings.xml b/res/values-mcc204-mnc12/strings.xml
new file mode 100644
index 0000000..3f2b0ad
--- /dev/null
+++ b/res/values-mcc204-mnc12/strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">http://telfort.nl</string>
+</resources>
diff --git a/res/values-mcc208-mnc01/strings.xml b/res/values-mcc208-mnc01/strings.xml
new file mode 100644
index 0000000..804469d
--- /dev/null
+++ b/res/values-mcc208-mnc01/strings.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">https://www.orange.fr/portail</string>
+ <string name="bookmarks_folder_name" translatable="false">Orange Favoris</string>
+ <string-array name="bookmarks">
+ <item>Orange</item>
+ <item>http://www.orange.fr/</item>
+ <item>Actualités</item>
+ <item>https://actu.orange.fr/</item>
+ <item>Météo</item>
+ <item>https://meteo.orange.fr/</item>
+ <item>Jeux</item>
+ <item>http://jeux.mob1.orange.fr/</item>
+ <item>Sports</item>
+ <item>https://sports.orange.fr/</item>
+ </string-array>
+</resources>
diff --git a/res/values-mcc214-mnc01/strings.xml b/res/values-mcc214-mnc01/strings.xml
new file mode 100644
index 0000000..5777d3b
--- /dev/null
+++ b/res/values-mcc214-mnc01/strings.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">https://start.vodafone.com/ssp/homepage/ES?source=embed</string>
+ <string name="bookmarks_folder_name" translatable="false">Favoritos Vodafone</string>
+ <string-array name="bookmarks">
+ <item>Mi Vodafone</item>
+ <item>http://m.vodafone.es</item>
+ <item>Contenidos</item>
+ <item>https://offers.vodafone.com/es</item>
+ <item>V by Vodafone</item>
+ <item>https://eshop.v.vodafone.com/es</item>
+ </string-array>
+</resources>
diff --git a/res/values-mcc214-mnc03/strings.xml b/res/values-mcc214-mnc03/strings.xml
new file mode 100644
index 0000000..668f666
--- /dev/null
+++ b/res/values-mcc214-mnc03/strings.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">https://www.orange.es/?internal_medium=settings</string>
+ <string name="bookmarks_folder_name" translatable="false">Favoritos Orange</string>
+ <string-array name="bookmarks">
+ <item>Orange</item>
+ <item>https://www.orange.es/?internal_medium=settings</item>
+ <item>TV y Cine</item>
+ <item>http://m.orange.es/tv</item>
+ <item>Videojuegos</item>
+ <item>http://juegos.orange.es</item>
+ </string-array>
+</resources>
diff --git a/res/values-mcc222-mnc10/strings.xml b/res/values-mcc222-mnc10/strings.xml
new file mode 100644
index 0000000..699b8ce
--- /dev/null
+++ b/res/values-mcc222-mnc10/strings.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">https://m.vodafone.it/pages/home</string>
+ <string name="bookmarks_folder_name" translatable="false">Favoritos Vodafone</string>
+ <string-array name="bookmarks">
+ <item>My Vodafone</item>
+ <item>http://my190.vodafone.it</item>
+ <item>Apps</item>
+ <item>http://m.vodafone.it/pages/apps</item>
+ <item>Vodafone</item>
+ <item>http://m.vodafone.it</item>
+ </string-array>
+</resources>
diff --git a/res/values-mcc234-mnc15/strings.xml b/res/values-mcc234-mnc15/strings.xml
new file mode 100644
index 0000000..448886a
--- /dev/null
+++ b/res/values-mcc234-mnc15/strings.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">https://start.vodafone.com/ssp/homepage/UK?source=embed</string>
+ <string name="bookmarks_folder_name" translatable="false">Favourites Vodafone</string>
+ <string-array name="bookmarks">
+ <item>Vodafone</item>
+ <item>https://www.vodafone.co.uk</item>
+ </string-array>
+</resources>
diff --git a/res/values-mcc262-mnc02/strings.xml b/res/values-mcc262-mnc02/strings.xml
new file mode 100644
index 0000000..59ebab9
--- /dev/null
+++ b/res/values-mcc262-mnc02/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">http://live.vodafone.de/dr/cc</string>
+ <string name="bookmarks_folder_name" translatable="false">Vodafone Favoriten</string>
+ <string-array name="bookmarks">
+ <item>News</item>
+ <item>http://vflive.de/news</item>
+ <item>MusicDownloads</item>
+ <item>http://vflive.de/music</item>
+ <item>Spiele</item>
+ <item>http://vflive.de/games</item>
+ <item>Logos & Designs</item>
+ <item>http://vflive.de/picturedownload</item>
+ <item>Vodafone Webseite</item>
+ <item>http://m.vodafone.de</item>
+ <item>Vodafone</item>
+ <item>https://start.vodafone.com/ssp/homepage/DE?source=embed</item>
+ </string-array>
+</resources>
diff --git a/res/values-mcc262-mnc09/strings.xml b/res/values-mcc262-mnc09/strings.xml
new file mode 100644
index 0000000..59ebab9
--- /dev/null
+++ b/res/values-mcc262-mnc09/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">http://live.vodafone.de/dr/cc</string>
+ <string name="bookmarks_folder_name" translatable="false">Vodafone Favoriten</string>
+ <string-array name="bookmarks">
+ <item>News</item>
+ <item>http://vflive.de/news</item>
+ <item>MusicDownloads</item>
+ <item>http://vflive.de/music</item>
+ <item>Spiele</item>
+ <item>http://vflive.de/games</item>
+ <item>Logos & Designs</item>
+ <item>http://vflive.de/picturedownload</item>
+ <item>Vodafone Webseite</item>
+ <item>http://m.vodafone.de</item>
+ <item>Vodafone</item>
+ <item>https://start.vodafone.com/ssp/homepage/DE?source=embed</item>
+ </string-array>
+</resources>
diff --git a/res/values-mcc272-mnc01/strings.xml b/res/values-mcc272-mnc01/strings.xml
new file mode 100644
index 0000000..d873815
--- /dev/null
+++ b/res/values-mcc272-mnc01/strings.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">http://start.vodafone.com/ssp/homepage/IE</string>
+ <string name="bookmarks_folder_name" translatable="false">Favorites Vodafone</string>
+ <string-array name="bookmarks">
+ <item>My Vodafone</item>
+ <item>https://www.vodafone.ie/myv/services/login/index.jsp?redirect=/myv/index.jsp</item>
+ <item>Vodafone</item>
+ <item>https://start.vodafone.com</item>
+ <item>Vodafone Ireland</item>
+ <item>https://www.vodafone.ie</item>
+ </string-array>
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f614a2f..23bb086 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -15,6 +15,7 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="homepage_uri" translatable="false">http://www.android.com/</string>
<string name="bookmarks_folder_name" translatable="false">Partner Bookmarks</string>
<string-array name="bookmarks" />
</resources>
diff --git a/src/com/android/providers/partnerbookmarks/PartnerHomepageProvider.java b/src/com/android/providers/partnerbookmarks/PartnerHomepageProvider.java
new file mode 100644
index 0000000..fbd60a5
--- /dev/null
+++ b/src/com/android/providers/partnerbookmarks/PartnerHomepageProvider.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ * Copyright 2020-2022 Fairphone B.V.
+ *
+ * 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.android.providers.partnerbookmarks;
+
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.content.UriMatcher;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.net.Uri;
+import android.util.Log;
+
+public class PartnerHomepageProvider extends ContentProvider {
+ private static final String TAG = "PartnerHomepageProvider";
+ // Keep "http://www.android.com/" as fall-back.
+ // Other strings in this class must remain as it is.
+ private static String mHomepageUri = "http://www.android.com/";
+ private static final int URI_MATCH_HOMEPAGE = 0;
+ private static final int URI_MATCH_DISABLE_INCOGNITO_MODE = 1;
+ private static final int URI_MATCH_DISABLE_BOOKMARKS_EDITING = 2;
+ private static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
+
+ static {
+ URI_MATCHER.addURI(
+ "com.android.partnerbrowsercustomizations", "homepage", URI_MATCH_HOMEPAGE);
+ }
+
+ private boolean prepareHomepageUri() {
+ Resources res = getContext().getResources();
+ try {
+ mHomepageUri = res.getString(R.string.homepage_uri);
+ } catch (android.content.res.Resources.NotFoundException e) {
+ Log.e(TAG, "prepareHomepageUri failed to fetch resources; bailing out");
+ e.printStackTrace();
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean onCreate() {
+ prepareHomepageUri();
+ Log.d(TAG, "onCreate mHomepageUri=" + mHomepageUri);
+ return true;
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ prepareHomepageUri();
+ Log.d(TAG, "onConfigurationChanged mHomepageUri=" + mHomepageUri);
+ }
+
+ @Override
+ public String getType(Uri uri) {
+ switch (URI_MATCHER.match(uri)) {
+ case URI_MATCH_HOMEPAGE:
+ return "vnd.android.cursor.item/partnerhomepage";
+ case URI_MATCH_DISABLE_INCOGNITO_MODE:
+ return "vnd.android.cursor.item/partnerdisableincognitomode";
+ case URI_MATCH_DISABLE_BOOKMARKS_EDITING:
+ return "vnd.android.cursor.item/partnerdisablebookmarksediting";
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
+ String sortOrder) {
+ switch (URI_MATCHER.match(uri)) {
+ case URI_MATCH_HOMEPAGE: {
+ MatrixCursor cursor = new MatrixCursor(new String[]{"homepage"}, 1);
+ cursor.addRow(new Object[]{mHomepageUri});
+ return cursor;
+ }
+ case URI_MATCH_DISABLE_INCOGNITO_MODE: {
+ MatrixCursor cursor =
+ new MatrixCursor(new String[]{"disableincognitomode"}, 1);
+ cursor.addRow(new Object[]{1});
+ return cursor;
+ }
+ case URI_MATCH_DISABLE_BOOKMARKS_EDITING: {
+ MatrixCursor cursor =
+ new MatrixCursor(new String[]{"disablebookmarksediting"}, 1);
+ cursor.addRow(new Object[]{1});
+ return cursor;
+ }
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public Uri insert(Uri uri, ContentValues values) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int delete(Uri uri, String selection, String[] selectionArgs) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+ throw new UnsupportedOperationException();
+ }
+}