Allow BluetoothServices to be in the product partition.

TODO: We should find a better solution for BluetoothServices.

Bug: 237014662
Bug: 220045741
Bug: 238812867
Test: make device, check artifacts and manual test its functions.
Change-Id: I168ebd4e85d86803abe78e976805ad8f38dd4b67
(cherry picked from commit 157b4ec0931e26bd9734fa6d0720d99c37bc8eb6)
diff --git a/libraries/BluetoothServices/Android.bp b/libraries/BluetoothServices/Android.bp
index 894031f..4631c4c 100644
--- a/libraries/BluetoothServices/Android.bp
+++ b/libraries/BluetoothServices/Android.bp
@@ -12,6 +12,7 @@
 
     srcs: ["src/**/*.java"],
     static_libs: [
+        "androidx.annotation_annotation",
         "androidx.leanback_leanback",
         "androidx.leanback_leanback-preference",
         "androidx.legacy_legacy-support-core-ui",
@@ -22,4 +23,5 @@
     min_sdk_version: "32",
     resource_dirs: ["res"],
     manifest: "AndroidManifest.xml",
+    sdk_version: "system_current",
 }
diff --git a/libraries/BluetoothServices/src/com/google/android/tv/btservices/BluetoothDeviceService.java b/libraries/BluetoothServices/src/com/google/android/tv/btservices/BluetoothDeviceService.java
index e93b003..d7d6ec3 100644
--- a/libraries/BluetoothServices/src/com/google/android/tv/btservices/BluetoothDeviceService.java
+++ b/libraries/BluetoothServices/src/com/google/android/tv/btservices/BluetoothDeviceService.java
@@ -169,8 +169,7 @@
                 }
                 boolean isSystemApp = ((info.activityInfo.applicationInfo.flags &
                         ApplicationInfo.FLAG_SYSTEM) != 0) ||
