zenfone9: Add TileActivity for the QS Tiles

launch of the device settings page instead of app info on long press

Change-Id: Id667983794921c45a26e2bf6f2cfd306ce064c71
diff --git a/DeviceParts/AndroidManifest.xml b/DeviceParts/AndroidManifest.xml
index fce12c7..924a3a8 100644
--- a/DeviceParts/AndroidManifest.xml
+++ b/DeviceParts/AndroidManifest.xml
@@ -19,6 +19,15 @@
         tools:replace="android:appComponentFactory"
         android:supportsRtl="true" >
         <activity
+             android:name="org.omnirom.device.TileActivity"
+             android:taskAffinity=""
+             android:excludeFromRecents="true"
+             android:exported="true" >
+            <intent-filter>
+                <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES"/>
+            </intent-filter>
+        </activity>
+        <activity
             android:name="org.omnirom.device.DeviceSettingsActivity"
             android:exported="false"
             android:label="@string/advanced_settings"
@@ -38,6 +47,10 @@
                 <!--<category android:name="android.intent.category.LAUNCHER" />-->
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
+            <intent-filter>
+                <action android:name="org.omnirom.device.DEVICE_SETTING_PAGE"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+            </intent-filter>
         </activity-alias>
         <activity
             android:name="org.omnirom.device.GestureSettingsActivity"
diff --git a/DeviceParts/src/org/omnirom/device/TileActivity.java b/DeviceParts/src/org/omnirom/device/TileActivity.java
new file mode 100644
index 0000000..480ec2a
--- /dev/null
+++ b/DeviceParts/src/org/omnirom/device/TileActivity.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2021 The OmniROM 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 org.omnirom.device;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+
+public class TileActivity extends Activity {
+    protected void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        Intent intent = new Intent();
+        String className = ((ComponentName) getIntent().getParcelableExtra("android.intent.extra.COMPONENT_NAME")).getClassName();
+        if (className.equals("org.omnirom.device.FrameRateTileService") ||
+                className.equals("org.omnirom.device.GloveModeTileService")) {
+            intent.setPackage("org.omnirom.device");
+            intent.setAction("org.omnirom.device.DEVICE_SETTING_PAGE");
+            startActivity(intent);
+        }
+        finish();
+    }
+}