Browse Source

Settings - Add ROM Control quick link back into Settings

Ported to pie

Change-Id: Iac7909b7ac06946f8aabba14498f9cc5ef683c51
Signed-off-by: STELIX <ssspinni@gmail.com>
Adam Fisch 3 years ago
parent
commit
cd76e402ff

+ 24
- 0
Android.mk View File

@@ -19,6 +19,7 @@ LOCAL_MODULE_TAGS := optional
19 19
 LOCAL_USE_AAPT2 := true
20 20
 
21 21
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
22
+LOCAL_SRC_FILES += $(call all-java-files-under, ../ROMControl/src) 
22 23
 
23 24
 LOCAL_STATIC_ANDROID_LIBRARIES := \
24 25
     android-slices-builders \
@@ -37,10 +38,22 @@ LOCAL_JAVA_LIBRARIES := \
37 38
     bouncycastle \
38 39
     telephony-common \
39 40
     ims-common
41
+    
42
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
43
+    frameworks/support/v4 \
44
+    frameworks/support/v7/appcompat/res \
45
+    frameworks/support/v7/cardview/res \
46
+    frameworks/support/v7/preference/res \
47
+    frameworks/support/v7/recyclerview/res \
48
+    frameworks/support/v13 \
49
+    frameworks/support/v14/preference/res \
50
+	packages/apps/ROMControl/res
40 51
 
41 52
 LOCAL_STATIC_JAVA_LIBRARIES := \
42 53
     android-arch-lifecycle-runtime \
43 54
     android-arch-lifecycle-extensions \
55
+    AndroidAsync \
56
+    gson \
44 57
     guava \
45 58
     jsr305 \
46 59
     settings-logtags \
@@ -48,6 +61,17 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
48 61
 
49 62
 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
50 63
 
64
+LOCAL_AAPT_FLAGS := --auto-add-overlay \
65
+    --extra-packages android.support.v4 \
66
+    --extra-packages android.support.v7.appcompat \
67
+    --extra-packages android.support.v7.cardview \
68
+    --extra-packages android.support.v7.preference \
69
+    --extra-packages android.support.v7.recyclerview \
70
+    --extra-packages android.support.v13 \
71
+    --extra-packages android.support.v14.preference \
72
+    --extra-packages android.support.design \
73
+    --extra-packages com.aokp.romcontrol
74
+    
51 75
 ifneq ($(INCREMENTAL_BUILDS),)
52 76
     LOCAL_PROGUARD_ENABLED := disabled
53 77
     LOCAL_JACK_ENABLED := incremental

+ 18
- 2
AndroidManifest.xml View File

@@ -3147,7 +3147,7 @@
3147 3147
             android:icon="@drawable/ic_homepage_system_dashboard"
3148 3148
             android:taskAffinity="com.android.settings"
3149 3149
             android:parentActivityName="Settings">
3150
-            <intent-filter android:priority="-1">
3150
+            <intent-filter android:priority="-2">
3151 3151
                 <action android:name="com.android.settings.action.SETTINGS"/>
3152 3152
             </intent-filter>
3153 3153
             <meta-data android:name="com.android.settings.category"
@@ -3163,7 +3163,7 @@
3163 3163
                   android:icon="@drawable/ic_homepage_support"
3164 3164
                   android:theme="@android:style/Theme.DeviceDefault.Light.Panel"
3165 3165
                   android:enabled="@bool/config_support_enabled">
3166
-            <intent-filter android:priority="-2">
3166
+            <intent-filter android:priority="-3">
3167 3167
                 <action android:name="com.android.settings.action.SETTINGS"/>
3168 3168
             </intent-filter>
3169 3169
             <intent-filter>
@@ -3328,5 +3328,21 @@
3328 3328
                  android:permission="android.permission.BIND_JOB_SERVICE" />
3329 3329
 
3330 3330
         <!-- This is the longest AndroidManifest.xml ever. -->
3331
+        
3332
+        <activity android:name="Settings$ROMControlActivity"
3333
+                android:label="@string/rom_control_title"
3334
+                android:icon="@drawable/ic_settings_rom_control_teal"
3335
+                android:taskAffinity="">
3336
+            <intent-filter android:priority="-1">
3337
+                <action android:name="com.android.settings.action.SETTINGS"/>
3338
+            </intent-filter>
3339
+            <meta-data android:name="com.android.settings.category"
3340
+                       android:value="com.android.settings.category.ia.homepage"/>
3341
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
3342
+                android:value="com.android.settings.ROMControl" />
3343
+            <meta-data android:name="com.android.settings.summary"
3344
+                       android:resource="@string/rom_control_category"/>
3345
+        </activity>
3346
+        
3331 3347
     </application>
3332 3348
 </manifest>

BIN
res/drawable-hdpi/ic_settings_rom_control.png View File


BIN
res/drawable-mdpi/ic_settings_rom_control.png View File


BIN
res/drawable-xhdpi/ic_settings_rom_control.png View File


+ 5
- 0
res/drawable/ic_settings_rom_control_teal.xml View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
4
+    android:src="@drawable/ic_settings_rom_control"
5
+    android:tint="@*android:color/material_deep_teal_500" />

+ 4
- 0
res/values/aokp_strings.xml View File

@@ -13,6 +13,10 @@
13 13
 -->
14 14
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
15 15
 
16
+    <!-- Rom Control -->
17
+    <string name="rom_control_title">ROM Control</string>
18
+    <string name="rom_control_category">AOKP</string>
19
+
16 20
     <!-- About phone screen, AOKP version -->
17 21
     <string name="aokp_version_title">AOKP Version</string>
18 22
     <string name="aokp_version_default">Unknown</string>

+ 1
- 1
src/com/android/settings/Settings.java View File

@@ -164,5 +164,5 @@ public class Settings extends SettingsActivity {
164 164
     public static class StorageDashboardActivity extends SettingsActivity {}
165 165
     public static class AccountDashboardActivity extends SettingsActivity {}
166 166
     public static class SystemDashboardActivity extends SettingsActivity {}
167
-
167
+    public static class ROMControlActivity extends SettingsActivity { /* empty */ }
168 168
 }

+ 11
- 0
src/com/android/settings/SettingsActivity.java View File

@@ -152,6 +152,8 @@ public class SettingsActivity extends SettingsDrawerActivity
152 152
 
153 153
     private static final String EXTRA_UI_OPTIONS = "settings:ui_options";
154 154
 
155
+    private static final String ROMCONTROL_FRAGMENT = "com.android.settings.ROMControl";
156
+
155 157
     private String mFragmentClass;
156 158
 
157 159
     private CharSequence mInitialTitle;
@@ -580,6 +582,15 @@ public class SettingsActivity extends SettingsDrawerActivity
580 582
     private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
581 583
             boolean addToBackStack, int titleResId, CharSequence title, boolean withTransition) {
582 584
         Log.d(LOG_TAG, "Switching to fragment " + fragmentName);
585
+
586
+        if (ROMCONTROL_FRAGMENT.equals(fragmentName)) {
587
+            Intent ROMControlIntent = new Intent();
588
+            ROMControlIntent.setClassName("com.aokp.romcontrol", "com.aokp.romcontrol.MainActivity");
589
+            startActivity(ROMControlIntent);
590
+            finish();
591
+            return null;
592
+        }
593
+
583 594
         if (validate && !isValidFragment(fragmentName)) {
584 595
             throw new IllegalArgumentException("Invalid fragment for this activity: "
585 596
                     + fragmentName);