-                        ((info.activityInfo.applicationInfo.flags &
-                                ApplicationInfo.PRIVATE_FLAG_OEM) != 0);
+                        (info.activityInfo.applicationInfo.isOem());
                 Log.i(TAG, "Found activity: " + info.activityInfo + " for intent: " + intent +
                         " is System/OEM app: " + isSystemApp);
                 if (!isSystemApp) {
diff --git a/libraries/BluetoothServices/src/com/google/android/tv/btservices/NotificationCenter.java b/libraries/BluetoothServices/src/com/google/android/tv/btservices/NotificationCenter.java
index 8fe3e21..adcc215 100644
--- a/libraries/BluetoothServices/src/com/google/android/tv/btservices/NotificationCenter.java
+++ b/libraries/BluetoothServices/src/com/google/android/tv/btservices/NotificationCenter.java
@@ -128,7 +128,7 @@
     }
 
     private void ensureNotificationChannel(String channelId,
-            @NotificationManager.Importance int importance, CharSequence name, String description) {
+            int importance, CharSequence name, String description) {
         if (mNotificationManager.getNotificationChannel(channelId) != null) {
             return;
         }
diff --git a/libraries/BluetoothServices/src/com/google/android/tv/btservices/remote/DfuProvider.java b/libraries/BluetoothServices/src/com/google/android/tv/btservices/remote/DfuProvider.java
index 6e5bd04..5e638b9 100644
--- a/libraries/BluetoothServices/src/com/google/android/tv/btservices/remote/DfuProvider.java
+++ b/libraries/BluetoothServices/src/com/google/android/tv/btservices/remote/DfuProvider.java
@@ -16,7 +16,6 @@
 
 package com.google.android.tv.btservices.remote;
 
-import android.annotation.Nullable;
 import android.content.Context;
 import android.os.AsyncTask;
 import android.os.Environment;
@@ -25,6 +24,7 @@
 import android.os.SystemProperties;
 import android.text.TextUtils;
 import android.util.Log;
+import androidx.annotation.Nullable;
 import com.google.android.tv.btservices.R;
 import java.io.File;
 import java.io.FileInputStream;
diff --git a/libraries/BluetoothServices/src/com/google/android/tv/btservices/settings/ConnectedDevicesSliceProvider.java b/libraries/BluetoothServices/src/com/google/android/tv/btservices/settings/ConnectedDevicesSliceProvider.java
index 93d22e2..03a66f1 100644
--- a/libraries/BluetoothServices/src/com/google/android/tv/btservices/settings/ConnectedDevicesSliceProvider.java
+++ b/libraries/BluetoothServices/src/com/google/android/tv/btservices/settings/ConnectedDevicesSliceProvider.java
@@ -40,7 +40,6 @@
 
 import android.app.PendingIntent;
 import android.app.admin.DevicePolicyManager;
-import android.app.tvsettings.TvSettingsEnums;
 import android.bluetooth.BluetoothDevice;
 import android.content.ComponentName;
 import android.content.Context;
@@ -243,7 +242,7 @@
         psb.addScreenTitle(
                 new RowBuilder()
                         .setTitle(getString(R.string.connected_devices_slice_pref_title))
-                        .setPageId(TvSettingsEnums.CONNECTED_SLICE));
+                        .setPageId(0x18000000)); // TvSettingsEnums.CONNECTED_SLICE
 
         RestrictedLockUtils.EnforcedAdmin admin =
                 RestrictedLockUtilsInternal.checkIfRestrictionEnforced(getContext(),
@@ -269,7 +268,7 @@
         psb.addPreference(new RowBuilder()
                 .setKey(KEY_PAIR_REMOTE)
                 .setTitle(getString(R.string.settings_pair_remote))
-                .setActionId(TvSettingsEnums.CONNECTED_SLICE_CONNECT_NEW_DEVICES)
+                .setActionId(0x18100000) // TvSettingsEnums.CONNECTED_SLICE_CONNECT_NEW_DEVICES
                 .setIcon(IconCompat.createWithResource(getContext(),
                         R.drawable.ic_baseline_add_24dp))
                 .setIconNeedsToBeProcessed(true)
@@ -418,7 +417,7 @@
         psb.addScreenTitle(
                 new RowBuilder()
                         .setTitle(deviceName)
-                        .setPageId(TvSettingsEnums.CONNECTED_SLICE_DEVICE_ENTRY));
+                        .setPageId(0x18200000)); // TvSettingsEnums.CONNECTED_SLICE_DEVICE_ENTRY
 
         Bundle extras = new Bundle();
         Intent i = null;
@@ -454,7 +453,8 @@
                 updatePref.setTitle(getString(R.string.settings_bt_update));
                 updatePref.setEnabled(true);
                 updatePref.setSelectable(true);
-                updatePref.setActionId(TvSettingsEnums.CONNECTED_SLICE_DEVICE_ENTRY_UPDATE);
+                // TvSettingsEnums.CONNECTED_SLICE_DEVICE_ENTRY_UPDATE
+                updatePref.setActionId(0x18210000);
                 if (btDeviceProvider.isBatteryLow(device)) {
                     updatePref.setSubtitle(getString(R.string.settings_bt_battery_low));
                     updatePref.setEnabled(false);
@@ -512,7 +512,7 @@
         RowBuilder renamePref = new RowBuilder()
                 .setKey(KEY_RENAME)
                 .setTitle(getString(R.string.bluetooth_rename))
-                .setActionId(TvSettingsEnums.CONNECTED_SLICE_DEVICE_ENTRY_RENAME);
+                .setActionId(0x18220000); // TvSettingsEnums.CONNECTED_SLICE_DEVICE_ENTRY_RENAME
         extras = new Bundle();
         ResponseFragment.prepareArgs(
                 extras,
@@ -542,7 +542,7 @@
         RowBuilder forgetPref = new RowBuilder()
                 .setKey(KEY_FORGET)
                 .setTitle(getString(R.string.bluetooth_forget))
-                .setActionId(TvSettingsEnums.CONNECTED_SLICE_DEVICE_ENTRY_FORGET);
+                .setActionId(0x18230000); // TvSettingsEnums.CONNECTED_SLICE_DEVICE_ENTRY_FORGET
         extras = new Bundle();
         i = new Intent(context, ResponseActivity.class);
         ResponseFragment.prepareArgs(
@@ -606,7 +606,7 @@
         psb.addScreenTitle(
                 new RowBuilder()
                         .setTitle(getString(R.string.settings_hdmi_cec))
-                        .setPageId(TvSettingsEnums.CONNECTED_SLICE_HDMICEC));
+                        .setPageId(0x18300000)); // TvSettingsEnums.CONNECTED_SLICE_HDMICEC
         final boolean isEnabled = PowerUtils.isCecControlEnabled(getContext());
         Intent intent = new Intent(ACTION_TOGGLE_CHANGED);
         intent.putExtra(TOGGLE_TYPE, CEC);
@@ -616,7 +616,7 @@
                 PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
         psb.addPreference(new RowBuilder()
                 .setTitle(getString(R.string.settings_enable_hdmi_cec))
-                .setActionId(TvSettingsEnums.CONNECTED_SLICE_HDMICEC_ON_OFF)
+                .setActionId(0x18310000) // TvSettingsEnums.CONNECTED_SLICE_HDMICEC_ON_OFF
                 .addSwitch(pendingIntent, null, isEnabled));
         psb.addPreference(new RowBuilder()
                 .setTitle(getString(R.string.settings_cec_explain))