aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrumeet <liangyuteng12345@gmail.com>2018-11-25 20:08:43 -0800
committerTrumeet <liangyuteng12345@gmail.com>2018-11-25 20:08:43 -0800
commitc5f5c348be705d88ed731e335eb102fccc7f5880 (patch)
treeccc1cd4586685018f8bbeda9080dea1bd48a9735
downloadSysUIController-c5f5c348be705d88ed731e335eb102fccc7f5880.tar
SysUIController-c5f5c348be705d88ed731e335eb102fccc7f5880.tar.gz
SysUIController-c5f5c348be705d88ed731e335eb102fccc7f5880.tar.bz2
SysUIController-c5f5c348be705d88ed731e335eb102fccc7f5880.zip
First Commitv1.0α
-rw-r--r--.gitignore17
-rw-r--r--app/.gitignore1
-rw-r--r--app/build.gradle50
-rw-r--r--app/dic.txt41
-rw-r--r--app/proguard-rules.pro1
-rw-r--r--app/src/androidTest/java/moe/yuuta/sysuicontroller/ExampleInstrumentedTest.java27
-rw-r--r--app/src/main/AndroidManifest.xml46
-rw-r--r--app/src/main/aidl/moe/yuuta/sysuicontroller/IStatusController.aidl26
-rw-r--r--app/src/main/aidl/moe/yuuta/sysuicontroller/core/DisableItem.aidl4
-rw-r--r--app/src/main/java/moe/yuuta/sysuicontroller/Main.java59
-rw-r--r--app/src/main/java/moe/yuuta/sysuicontroller/MainActivity.java20
-rw-r--r--app/src/main/java/moe/yuuta/sysuicontroller/MainFragment.java358
-rw-r--r--app/src/main/java/moe/yuuta/sysuicontroller/about/VersionDialogFragment.java23
-rw-r--r--app/src/main/java/moe/yuuta/sysuicontroller/auto_start/AutoStartReceiver.java24
-rw-r--r--app/src/main/java/moe/yuuta/sysuicontroller/auto_start/AutoStartWorker.java76
-rw-r--r--app/src/main/java/moe/yuuta/sysuicontroller/core/ControllerService.java164
-rw-r--r--app/src/main/java/moe/yuuta/sysuicontroller/core/DisableItem.java82
-rw-r--r--app/src/main/res/drawable-v24/ic_launcher_foreground.xml34
-rw-r--r--app/src/main/res/drawable/ic_launcher_background.xml170
-rw-r--r--app/src/main/res/layout/activity_main.xml21
-rw-r--r--app/src/main/res/layout/fragment_about.xml43
-rw-r--r--app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml5
-rw-r--r--app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml5
-rw-r--r--app/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 2963 bytes
-rw-r--r--app/src/main/res/mipmap-hdpi/ic_launcher_round.pngbin0 -> 4905 bytes
-rw-r--r--app/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 2060 bytes
-rw-r--r--app/src/main/res/mipmap-mdpi/ic_launcher_round.pngbin0 -> 2783 bytes
-rw-r--r--app/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 4490 bytes
-rw-r--r--app/src/main/res/mipmap-xhdpi/ic_launcher_round.pngbin0 -> 6895 bytes
-rw-r--r--app/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 6387 bytes
-rw-r--r--app/src/main/res/mipmap-xxhdpi/ic_launcher_round.pngbin0 -> 10413 bytes
-rw-r--r--app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngbin0 -> 9128 bytes
-rw-r--r--app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.pngbin0 -> 15132 bytes
-rw-r--r--app/src/main/res/navigation/main_nav.xml10
-rw-r--r--app/src/main/res/values/colors.xml6
-rw-r--r--app/src/main/res/values/strings.xml42
-rw-r--r--app/src/main/res/values/styles.xml15
-rw-r--r--app/src/main/res/xml/main_settings.xml84
-rw-r--r--app/src/test/java/moe/yuuta/sysuicontroller/ExampleUnitTest.java17
-rw-r--r--build.gradle32
-rw-r--r--gradle.properties20
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin0 -> 54329 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xgradlew172
-rw-r--r--gradlew.bat84
-rw-r--r--hiddenapi/.gitignore1
-rw-r--r--hiddenapi/build.gradle8
-rw-r--r--hiddenapi/src/main/java/android/app/StatusBarManager.java141
-rw-r--r--settings.gradle1
49 files changed, 1936 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..de0dc58
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+/.idea
+/app/google-services.json
+/sign.jks
+/app/release \ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..f2bc5db
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,50 @@
+apply plugin: 'com.android.application'
+apply plugin: "androidx.navigation.safeargs"
+apply plugin: 'com.google.gms.google-services'
+apply plugin: 'io.fabric'
+apply plugin: 'com.google.android.gms.oss-licenses-plugin'
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "moe.yuuta.sysuicontroller"
+ minSdkVersion 21
+ targetSdkVersion 28
+ versionCode 1
+ versionName "0.1 α"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility = '1.8'
+ targetCompatibility = '1.8'
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'com.google.firebase:firebase-core:16.0.5'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test:runner:1.1.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
+ implementation 'eu.chainfire:librootjava:1.0.0'
+ implementation 'eu.chainfire:libsuperuser:1.0.0.+'
+ implementation 'eu.chainfire:librootjavadaemon:1.0.0'
+ implementation 'moe.shizuku.preference:preference:3.0.0'
+ implementation 'moe.shizuku.preference:preference-dialog-android:3.0.0'
+ implementation 'moe.shizuku.preference:preference-simplemenu:3.0.0'
+ def nav_version = "1.0.0-alpha07"
+ implementation "android.arch.navigation:navigation-fragment:$nav_version"
+ implementation "android.arch.navigation:navigation-ui:$nav_version"
+ implementation 'com.crashlytics.sdk.android:crashlytics:2.9.6'
+ implementation "android.arch.work:work-runtime:1.0.0-alpha11"
+ implementation 'com.google.android.gms:play-services-oss-licenses:16.0.1'
+ compileOnly project(':hiddenapi')
+}
diff --git a/app/dic.txt b/app/dic.txt
new file mode 100644
index 0000000..22a0249
--- /dev/null
+++ b/app/dic.txt
@@ -0,0 +1,41 @@
+香港
+记者
+连任
+吼啊
+鸭嘴笔
+董建华
+张宝华
+tooYoung
+tooSimple
+当然啦
+上海交大
+学习一个
+身经百战
+见得多了
+谈笑风生
+sometimesNaive
+朱物华校长
+张钟俊院长
+你们还是要
+有事找大哥
+董先生连任
+搞个大新闻
+applyForProfessor
+youMeanImADictator
+美国的华莱士
+识得唔识得啊
+跑得比谁都快
+你们呀,Naive!
+苟利国家生死以
+岂因祸福避趋之
+不是我要钦点他
+不知高到哪里去
+一点人生的经验,
+「闷声大发财」
+《微电子工业的发展》
+他们这里洋文好的人多得很呐
+西方的那一个国家我没有去过?
+你们毕竟还TooYoung,明白这意思吗?
+《能源与发展趋势的主要节能措施》
+搞来搞去还是图样图森破,上台拿衣服!
+将来如果在报道上有偏差,你们要负责。 \ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..b6eed67
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1 @@
+-obfuscationdictionary dic.txt \ No newline at end of file
diff --git a/app/src/androidTest/java/moe/yuuta/sysuicontroller/ExampleInstrumentedTest.java b/app/src/androidTest/java/moe/yuuta/sysuicontroller/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..ee3f34e
--- /dev/null
+++ b/app/src/androidTest/java/moe/yuuta/sysuicontroller/ExampleInstrumentedTest.java
@@ -0,0 +1,27 @@
+package moe.yuuta.sysuicontroller;
+
+import android.content.Context;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("moe.yuuta.sysuicontroller", appContext.getPackageName());
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ed9c59a
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="moe.yuuta.sysuicontroller">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <permission android:name="${applicationId}.SERVICE"
+ android:protectionLevel="signature|privileged" />
+ <uses-permission android:name="${applicationId}.SERVICE" />
+ <application
+ android:name=".Main"
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:roundIcon="@mipmap/ic_launcher_round"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme"
+ tools:ignore="AllowBackup,GoogleAppIndexingWarning">
+ <activity android:name=".MainActivity"
+ android:label="@string/app_title">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <receiver android:name=".auto_start.AutoStartReceiver"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
+ </intent-filter>
+ </receiver>
+ <provider
+ android:name="com.google.firebase.provider.FirebaseInitProvider"
+ android:authorities="${applicationId}.firebaseinitprovider"
+ tools:node="remove"
+ android:exported="false" />
+ <provider
+ android:name="androidx.work.impl.WorkManagerInitializer"
+ android:authorities="${applicationId}.workmanager-init"
+ android:exported="false"
+ android:multiprocess="true"
+ tools:node="remove"/>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/app/src/main/aidl/moe/yuuta/sysuicontroller/IStatusController.aidl b/app/src/main/aidl/moe/yuuta/sysuicontroller/IStatusController.aidl
new file mode 100644
index 0000000..0938103
--- /dev/null
+++ b/app/src/main/aidl/moe/yuuta/sysuicontroller/IStatusController.aidl
@@ -0,0 +1,26 @@
+// IStatusController.aidl
+package moe.yuuta.sysuicontroller;
+
+import moe.yuuta.sysuicontroller.core.DisableItem;
+// Declare any non-default types here with import statements
+
+interface IStatusController {
+ // Same as StatusBarManager
+ void disable (int flags);
+ void disable2 (int flags);
+ void expandNotificationsPanel ();
+ void collapsePanels ();
+ void expandSettingsPanel (in String subPanel);
+ void setIcon(in String slot, int iconId, int iconLevel, in String contentDescription);
+ void removeIcon(in String slot);
+ void setIconVisibility(in String slot, boolean visible);
+
+ // Private methods
+ void exit ();
+ int getDisableFlags ();
+ int getDisable2Flags ();
+
+ // Methods used to access hidden-api from server part
+ List<DisableItem> getAvailableDisableItems ();
+ int getDisableNoneFlag (boolean disable2);
+}
diff --git a/app/src/main/aidl/moe/yuuta/sysuicontroller/core/DisableItem.aidl b/app/src/main/aidl/moe/yuuta/sysuicontroller/core/DisableItem.aidl
new file mode 100644
index 0000000..ae857a2
--- /dev/null
+++ b/app/src/main/aidl/moe/yuuta/sysuicontroller/core/DisableItem.aidl
@@ -0,0 +1,4 @@
+// DisableItem.aidl
+package moe.yuuta.sysuicontroller.core;
+
+parcelable DisableItem; \ No newline at end of file
diff --git a/app/src/main/java/moe/yuuta/sysuicontroller/Main.java b/app/src/main/java/moe/yuuta/sysuicontroller/Main.java
new file mode 100644
index 0000000..100ff9a
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/sysuicontroller/Main.java
@@ -0,0 +1,59 @@
+package moe.yuuta.sysuicontroller;
+
+import android.app.Activity;
+import android.app.Application;
+import android.os.Bundle;
+
+import com.google.firebase.FirebaseApp;
+import com.google.firebase.analytics.FirebaseAnalytics;
+
+import androidx.work.Configuration;
+import androidx.work.WorkManager;
+
+public class Main extends Application {
+ public static final String GLOBAL_TAG = "SysUIController";
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
+ @Override
+ public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
+ unregisterActivityLifecycleCallbacks(this);
+ FirebaseApp.initializeApp(activity);
+ FirebaseAnalytics.getInstance(activity);
+ WorkManager.initialize(activity, new Configuration.Builder().build());
+ }
+
+ @Override
+ public void onActivityStarted(Activity activity) {
+
+ }
+
+ @Override
+ public void onActivityResumed(Activity activity) {
+
+ }
+
+ @Override
+ public void onActivityPaused(Activity activity) {
+
+ }
+
+ @Override
+ public void onActivityStopped(Activity activity) {
+
+ }
+
+ @Override
+ public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
+
+ }
+
+ @Override
+ public void onActivityDestroyed(Activity activity) {
+
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/moe/yuuta/sysuicontroller/MainActivity.java b/app/src/main/java/moe/yuuta/sysuicontroller/MainActivity.java
new file mode 100644
index 0000000..6e783b2
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/sysuicontroller/MainActivity.java
@@ -0,0 +1,20 @@
+package moe.yuuta.sysuicontroller;
+
+import android.os.Bundle;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.navigation.Navigation;
+
+public class MainActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ }
+
+ @Override
+ public boolean onSupportNavigateUp() {
+ return Navigation.findNavController(this, R.id.nav_host).navigateUp();
+ }
+}
diff --git a/app/src/main/java/moe/yuuta/sysuicontroller/MainFragment.java b/app/src/main/java/moe/yuuta/sysuicontroller/MainFragment.java
new file mode 100644
index 0000000..fd6aecb
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/sysuicontroller/MainFragment.java
@@ -0,0 +1,358 @@
+package moe.yuuta.sysuicontroller;
+
+import android.content.ActivityNotFoundException;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.RemoteException;
+import android.util.Log;
+import android.util.SparseArray;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.widget.Toast;
+
+import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import eu.chainfire.librootjava.RootIPCReceiver;
+import eu.chainfire.librootjavadaemon.RootDaemon;
+import eu.chainfire.libsuperuser.Shell;
+import moe.shizuku.preference.Preference;
+import moe.shizuku.preference.PreferenceCategory;
+import moe.shizuku.preference.PreferenceFragment;
+import moe.shizuku.preference.PreferenceGroup;
+import moe.shizuku.preference.SwitchPreference;
+import moe.yuuta.sysuicontroller.about.VersionDialogFragment;
+import moe.yuuta.sysuicontroller.core.ControllerService;
+import moe.yuuta.sysuicontroller.core.DisableItem;
+
+import static moe.yuuta.sysuicontroller.Main.GLOBAL_TAG;
+
+public class MainFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener, Shell.OnCommandResultListener {
+ private static final String TAG = GLOBAL_TAG + ".MainFragment";
+
+ private static final String ARG_SERVICE = MainFragment.class.getName() + ".ARG_SERVICE";
+ private static final int CODE_START = 1;
+
+ private Shell.Interactive mShell;
+ private volatile IStatusController mService;
+
+ private Preference mStatusPreference;
+ private SparseArray<SwitchPreference> mDisableMap;
+ private SparseArray<SwitchPreference> mDisable2Map;
+ private List<PreferenceGroup> mGroupsShouldBeDisabledBeforeServer = new ArrayList<>(3);
+
+ private RootIPCReceiver<IStatusController> mReceiver = new RootIPCReceiver<IStatusController>(null, ControllerService.CODE_SERVICE) {
+ @Override
+ public void onConnect(IStatusController ipc) {
+ Log.d(TAG, "Connected to remote service");
+ mService = ipc;
+ postStatusUpdate();
+ }
+
+ @Override
+ public void onDisconnect(IStatusController ipc) {
+ Log.d(TAG, "Disconnected to remote service");
+ mService = ipc;
+ postStatusUpdate();
+ }
+ };
+
+ private void serializeDisableFlags () {
+ if (obtainService() == null) return;
+ SharedPreferences.Editor editor = requireContext().getSharedPreferences("flags", Context.MODE_PRIVATE)
+ .edit();
+ try {
+ int disableFlags = mService.getDisableFlags();
+ editor.putInt("disable_flags", disableFlags);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Receive disable flags", e);
+ }
+ try {
+ int disable2Flags = mService.getDisable2Flags();
+ editor.putInt("disable2_flags", disable2Flags);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Receive disable2 flags", e);
+ }
+ editor.apply();
+ }
+
+ private void setNotAvailableBatch (@NonNull Set<String> showedKeys, @NonNull PreferenceGroup root) {
+ for (int i = 0; i < root.getPreferenceCount(); i ++) {
+ Preference preference = root.getPreference(i);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Pref " + preference.getKey() + "(" + preference.getClass().getSimpleName() + ")");
+ if (preference instanceof PreferenceGroup) {
+ setNotAvailableBatch(showedKeys, (PreferenceGroup) preference);
+ continue;
+ }
+ if (!(preference instanceof SwitchPreference)) continue;
+ if (showedKeys.contains(preference.getKey())) continue;
+ Log.w(TAG, "Key not available for this device: " + preference.getKey());
+ setNotAvailable(preference);
+ }
+ }
+
+ private void postStatusUpdate () {
+ new Handler(Looper.getMainLooper()).post(() -> {
+ Log.d(TAG, "Start update status");
+ obtainService();
+ boolean enable = mService != null;
+ for (PreferenceGroup group : mGroupsShouldBeDisabledBeforeServer) {
+ group.setEnabled(enable);
+ }
+ for (int i = 0; i < mDisableMap.size(); i ++) getPreferenceScreen().removePreference(mDisableMap.valueAt(i));
+ for (int i = 0; i < mDisable2Map.size(); i ++) getPreferenceScreen().removePreference(mDisable2Map.valueAt(i));
+ mDisable2Map.clear();
+ mDisableMap.clear();
+ if (enable) {
+ try {
+ List<DisableItem> available = mService.getAvailableDisableItems();
+ Log.d(TAG, "Available disable items: " + available.toString());
+ Set<String /* Name (key) */> showedKeys = new HashSet<>(available.size());
+ for (DisableItem item : available) {
+ showedKeys.add(item.getKey().toLowerCase());
+ SwitchPreference preference = (SwitchPreference) findPreference(item.getKey().toLowerCase());
+ if (preference == null) {
+ // Create a new one for special keys
+ preference = new SwitchPreference(requireContext(), null, moe.shizuku.preference.R.attr.switchPreferenceStyle,
+ R.style.Preference_SwitchPreference);
+ preference.setKey(item.getKey().toLowerCase());
+ preference.setTitle(item.getKey());
+ preference.setSummary(R.string.additional_key);
+ ((PreferenceCategory) findPreference("key_other")).addPreference(preference);
+ }
+ preference.setOnPreferenceChangeListener((p, newValue) -> runDisable(item.getFlag(), (Boolean) newValue, item.getKey(), item.isDisable2()));
+ if (item.isDisable2()) mDisable2Map.put(item.getFlag(), preference);
+ mDisableMap.put(item.getFlag(), preference);
+ }
+
+ // Disable not supported prebuilt preferences
+ Log.d(TAG, "Showed items: " + showedKeys.toString());
+ setNotAvailableBatch(showedKeys, getPreferenceScreen());
+ } catch (Exception e) {
+ Log.e(TAG, "Read available disable items", e);
+ }
+ SharedPreferences preferences = requireContext().getSharedPreferences("flags", Context.MODE_PRIVATE);
+ try {
+ mService.disable(preferences.getInt("disable_flags", mService.getDisableNoneFlag(false)));
+ updateUIDisabled(false, mService.getDisableFlags());
+ } catch (RemoteException e) {
+ Log.e(TAG, "Receive disable flags", e);
+ }
+
+ try {
+ mService.disable2(preferences.getInt("disable2_flags", mService.getDisableNoneFlag(true)));
+ updateUIDisabled(true, mService.getDisableFlags());
+ } catch (RemoteException e) {
+ Log.e(TAG, "Receive disable2 flags", e);
+ }
+ }
+
+ if (mStatusPreference != null) {
+ mStatusPreference.setEnabled(true);
+ mStatusPreference.setSummary(enable
+ ? R.string.status_started : R.string.main_service_status_summary);
+ }
+ });
+ }
+
+ private void updateUIDisabled(boolean disable2, int flags) {
+ SparseArray<SwitchPreference> map =
+ disable2 ? mDisable2Map : mDisableMap;
+ for (int i = 0; i < map.size(); i ++) {
+ int flag = map.keyAt(i);
+ SwitchPreference preference = map.get(flag);
+ if (preference == null) // Not supported
+ continue;
+ preference.setChecked((flags & flag) != 0);
+ }
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ mReceiver.setContext(requireContext());
+ mService = mReceiver.getIPC();
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ runRestoreBinder(savedInstanceState);
+ }
+
+ private void runRestoreBinder (@Nullable Bundle savedInstanceState) {
+ if (BuildConfig.DEBUG) {
+ if (savedInstanceState == null) {
+ Log.d(TAG, "savedInstanceState is null");
+ } else {
+ if (savedInstanceState.getBinder(ARG_SERVICE) == null)
+ Log.d(TAG, "savedInstanceState doesn't contain binder");
+ else
+ Log.d(TAG, "Restoring");
+ }
+ }
+ if (savedInstanceState != null && savedInstanceState.getBinder(ARG_SERVICE) != null) {
+ // FIXME: 11/25/18 The restoried interface's binder not alive
+ mService = IStatusController.Stub.asInterface(savedInstanceState.getBinder(ARG_SERVICE));
+ }
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ menu.add(0, 0, 0, com.google.android.gms.oss.licenses.R.string.oss_license_title);
+ menu.add(0, 1, 0, R.string.about_view_in_play_store);
+ menu.add(0, 2, 0, R.string.about_title);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case 0:
+ startActivity(new Intent(getActivity(), OssLicensesMenuActivity.class));
+ return true;
+ case 1:
+ try {
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID))
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+ } catch (ActivityNotFoundException ignored) {}
+ return true;
+ case 2:
+ new VersionDialogFragment()
+ .show(getChildFragmentManager(), "Version");
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public void onDestroy() {
+ mReceiver.release();
+ // Shell will be closed immediately after executing.
+ if (mShell != null) mShell.close();
+ super.onDestroy();
+ }
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.main_settings, rootKey);
+ mStatusPreference = findPreference("key_service_status");
+ mStatusPreference.setOnPreferenceClickListener(this);
+ mGroupsShouldBeDisabledBeforeServer.add((PreferenceCategory) findPreference("key_status_bar"));
+ mGroupsShouldBeDisabledBeforeServer.add((PreferenceCategory) findPreference("key_notification"));
+ mGroupsShouldBeDisabledBeforeServer.add((PreferenceCategory) findPreference("key_navigation_bar"));
+ mGroupsShouldBeDisabledBeforeServer.add((PreferenceCategory) findPreference("key_quick_settings"));
+ mGroupsShouldBeDisabledBeforeServer.add((PreferenceCategory) findPreference("key_other"));
+ mDisable2Map = new SparseArray<>(5);
+ mDisableMap = new SparseArray<>(7);
+ }
+
+ private boolean runDisable (int flag, boolean enable, String name, boolean disable2) {
+ if (obtainService() == null) return false;
+ Log.i(TAG, "runDisable: " + flag + " " + enable + " (" + name + ") " + disable2);
+ try {
+ int flags = disable2 ? mService.getDisable2Flags() : mService.getDisableFlags();
+ if (enable) {
+ flags |= flag;
+ } else {
+ flags ^= flag;
+ }
+ if (disable2) {
+ mService.disable2(flags);
+ } else {
+ mService.disable(flags);
+ }
+ serializeDisableFlags();
+ return true;
+ } catch (RemoteException e) {
+ Log.e(TAG, "disable " + name, e);
+ return false;
+ }
+ }
+
+ private void setNotAvailable(@NonNull Preference preference) {
+ preference.setEnabled(false);
+ preference.setSummary(R.string.not_available);
+ }
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ switch (preference.getKey()) {
+ case "key_service_status": {
+ boolean shouldStart = obtainService() == null;
+ mStatusPreference.setEnabled(false);
+ mStatusPreference.setSummary(shouldStart ? R.string.status_starting : R.string.status_stopping);
+ if (shouldStart) {
+ mShell = new Shell.Builder()
+ .useSU()
+ .open(this); // Will start after shell opening
+ } else {
+ try {
+ mService.exit();
+ } catch (RemoteException ignored) {
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void onCommandResult(int commandCode, int exitCode, List<String> output) {
+ Log.i(TAG, "Result " + commandCode + ": " + exitCode);
+ if (output != null) {
+ Log.w(TAG, output.toString());
+ }
+ switch (commandCode) {
+ case SHELL_RUNNING:
+ if (exitCode != 0) {
+ Toast.makeText(getContext(), R.string.error_can_not_open_shell, Toast.LENGTH_LONG).show();
+ postStatusUpdate(); // Return status to not started
+ break;
+ }
+ mShell.addCommand(RootDaemon.getLaunchScript(requireContext(),
+ ControllerService.class,
+ null,
+ null,
+ null, BuildConfig.APPLICATION_ID + ":daemon"),
+ CODE_START, this);
+ break;
+ case CODE_START:
+ // Kill process immediately
+ mShell.kill();
+ mShell.close();
+ mShell = null;
+ if (exitCode != 0) Toast.makeText(getContext(), R.string.error_can_not_start, Toast.LENGTH_LONG).show();
+ break;
+ }
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (obtainService() != null)
+ outState.putBinder(ARG_SERVICE, mService.asBinder());
+ }
+
+ private IStatusController obtainService () {
+ if (!mReceiver.isConnected()) { // TODO: Add instance state support
+ mService = null;
+ return null;
+ }
+ mService = mReceiver.getIPC();
+ return mService;
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/moe/yuuta/sysuicontroller/about/VersionDialogFragment.java b/app/src/main/java/moe/yuuta/sysuicontroller/about/VersionDialogFragment.java
new file mode 100644
index 0000000..20f193d
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/sysuicontroller/about/VersionDialogFragment.java
@@ -0,0 +1,23 @@
+package moe.yuuta.sysuicontroller.about;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.DialogFragment;
+import moe.yuuta.sysuicontroller.BuildConfig;
+import moe.yuuta.sysuicontroller.R;
+
+public class VersionDialogFragment extends DialogFragment {
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.fragment_about, container, false);
+ ((TextView) view.findViewById(R.id.text_version)).setText(getString(R.string.about_version, BuildConfig.VERSION_NAME));
+ return view;
+ }
+}
diff --git a/app/src/main/java/moe/yuuta/sysuicontroller/auto_start/AutoStartReceiver.java b/app/src/main/java/moe/yuuta/sysuicontroller/auto_start/AutoStartReceiver.java
new file mode 100644
index 0000000..bce97b0
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/sysuicontroller/auto_start/AutoStartReceiver.java
@@ -0,0 +1,24 @@
+package moe.yuuta.sysuicontroller.auto_start;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import androidx.work.Constraints;
+import androidx.work.ExistingWorkPolicy;
+import androidx.work.OneTimeWorkRequest;
+import androidx.work.WorkManager;
+import moe.yuuta.sysuicontroller.BuildConfig;
+
+public class AutoStartReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.d(AutoStartWorker.class.getSimpleName(), "Received " + intent.getAction());
+ WorkManager.getInstance()
+ .beginUniqueWork(BuildConfig.APPLICATION_ID + ":auto_start",
+ ExistingWorkPolicy.KEEP,
+ new OneTimeWorkRequest.Builder(AutoStartWorker.class).setConstraints(Constraints.NONE)
+ .build()).enqueue();
+ }
+}
diff --git a/app/src/main/java/moe/yuuta/sysuicontroller/auto_start/AutoStartWorker.java b/app/src/main/java/moe/yuuta/sysuicontroller/auto_start/AutoStartWorker.java
new file mode 100644
index 0000000..650eeb3
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/sysuicontroller/auto_start/AutoStartWorker.java
@@ -0,0 +1,76 @@
+package moe.yuuta.sysuicontroller.auto_start;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.RemoteException;
+import android.util.Log;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import androidx.annotation.NonNull;
+import androidx.work.Worker;
+import androidx.work.WorkerParameters;
+import eu.chainfire.librootjava.RootIPCReceiver;
+import eu.chainfire.librootjavadaemon.RootDaemon;
+import eu.chainfire.libsuperuser.Shell;
+import moe.yuuta.sysuicontroller.BuildConfig;
+import moe.yuuta.sysuicontroller.IStatusController;
+import moe.yuuta.sysuicontroller.core.ControllerService;
+
+public class AutoStartWorker extends Worker {
+ private static final String TAG = AutoStartWorker.class.getSimpleName();
+
+ public AutoStartWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
+ super(context, workerParams);
+ }
+
+ private CountDownLatch countDownLatch;
+
+ private RootIPCReceiver<IStatusController> mReceiver = new RootIPCReceiver<IStatusController>(null, ControllerService.CODE_SERVICE) {
+ @Override
+ public void onConnect(IStatusController ipc) {
+ try {
+ SharedPreferences preferences = getApplicationContext().getSharedPreferences("flags", Context.MODE_PRIVATE);
+ ipc.disable(preferences.getInt("disable_flags", ipc.getDisableFlags()));
+ ipc.disable2(preferences.getInt("disable2_flags", ipc.getDisable2Flags()));
+ Log.i(TAG, "Settings restored");
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to restore settings", e);
+ }
+ countDownLatch.countDown();
+ }
+
+ @Override
+ public void onDisconnect(IStatusController ipc) {
+
+ }
+ };
+
+ @NonNull
+ @Override
+ public Result doWork() {
+ Log.i(TAG, "Start auto starting");
+ countDownLatch = new CountDownLatch(1);
+ mReceiver.setContext(getApplicationContext());
+ List<String> commands = RootDaemon.getLaunchScript(getApplicationContext(),
+ ControllerService.class,
+ null,
+ null,
+ null, BuildConfig.APPLICATION_ID + ":daemon");
+ if (BuildConfig.DEBUG) Log.d(TAG, commands.toString());
+ Shell.Interactive shell = new Shell.Builder().useSU().open();
+ shell.addCommand(commands);
+ try {
+ countDownLatch.await(10, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "await()", e);
+ }
+ Log.i(TAG, "Done, releasing receiver");
+ mReceiver.release();
+ shell.kill(); // Kill the process, will make it idle and it won't kill the forked process
+ shell.close();
+ return Result.SUCCESS;
+ }
+}
diff --git a/app/src/main/java/moe/yuuta/sysuicontroller/core/ControllerService.java b/app/src/main/java/moe/yuuta/sysuicontroller/core/ControllerService.java
new file mode 100644
index 0000000..0574fb4
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/sysuicontroller/core/ControllerService.java
@@ -0,0 +1,164 @@
+package moe.yuuta.sysuicontroller.core;
+
+import android.annotation.SuppressLint;
+import android.app.StatusBarManager;
+import android.content.Context;
+import android.os.Binder;
+import android.os.Looper;
+import android.os.RemoteException;
+import android.util.Log;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import eu.chainfire.librootjava.RootIPC;
+import eu.chainfire.librootjava.RootJava;
+import eu.chainfire.librootjavadaemon.RootDaemon;
+import moe.yuuta.sysuicontroller.BuildConfig;
+import moe.yuuta.sysuicontroller.IStatusController;
+
+import static moe.yuuta.sysuicontroller.Main.GLOBAL_TAG;
+
+public class ControllerService extends IStatusController.Stub {
+ private static final String TAG = GLOBAL_TAG + ".ControllerService";
+
+ private int disableFlags = StatusBarManager.DISABLE_NONE;
+ private int disable2Flags = StatusBarManager.DISABLE2_NONE;
+
+ public static final int CODE_SERVICE = 0;
+ private StatusBarManager mManager;
+ private Context mContext;
+
+ public static void main (String... args) throws Throwable {
+ new ControllerService().run(args);
+ }
+
+ @SuppressLint("WrongConstant")
+ private void run (String... args) throws Throwable {
+ Looper.prepare();
+ mContext = RootJava.getSystemContext();
+ mManager = (StatusBarManager) mContext.getSystemService("statusbar");
+ RootDaemon.daemonize(BuildConfig.APPLICATION_ID, CODE_SERVICE);
+ RootJava.restoreOriginalLdLibraryPath();
+ RootDaemon.register(BuildConfig.APPLICATION_ID, this, CODE_SERVICE);
+ Log.i(TAG, "Started at " + new Date().toString());
+ try {
+ new RootIPC(BuildConfig.APPLICATION_ID, this, CODE_SERVICE,
+ 10 * 1000,
+ true);
+ } catch (RootIPC.TimeoutException e) {
+ Log.e(TAG, "Unable to establish a connection, exiting", e);
+ throw e;
+ }
+ RootDaemon.run();
+ Log.i(TAG, "Stopped at " + new Date().toString());
+ }
+
+ private void enforcePermission () throws SecurityException {
+ mContext.enforcePermission(BuildConfig.APPLICATION_ID + ".SERVICE",
+ Binder.getCallingPid(), Binder.getCallingUid(), "Permission denial");
+ }
+
+ @Override
+ public void exit () throws RemoteException {
+ enforcePermission();
+ RootDaemon.exit();
+ }
+
+ @Override
+ public void disable(int flags) throws RemoteException {
+ enforcePermission();
+ disableFlags = flags;
+ mManager.disable(flags);
+ }
+
+ @Override
+ public void disable2(int flags) throws RemoteException {
+ enforcePermission();
+ disable2Flags = flags;
+ mManager.disable2(flags);
+ }
+
+ @Override
+ public void expandNotificationsPanel() throws RemoteException {
+ enforcePermission();
+ mManager.expandNotificationsPanel();
+ }
+
+ @Override
+ public void collapsePanels() throws RemoteException {
+ enforcePermission();
+ mManager.collapsePanels();
+ }
+
+ @Override
+ public void expandSettingsPanel(String subPanel) throws RemoteException {
+ enforcePermission();
+ mManager.expandSettingsPanel(subPanel);
+ }
+
+ @Override
+ public void setIcon(String slot, int iconId, int iconLevel, String contentDescription) throws RemoteException {
+ enforcePermission();
+ mManager.setIcon(slot, iconId, iconLevel, contentDescription);
+ }
+
+ @Override
+ public void removeIcon(String slot) throws RemoteException {
+ enforcePermission();
+ mManager.removeIcon(slot);
+ }
+
+ @Override
+ public void setIconVisibility(String slot, boolean visible) throws RemoteException {
+ enforcePermission();
+ mManager.setIconVisibility(slot, visible);
+ }
+
+ @Override
+ public int getDisableFlags() throws RemoteException {
+ enforcePermission();
+ return disableFlags;
+ }
+
+ @Override
+ public int getDisable2Flags() throws RemoteException {
+ enforcePermission();
+ return disable2Flags;
+ }
+
+ @Override
+ public List<DisableItem> getAvailableDisableItems() throws RemoteException {
+ Field[] fields = StatusBarManager.class.getDeclaredFields();
+ if (fields.length <= 0) return Collections.emptyList();
+ List<DisableItem> items = new ArrayList<>(fields.length);
+ for (Field field : fields) {
+ if (!Modifier.isStatic(field.getModifiers())) continue;
+ if (!Modifier.isFinal(field.getModifiers())) continue;
+ if (!Modifier.isPublic(field.getModifiers())) continue;
+ if (field.getName().equals("DISABLE_MASK") || field.getName().equals("DISABLE2_MASK")
+ || field.getName().equals("DISABLE_NONE") || field.getName().equals("DISABLE2_NONE")) continue;
+ try {
+ if (field.getName().startsWith("DISABLE_")) {
+ items.add(new DisableItem(field.getInt(null), field.getName(), false));
+ continue;
+ }
+ if (field.getName().startsWith("DISABLE2_")) {
+ items.add(new DisableItem(field.getInt(null), field.getName(), true));
+ }
+ } catch (IllegalAccessException e) {
+ Log.e(TAG, "Unable to access value: " + field.getName(), e);
+ }
+ }
+ return items;
+ }
+
+ @Override
+ public int getDisableNoneFlag(boolean disable2) throws RemoteException {
+ return disable2 ? StatusBarManager.DISABLE2_NONE : StatusBarManager.DISABLE_NONE;
+ }
+}
diff --git a/app/src/main/java/moe/yuuta/sysuicontroller/core/DisableItem.java b/app/src/main/java/moe/yuuta/sysuicontroller/core/DisableItem.java
new file mode 100644
index 0000000..efb5699
--- /dev/null
+++ b/app/src/main/java/moe/yuuta/sysuicontroller/core/DisableItem.java
@@ -0,0 +1,82 @@
+package moe.yuuta.sysuicontroller.core;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class DisableItem implements Parcelable {
+ private int flag;
+ private String key;
+ private boolean disable2;
+
+ public DisableItem() {
+ }
+
+ public DisableItem(int flag, String key, boolean disable2) {
+ this.flag = flag;
+ this.key = key;
+ this.disable2 = disable2;
+ }
+
+ protected DisableItem(Parcel in) {
+ flag = in.readInt();
+ key = in.readString();
+ disable2 = in.readByte() != 0;
+ }
+
+ public static final Creator<DisableItem> CREATOR = new Creator<DisableItem>() {
+ @Override
+ public DisableItem createFromParcel(Parcel in) {
+ return new DisableItem(in);
+ }
+
+ @Override
+ public DisableItem[] newArray(int size) {
+ return new DisableItem[size];
+ }
+ };
+
+ public int getFlag() {
+ return flag;
+ }
+
+ public void setFlag(int flag) {
+ this.flag = flag;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public boolean isDisable2() {
+ return disable2;
+ }
+
+ public void setDisable2(boolean disable2) {
+ this.disable2 = disable2;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(flag);
+ dest.writeString(key);
+ dest.writeByte((byte) (disable2 ? 1 : 0));
+ }
+
+ @Override
+ public String toString() {
+ return "DisableItem{" +
+ "flag=" + flag +
+ ", key='" + key + '\'' +
+ ", disable2=" + disable2 +
+ '}';
+ }
+}
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..1f6bb29
--- /dev/null
+++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <path
+ android:fillType="evenOdd"
+ android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
+ android:strokeWidth="1"
+ android:strokeColor="#00000000">
+ <aapt:attr name="android:fillColor">
+ <gradient
+ android:endX="78.5885"
+ android:endY="90.9159"
+ android:startX="48.7653"
+ android:startY="61.0927"
+ android:type="linear">
+ <item
+ android:color="#44000000"
+ android:offset="0.0" />
+ <item
+ android:color="#00000000"
+ android:offset="1.0" />
+ </gradient>
+ </aapt:attr>
+ </path>
+ <path
+ android:fillColor="#FFFFFF"
+ android:fillType="nonZero"
+ android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
+ android:strokeWidth="1"
+ android:strokeColor="#00000000" />
+</vector>
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..0d025f9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <path
+ android:fillColor="#008577"
+ android:pathData="M0,0h108v108h-108z" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M9,0L9,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,0L19,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M29,0L29,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M39,0L39,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M49,0L49,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M59,0L59,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M69,0L69,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M79,0L79,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M89,0L89,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M99,0L99,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,9L108,9"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,19L108,19"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,29L108,29"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,39L108,39"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,49L108,49"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,59L108,59"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,69L108,69"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,79L108,79"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,89L108,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,99L108,99"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,29L89,29"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,39L89,39"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,49L89,49"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,59L89,59"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,69L89,69"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,79L89,79"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M29,19L29,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M39,19L39,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M49,19L49,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M59,19L59,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M69,19L69,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M79,19L79,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+</vector>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..9c63a9a
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MainActivity">
+
+ <fragment
+ android:id="@+id/nav_host"
+ class="androidx.navigation.fragment.NavHostFragment"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:navGraph="@navigation/main_nav"
+ app:defaultNavHost="true"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml
new file mode 100644
index 0000000..c9bbff0
--- /dev/null
+++ b/app/src/main/res/layout/fragment_about.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="24dp">
+
+ <ImageView
+ android:id="@+id/image_icon"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:src="@mipmap/ic_launcher"
+ android:contentDescription="@string/app_name"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/text_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="24dp"
+ android:text="@string/app_name"
+ android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
+ app:layout_constraintStart_toEndOf="@+id/image_icon"
+ app:layout_constraintTop_toTopOf="@+id/image_icon" />
+
+ <TextView
+ android:id="@+id/text_version"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ app:layout_constraintStart_toStartOf="@+id/text_name"
+ app:layout_constraintTop_toBottomOf="@+id/text_name" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="19dp"
+ android:layout_marginTop="24dp"
+ android:text="@string/about_copyright"
+ android:textAppearance="@style/TextAppearance.AppCompat.Tooltip"
+ app:layout_constraintStart_toStartOf="@+id/text_version"
+ app:layout_constraintTop_toBottomOf="@+id/text_version" />
+</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@drawable/ic_launcher_background" />
+ <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon> \ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@drawable/ic_launcher_background" />
+ <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon> \ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..898f3ed
--- /dev/null
+++ b/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..dffca36
--- /dev/null
+++ b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary files differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..64ba76f
--- /dev/null
+++ b/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..dae5e08
--- /dev/null
+++ b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..e5ed465
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..14ed0af
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..b0907ca
--- /dev/null
+++ b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..d8ae031
--- /dev/null
+++ b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..2c18de9
--- /dev/null
+++ b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..beed3cd
--- /dev/null
+++ b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/app/src/main/res/navigation/main_nav.xml b/app/src/main/res/navigation/main_nav.xml
new file mode 100644
index 0000000..dd1fb9e
--- /dev/null
+++ b/app/src/main/res/navigation/main_nav.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<navigation xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_nav"
+ app:startDestination="@id/mainFragment">
+
+ <fragment
+ android:id="@+id/mainFragment"
+ android:name="moe.yuuta.sysuicontroller.MainFragment"
+ android:label="MainFragment" />
+</navigation> \ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..69b2233
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#008577</color>
+ <color name="colorPrimaryDark">#00574B</color>
+ <color name="colorAccent">#D81B60</color>
+</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..5f354ad
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,42 @@
+<resources>
+ <string name="app_name">SysUIController</string>
+ <string name="app_title">System UI Control α</string>
+ <string name="main_service_status">Service Status</string>
+ <string name="main_service_status_summary">Service must be started to apply your settings, tap to check or start (ROOT)</string>
+ <string name="status_starting">Starting</string>
+ <string name="status_stopping">Stopping</string>
+ <string name="status_started">Running, tap to stop</string>
+
+ <string name="about_title">Version info</string>
+ <string name="about_view_in_play_store">View in Google Play Store</string>
+ <string name="about_version">Version %1$s</string>
+ <string name="about_copyright">Author yuuta.moe</string>
+
+ <string name="error_can_not_open_shell">Can not have ROOT access</string>
+ <string name="error_can_not_start">Can not start service, please read system logs (tag "SysUIController") and feedback</string>
+
+ <string name="additional_key">Additional support item by your device</string>
+ <string name="not_available">Your device doesn\'t support this feature</string>
+
+ <string name="main_status_bar">Status Bar</string>
+ <string name="disable_expand">Disable expanding</string>
+ <string name="disable_system_info">Hide system icons</string>
+ <string name="disable_clock">Hide clock icon</string>
+ <string name="main_notification">Notifications</string>
+ <string name="disable_notification_icons">Hide notification icons</string>
+ <string name="disable_notification_alerts">Disable notification alerts and floating</string>
+ <string name="disable_notification_ticker">Hide notification tickers</string>
+ <string name="main_navigation_bar">Navigation Bar</string>
+ <string name="disable_navigation">Hide navigation bar buttons</string>
+ <string name="disable_home">Hide home button</string>
+ <string name="disable_recent">Hide recent button</string>
+ <string name="disable_back">Hide back button</string>
+ <string name="disable_search">Disable searching (e.g. Assistant)</string>
+ <string name="main_quick_settings">Quick Settings</string>
+ <string name="disable_quick_settings">Remove quick settings</string>
+ <string name="disable_system_icons">Hide system icons (method 2)</string>
+ <string name="disable_notification_shade">Disable notification shade</string>
+ <string name="main_other">Others</string>
+ <string name="disable_global_actions">Disable global actions (e.g. Power menu)</string>
+ <string name="disable_rotate_suggestions">Hide rotate icon</string>
+</resources>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..2e85abf
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,15 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="colorAccent">@color/colorAccent</item>
+ <item name="preferenceTheme">@style/AppTheme.PreferenceTheme</item>
+ </style>
+
+ <style name="AppTheme.PreferenceTheme" parent="PreferenceThemeOverlay">
+ <item name="simpleMenuPreferenceStyle">@style/Preference.SimpleMenuPreference</item>
+ </style>
+</resources>
diff --git a/app/src/main/res/xml/main_settings.xml b/app/src/main/res/xml/main_settings.xml
new file mode 100644
index 0000000..ee10a9d
--- /dev/null
+++ b/app/src/main/res/xml/main_settings.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ <Preference
+ android:key="key_service_status"
+ android:title="@string/main_service_status"
+ android:summary="@string/main_service_status_summary" />
+
+ <PreferenceCategory
+ android:key="key_status_bar"
+ android:title="@string/main_status_bar"
+ android:enabled="false">
+ <SwitchPreference
+ android:key="disable_expand"
+ android:title="@string/disable_expand"/>
+ <SwitchPreference
+ android:key="disable_system_info"
+ android:title="@string/disable_system_info"/>
+ <SwitchPreference
+ android:key="disable2_system_icons"
+ android:title="@string/disable_system_icons"/>
+ <SwitchPreference
+ android:key="disable_clock"
+ android:title="@string/disable_clock"/>
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="key_notification"
+ android:title="@string/main_notification"
+ android:enabled="false">
+ <SwitchPreference
+ android:key="disable_notification_icons"
+ android:title="@string/disable_notification_icons"/>
+ <SwitchPreference
+ android:key="disable_notification_alerts"
+ android:title="@string/disable_notification_alerts"/>
+ <SwitchPreference
+ android:key="disable_notification_ticker"
+ android:title="@string/disable_notification_ticker"/>
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:key="key_navigation_bar"
+ android:title="@string/main_navigation_bar"
+ android:enabled="false">
+ <SwitchPreference
+ android:key="disable_navigation"
+ android:title="@string/disable_navigation"/>
+ <SwitchPreference
+ android:key="disable_home"
+ android:title="@string/disable_home"/>
+ <SwitchPreference
+ android:key="disable_recent"
+ android:title="@string/disable_recent"/>
+ <SwitchPreference
+ android:key="disable_back"
+ android:title="@string/disable_back"/>
+ <SwitchPreference
+ android:key="disable_search"
+ android:title="@string/disable_search"/>
+ <SwitchPreference
+ android:key="disable2_rotate_suggestions"
+ android:title="@string/disable_rotate_suggestions"/>
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="key_quick_settings"
+ android:title="@string/main_quick_settings"
+ android:enabled="false">
+ <SwitchPreference
+ android:key="disable2_quick_settings"
+ android:title="@string/disable_quick_settings"/>
+ <SwitchPreference
+ android:key="disable2_notification_shade"
+ android:title="@string/disable_notification_shade"/>
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="key_other"
+ android:title="@string/main_other"
+ android:enabled="false">
+ <SwitchPreference
+ android:key="disable2_global_actions"
+ android:title="@string/disable_global_actions"/>
+ </PreferenceCategory>
+</PreferenceScreen> \ No newline at end of file
diff --git a/app/src/test/java/moe/yuuta/sysuicontroller/ExampleUnitTest.java b/app/src/test/java/moe/yuuta/sysuicontroller/ExampleUnitTest.java
new file mode 100644
index 0000000..043c5b0
--- /dev/null
+++ b/app/src/test/java/moe/yuuta/sysuicontroller/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package moe.yuuta.sysuicontroller;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() {
+ assertEquals(4, 2 + 2);
+ }
+} \ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..5692885
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,32 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ maven {
+ url 'https://maven.fabric.io/public'
+ }
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.3.0-beta04'
+ classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha07"
+ classpath 'com.google.gms:google-services:4.2.0'
+ classpath 'io.fabric.tools:gradle:1.26.1'
+ classpath 'com.google.android.gms:oss-licenses-plugin:0.9.4'
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..199d16e
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,20 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..2997151
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Sat Nov 24 11:47:09 PST 2018
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..e95643d
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/hiddenapi/.gitignore b/hiddenapi/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/hiddenapi/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/hiddenapi/build.gradle b/hiddenapi/build.gradle
new file mode 100644
index 0000000..82292e2
--- /dev/null
+++ b/hiddenapi/build.gradle
@@ -0,0 +1,8 @@
+apply plugin: 'java-library'
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+}
+
+sourceCompatibility = "8"
+targetCompatibility = "8"
diff --git a/hiddenapi/src/main/java/android/app/StatusBarManager.java b/hiddenapi/src/main/java/android/app/StatusBarManager.java
new file mode 100644
index 0000000..b915dbe
--- /dev/null
+++ b/hiddenapi/src/main/java/android/app/StatusBarManager.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2007 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 android.app;
+
+/**
+ * Allows an app to control the status bar.
+ *
+ * @hide
+ */
+public class StatusBarManager {
+
+ public static int DISABLE_EXPAND;
+ public static int DISABLE_NOTIFICATION_ICONS;
+ public static int DISABLE_NOTIFICATION_ALERTS;
+ @Deprecated
+ public static int DISABLE_NOTIFICATION_TICKER;
+ public static int DISABLE_SYSTEM_INFO;
+ public static int DISABLE_HOME;
+ public static int DISABLE_RECENT;
+ public static int DISABLE_BACK;
+ public static int DISABLE_CLOCK;
+ public static int DISABLE_SEARCH;
+
+ @Deprecated
+ public static int DISABLE_NAVIGATION;
+
+ public static int DISABLE_NONE = 0x00000000;
+
+ public static int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS
+ | DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
+ | DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK
+ | DISABLE_SEARCH;
+
+ /**
+ * Flag to disable quick settings.
+ *
+ * Setting this flag disables quick settings completely, but does not disable expanding the
+ * notification shade.
+ */
+ public static int DISABLE2_QUICK_SETTINGS = 1;
+ public static int DISABLE2_SYSTEM_ICONS = 1 << 1;
+ public static int DISABLE2_NOTIFICATION_SHADE = 1 << 2;
+ public static int DISABLE2_GLOBAL_ACTIONS = 1 << 3;
+ public static int DISABLE2_ROTATE_SUGGESTIONS = 1 << 4;
+
+ public static int DISABLE2_NONE = 0x00000000;
+
+ public static int DISABLE2_MASK = DISABLE2_QUICK_SETTINGS | DISABLE2_SYSTEM_ICONS
+ | DISABLE2_NOTIFICATION_SHADE | DISABLE2_GLOBAL_ACTIONS | DISABLE2_ROTATE_SUGGESTIONS;
+
+ public static int NAVIGATION_HINT_BACK_ALT;
+ public static int NAVIGATION_HINT_IME_SHOWN;
+
+ public static int WINDOW_STATUS_BAR;
+ public static int WINDOW_NAVIGATION_BAR;
+
+ public static int WINDOW_STATE_SHOWING;
+ public static int WINDOW_STATE_HIDING;
+ public static int WINDOW_STATE_HIDDEN;
+
+ public static int CAMERA_LAUNCH_SOURCE_WIGGLE;
+ public static int CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP;
+ public static int CAMERA_LAUNCH_SOURCE_LIFT_TRIGGER;
+
+ /**
+ * Disable some features in the status bar. Pass the bitwise-or of the DISABLE_* flags.
+ * To re-enable everything, pass {@link #DISABLE_NONE}.
+ */
+ public void disable(int what) {
+ throw new RuntimeException("Stub!");
+ }
+
+ /**
+ * Disable additional status bar features. Pass the bitwise-or of the DISABLE2_* flags.
+ * To re-enable everything, pass {@link #DISABLE_NONE}.
+ *
+ * Warning: Only pass DISABLE2_* flags into this function, do not use DISABLE_* flags.
+ */
+ public void disable2(int what) {
+ throw new RuntimeException("Stub!");
+ }
+
+ /**
+ * Expand the notifications panel.
+ */
+ public void expandNotificationsPanel() {
+ throw new RuntimeException("Stub!");
+ }
+
+ /**
+ * Collapse the notifications and settings panels.
+ */
+ public void collapsePanels() {
+ throw new RuntimeException("Stub!");
+ }
+
+ /**
+ * Expand the settings panel.
+ */
+ public void expandSettingsPanel() {
+ expandSettingsPanel(null);
+ }
+
+ /**
+ * Expand the settings panel and open a subPanel, pass null to just open the settings panel.
+ */
+ public void expandSettingsPanel(String subPanel) {
+ throw new RuntimeException("Stub!");
+ }
+
+ public void setIcon(String slot, int iconId, int iconLevel, String contentDescription) {
+ throw new RuntimeException("Stub!");
+ }
+
+ public void removeIcon(String slot) {
+ throw new RuntimeException("Stub!");
+ }
+
+ public void setIconVisibility(String slot, boolean visible) {
+ throw new RuntimeException("Stub!");
+ }
+
+ /** @hide */
+ public static String windowStateToString(int state) {
+ throw new RuntimeException("Stub!");
+ }
+}
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..9fee630
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app', ':hiddenapi'