summaryrefslogtreecommitdiff
authorPengfei Zhao <pengfei.zhao@amlogic.com>2019-10-22 05:46:12 (GMT)
committer Pengfei Zhao <pengfei.zhao@amlogic.com>2019-12-11 12:45:06 (GMT)
commit1cbf727d34838e45928847df6944915908bfad4a (patch)
tree1bfd64cb5ac6e0a6e50f40a8980c4210b843c0c3
parent845a41823b5b868990b94207c1bd0baa122ff8eb (diff)
downloadcommon-1cbf727d34838e45928847df6944915908bfad4a.zip
common-1cbf727d34838e45928847df6944915908bfad4a.tar.gz
common-1cbf727d34838e45928847df6944915908bfad4a.tar.bz2
NTS: add Netflix sepolicy and key mapping
PD#SWPL-12983 * common/sepolicy/property_contexts * common/sepolicy/untrusted_app_27.te Sepolicy for Netflix App * common/products/mbox/Vendor_0001_Product_0001.kl Netflix key mapping * LauncherCustomization Launcher customization Change-Id: Idf578ff3dc08e10c707200a1ebe94e7c6ae04e8d
Diffstat
-rw-r--r--LauncherCustomization/Android.mk34
-rw-r--r--LauncherCustomization/AndroidManifest.xml35
-rw-r--r--LauncherCustomization/res/raw/configuration.xml86
-rw-r--r--LauncherCustomization/src/com/droidlogic/launcher/provider/ConfigurationProvider.java155
-rw-r--r--LauncherCustomization/src/com/droidlogic/launcher/provider/CustomizationReceiver.java28
-rw-r--r--LauncherCustomization/src/com/droidlogic/launcher/provider/TestCustomizationReceiver.java28
-rwxr-xr-xcore_amlogic.mk4
-rw-r--r--products/mbox/Vendor_0001_Product_0001.kl6
-rwxr-xr-xsepolicy/property_contexts3
9 files changed, 375 insertions, 4 deletions
diff --git a/LauncherCustomization/Android.mk b/LauncherCustomization/Android.mk
new file mode 100644
index 0000000..270be7a
--- a/dev/null
+++ b/LauncherCustomization/Android.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2014 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_PACKAGE_NAME := LauncherCustomization
+LOCAL_PRIVATE_PLATFORM_APIS := true
+LOCAL_MODULE_TAGS := optional
+LOCAL_CERTIFICATE := platform
+LOCAL_PRIVILEGED_MODULE := true
+LOCAL_USE_AAPT2 := true
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-annotations
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SRC_FILES := \
+ $(call all-Iaidl-files-under, src) \
+ $(call all-java-files-under, src)
+
+include $(BUILD_PACKAGE)
diff --git a/LauncherCustomization/AndroidManifest.xml b/LauncherCustomization/AndroidManifest.xml
new file mode 100644
index 0000000..f8aae4f
--- a/dev/null
+++ b/LauncherCustomization/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.droidlogic.launcher.provider"
+ android:sharedUserId="android.uid.system">
+
+ <application>
+
+ <!-- marker receivers to enabled launcher customization -->
+ <receiver android:name=".TestCustomizationReceiver">
+ <intent-filter>
+ <action android:name="com.google.android.tvlauncher.action.PARTNER_CONFIGURATION_TEST"/>
+ </intent-filter>
+ </receiver>
+ <receiver android:name=".CustomizationReceiver">
+ <intent-filter>
+ <action android:name="com.google.android.tvlauncher.action.PARTNER_CONFIGURATION"/>
+ </intent-filter>
+ </receiver>
+ <provider
+ android:name=".ConfigurationProvider"
+ android:authorities="tvlauncher.config"
+ android:exported="true"/>
+
+ <!-- This Receiver marks this app as being eligible to provide resources which influence
+ the behavior and look of TV Setup. -->
+ <receiver android:name=".PartnerReceiver">
+ <intent-filter>
+ <action android:name="com.google.android.tvsetup.action.PARTNER_CUSTOMIZATION" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </receiver>
+
+ </application>
+
+</manifest>
diff --git a/LauncherCustomization/res/raw/configuration.xml b/LauncherCustomization/res/raw/configuration.xml
new file mode 100644
index 0000000..57959a1
--- a/dev/null
+++ b/LauncherCustomization/res/raw/configuration.xml
@@ -0,0 +1,86 @@
+<configuration>
+ <inputs-configuration show_inputs="false"/>
+
+ <partner-favorite-apps-out-of-box-order>
+ <app
+ name="Netflix"
+ package_name="com.netflix.ninja"/>
+ <app
+ name="Youtube"
+ package_name="com.google.android.youtube.tv"/>
+ <app
+ name="HBO Now"
+ package_name="com.hbo.hbonow"/>
+ <app
+ name="Youtube Kids"
+ package_name="com.google.android.youtube.tvkids"/>
+ <app
+ name="Pandora"
+ package_name="com.pandora.android.atv"/>
+ <app
+ name="CBS All Access"
+ package_name="com.cbs.ott"/>
+ <app
+ name="Sling"
+ package_name="com.sling"/>
+ <app
+ name="Youtube TV"
+ package_name="com.google.android.youtube.tvunplugged"/>
+ </partner-favorite-apps-out-of-box-order>
+
+ <!-- Same as favorite apps OOB -->
+ <partner-all-apps-out-of-box-order>
+ <app
+ name="Netflix"
+ package_name="com.netflix.ninja"/>
+ <app
+ name="Youtube"
+ package_name="com.google.android.youtube.tv"/>
+ <app
+ name="HBO Now"
+ package_name="com.hbo.hbonow"/>
+ <app
+ name="Youtube Kids"
+ package_name="com.google.android.youtube.tvkids"/>
+ <app
+ name="Pandora"
+ package_name="com.pandora.android.atv"/>
+ <app
+ name="CBS All Access"
+ package_name="com.cbs.ott"/>
+ <app
+ name="Sling"
+ package_name="com.sling"/>
+ <app
+ name="Youtube TV"
+ package_name="com.google.android.youtube.tvunplugged"/>
+ </partner-all-apps-out-of-box-order>
+
+ <partner-channels-out-of-box-order>
+ <package-name>com.netflix.ninja</package-name>
+ <package-name>com.google.android.youtube.tv</package-name>
+ <package-name>com.hbo.hbonow</package-name>
+ <package-name>com.google.android.videos</package-name>
+ <package-name>com.pandora.android.atv</package-name>
+ <package-name>com.showtime.standalone</package-name>
+ <package-name>com.sling</package-name>
+ <package-name>com.google.android.youtube.tvkids</package-name>
+ <package-name>com.espn.androidtv</package-name>
+ <package-name>com.tubitv</package-name>
+ <package-name>com.redbull.rbtv</package-name>
+ <package-name>com.cbs.ott</package-name>
+ <package-name>com.bydeluxe.d3.android.program.starz</package-name>
+ <package-name>com.haystack.android</package-name>
+ <package-name>tv.pluto.android</package-name>
+ <package-name>com.google.android.music</package-name>
+ <package-name>com.google.android.youtube.tv</package-name>
+ <package-name>com.fandango.fandangonow.android.tv</package-name>
+ </partner-channels-out-of-box-order>
+
+ <partner-app-channel-quota>
+ <app
+ package_name="com.google.android.youtube.tv"
+ quota="2"/>
+ </partner-app-channel-quota>
+
+</configuration>
diff --git a/LauncherCustomization/src/com/droidlogic/launcher/provider/ConfigurationProvider.java b/LauncherCustomization/src/com/droidlogic/launcher/provider/ConfigurationProvider.java
new file mode 100644
index 0000000..96d7e73
--- a/dev/null
+++ b/LauncherCustomization/src/com/droidlogic/launcher/provider/ConfigurationProvider.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2015 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.droidlogic.launcher.provider;
+
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.content.UriMatcher;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.ParcelFileDescriptor;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.util.Log;
+import com.droidlogic.launcher.provider.R;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Content provider that allows the TV Launcher to read configuration files.
+ */
+public class ConfigurationProvider extends ContentProvider {
+
+ private static final String TAG = "ConfigurationProvider";
+
+ private static final String CONFIG_AUTHORITY = "tvlauncher.config";
+ private static final String WIDGET_AUTHORITY = "tvlauncher.widget";
+ private static final String CONFIGURATION_DATA = "configuration";
+ private static final String WIDGET_DATA = "widget";
+
+ private static final String CONFIG_FILE_PREFIX = "configuration_";
+
+ private static final int MATCH_CONFIGURATION = 1;
+ private static final int MATCH_WIDGET = 3;
+
+ private static final UriMatcher URI_MATCHER;
+
+ static {
+ URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
+ URI_MATCHER.addURI(CONFIG_AUTHORITY, CONFIGURATION_DATA, MATCH_CONFIGURATION);
+ //URI_MATCHER.addURI(WIDGET_AUTHORITY, WIDGET_DATA, MATCH_WIDGET);
+ }
+
+ @Nullable
+ @Override
+ public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode)
+ throws FileNotFoundException {
+ final InputStream stream;
+ PipeDataWriter writer;
+ switch (URI_MATCHER.match(uri)) {
+ case MATCH_CONFIGURATION:
+ stream = createConfigurationStream();
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown URI: " + uri);
+ }
+ writer = new PipeDataWriter() {
+ @Override
+ public void writeDataToPipe(@NonNull ParcelFileDescriptor output, @NonNull Uri uri,
+ @NonNull String mimeType, @Nullable Bundle opts, @Nullable Object args) {
+ try (FileOutputStream out = new FileOutputStream(output.getFileDescriptor())) {
+ byte[] buffer = new byte[8192];
+ int count;
+ while ((count = stream.read(buffer)) != -1) {
+ out.write(buffer, 0, count);
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "Failed to send file " + uri, e);
+ }
+ }
+ };
+ return openPipeHelper(uri, "text/xml", null, null, writer);
+ }
+
+ /**
+ * Returns customization config stream.
+ *
+ * <p>It loads config file based on country code of the device.</p>
+ */
+ private InputStream createConfigurationStream() {
+ Context context = getContext().getApplicationContext();
+
+ return context.getResources().openRawResource(R.raw.configuration);
+ }
+
+ @Nullable
+ @Override
+ public Cursor query(@NonNull Uri uri, String[] projection, String selection,
+ String[] selectionArgs, String sortOrder) {
+
+ switch (URI_MATCHER.match(uri)) {
+ /*
+ case MATCH_WIDGET:
+ String packageName = getContext().getApplicationContext().getPackageName();
+ Intent intent = new Intent(getContext(), InputsActivity.class);
+ MatrixCursor cursor = new MatrixCursor(new String[]{"icon", "title", "action"});
+
+ String icon = "android.resource://" + packageName + "/raw/round_input_white_36dp";
+ String title = getContext().getString(R.string.inputs);
+ String action = intent.toUri(Intent.URI_INTENT_SCHEME);
+
+ cursor.addRow(new String[]{icon, title, action});
+ return cursor;
+ */
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public boolean onCreate() {
+ return true;
+ }
+
+ @Nullable
+ @Override
+ public Uri insert(@NonNull Uri uri, ContentValues values) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int update(@NonNull Uri uri, ContentValues values, String selection,
+ String[] selectionArgs) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getType(@NonNull Uri uri) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/LauncherCustomization/src/com/droidlogic/launcher/provider/CustomizationReceiver.java b/LauncherCustomization/src/com/droidlogic/launcher/provider/CustomizationReceiver.java
new file mode 100644
index 0000000..51a8dbf
--- a/dev/null
+++ b/LauncherCustomization/src/com/droidlogic/launcher/provider/CustomizationReceiver.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2015 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.droidlogic.launcher.provider;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+public class CustomizationReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // do nothing (this is just a marker broadcast receiver for customization package detection)
+ }
+}
diff --git a/LauncherCustomization/src/com/droidlogic/launcher/provider/TestCustomizationReceiver.java b/LauncherCustomization/src/com/droidlogic/launcher/provider/TestCustomizationReceiver.java
new file mode 100644
index 0000000..289c9a3
--- a/dev/null
+++ b/LauncherCustomization/src/com/droidlogic/launcher/provider/TestCustomizationReceiver.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2015 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.droidlogic.launcher.provider;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+public class TestCustomizationReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // do nothing (this is just a marker broadcast receiver for customization package detection)
+ }
+}
diff --git a/core_amlogic.mk b/core_amlogic.mk
index 5c98703..6347bbf 100755
--- a/core_amlogic.mk
+++ b/core_amlogic.mk
@@ -426,6 +426,10 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
android.hardware.atrace@1.0-service
+# Customize launcher
+PRODUCT_PACKAGES += \
+ LauncherCustomization
+
#PRODUCT_PACKAGES += \
# vndk-sp
diff --git a/products/mbox/Vendor_0001_Product_0001.kl b/products/mbox/Vendor_0001_Product_0001.kl
index 426258c..775f681 100644
--- a/products/mbox/Vendor_0001_Product_0001.kl
+++ b/products/mbox/Vendor_0001_Product_0001.kl
@@ -107,9 +107,9 @@ key 116 POWER
#key 116 POWER WAKE
key 113 VOLUME_MUTE
key 128 MEDIA_STOP
-key 130 ZOOM_IN
-key 131 ZOOM_OUT
-key 133 INFO
+key 130 MEDIA_NEXT
+key 131 MEDIA_PREVIOUS
+key 133 STEM_1
key 140 F10
#key 132 TV_REPEAT
#key 134 TV_SHORTCUTKEY_DISPAYMODE
diff --git a/sepolicy/property_contexts b/sepolicy/property_contexts
index db22556..ef68a19 100755
--- a/sepolicy/property_contexts
+++ b/sepolicy/property_contexts
@@ -21,7 +21,8 @@ vendor.rc_hidraw_fd u:object_r:bluetooth_prop:s0
vendor.bcm_wifi u:object_r:exported_wifi_prop:s0 exact enum bcm nobcm
ro.vendor.rfkilldisabled u:object_r:bluetooth_prop:s0
vendor.display-size u:object_r:netflix_prop:s0
-ro.vendor.nrdp.modelgroup u:object_r:netflix_prop:s0
+vendor.netflix.state u:object_r:netflix_prop:s0
+ro.vendor.nrdp. u:object_r:netflix_prop:s0
ro.vendor.platform u:object_r:vendor_platform_prop:s0
persist.vendor.sys u:object_r:vendor_persist_prop:s0
vendor.sys u:object_r:vendor_platform_prop:s0