diff --git a/README.md b/README.md index d05d674..75d267b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,32 @@ +# XposedDex One UI 2.5 +Samsung Dex modifications through Xposed + +1. Make Apps Immersive, +Will remove window titlebar for maximized applications. + +2. Hide NoSIM Icon, +Removes the NoSIM icon from statusbar. + +3. Fix Samsung Browser, +Enables secret mode (as it's disabled if Magisk installed) and disable always visible scroll bar (looks ugly under dark mode). + +4. Hide Tasks Button, +Remove the tasks button on the taskbar. + +5. Hide Taskbar Separators, +Removes empty gaps (separators) from taskbar. + +6. Taskbar Fixes, +Add small space above app docks running marker. + +7. Hide Battery Percentage, +Removes the battery percentage from statusbar. + +NOTE: All changes require a restart. + +IMPORTANT: Requires Magisk and edXposed installed on your tablet. +Only tested with One UI 2.5, Android 10, Build T865XXU4BTI1 so latest release for Tab S6 + # XposedDex One UI 2.1 Samsung Dex modifications through Xposed diff --git a/bin/com.pijulius.xposeddex.apk b/bin/com.pijulius.xposeddex.apk index bfce233..dfed0ae 100644 Binary files a/bin/com.pijulius.xposeddex.apk and b/bin/com.pijulius.xposeddex.apk differ diff --git a/res/values/strings.xml b/res/values/strings.xml index a748312..c173c89 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5,27 +5,21 @@ Xposed Samsung Dex Samsung Dex - Immersive Apps - Apps for which to remove window titlebar when maximized. - Fix Keyboard - Enables floating mode for non qwerty keyboard layouts too. + Make Apps Immersive + Will remove window titlebar for maximized applications. Fix Samsung Browser Enables secret mode and disable always visible scroll bar. - Fix Weather - Keep displaying weather icon in the statusbar. Dex Taskbar - Fix Taskbar - Disable setting black backgrounds for statusbar and taskbar buttons on maximized applications. - Hide Dex Logo - Removes the Dex logo from the taskbar. + Taskbar Fixes + Add small space above app docks running marker. Hide Tasks Button Removes the Tasks button from the taskbar. Hide NoSIM Icon Removes the NoSIM icon from statusbar. - Hide StatusBar Separators - Removes empty gaps from statusbar to make it more compact. - Hide App Overflow Buttons - Removes left and right arrows when to many apps are open. + Hide Battery Percentage + Removes the battery percentage from statusbar. + Hide Taskbar Separators + Removes empty gaps (separators) from taskbar. \ No newline at end of file diff --git a/res/xml/settings.xml b/res/xml/settings.xml index b5d3384..6d48538 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -5,19 +5,12 @@ - - + android:title="@string/settings_make_apps_immersive" + android:key="makeAppsImmersive" /> - - - - + android:title="@string/settings_hide_battery_percentage" + android:key="hideBatteryPercentage" /> + android:name="@string/settings_hide_taskbar_separators" + android:summary="@string/settings_hide_taskbar_separators_sum" + android:defaultValue="true" + android:title="@string/settings_hide_taskbar_separators" + android:key="hideTaskbarSeparators" /> diff --git a/src/com/pijulius/xposeddex/SettingsActivity.java b/src/com/pijulius/xposeddex/SettingsActivity.java index c8f0924..0df5d6f 100644 --- a/src/com/pijulius/xposeddex/SettingsActivity.java +++ b/src/com/pijulius/xposeddex/SettingsActivity.java @@ -1,18 +1,13 @@ package com.pijulius.xposeddex; import java.io.File; -import java.util.HashSet; -import java.util.List; import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; -import android.content.pm.ResolveInfo; import android.os.AsyncTask; import android.os.Bundle; -import android.preference.MultiSelectListPreference; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; @@ -41,33 +36,6 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); - - MultiSelectListPreference immersiveApps = - (MultiSelectListPreference) findPreference("immersiveApps"); - - Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); - mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); - - List pkgAppsList = - getActivity().getPackageManager().queryIntentActivities(mainIntent, 0); - - String[] allApps = new String[pkgAppsList.size()]; - String[] allPackages = new String[pkgAppsList.size()]; - - int i = 0; - for (ResolveInfo ri : pkgAppsList) { - if (ri.activityInfo == null) - continue; - - allApps[i] = ri.activityInfo.loadLabel( - getActivity().getPackageManager()).toString(); - allPackages[i] = ri.activityInfo.packageName; - - i++; - } - - immersiveApps.setEntries(allApps); - immersiveApps.setEntryValues(allPackages); } } @@ -75,11 +43,7 @@ public void onCreate(Bundle savedInstanceState) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Editor editor = protectedPreferences.edit(); - if ("immersiveApps".equals(key)) - editor.putStringSet(key, sharedPreferences.getStringSet(key, new HashSet())); - else - editor.putBoolean(key, sharedPreferences.getBoolean(key, true)); - + editor.putBoolean(key, sharedPreferences.getBoolean(key, true)); editor.apply(); AsyncTask.execute(new Runnable() { diff --git a/src/com/pijulius/xposeddex/XposedDex.java b/src/com/pijulius/xposeddex/XposedDex.java index eaf05f8..efdda53 100644 --- a/src/com/pijulius/xposeddex/XposedDex.java +++ b/src/com/pijulius/xposeddex/XposedDex.java @@ -3,15 +3,7 @@ import static de.robv.android.xposed.XposedHelpers.findClass; import java.io.File; -import java.util.HashSet; -import java.util.Set; - -import android.app.Activity; -import android.content.res.Configuration; -import android.content.res.XResources; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; + import android.view.View; import android.view.ViewGroup.MarginLayoutParams; import de.robv.android.xposed.IXposedHookInitPackageResources; @@ -42,19 +34,11 @@ public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable { if (settings == null) settings = new XSharedPreferences(new File(settingsFile)); - immersiveApps(lpparam); - - if (settings.getBoolean("fixTaskbar", true)) - taskbarFixes(lpparam); - - if (settings.getBoolean("fixKeyboard", true)) - keyboardFixes(lpparam); + if (settings.getBoolean("makeAppsImmersive", true)) + makeAppsImmersive(lpparam); if (settings.getBoolean("fixSBrowser", true)) sbrowserFixes(lpparam); - - if (settings.getBoolean("fixWeather", true)) - weatherFixes(lpparam); } @Override @@ -63,72 +47,16 @@ public void handleInitPackageResources(InitPackageResourcesParam resparam) throw settings = new XSharedPreferences(new File(settingsFile)); taskbarResourceFixes(resparam); - - if (settings.getBoolean("fixKeyboard", true)) - keyboardResourceFixes(resparam); - } - - public void immersiveApps(LoadPackageParam lpparam) { - // Make selected apps to be in immersive mode - XposedBridge.hookAllMethods(Activity.class, "onStart", new XC_MethodHook() { - @Override - protected void afterHookedMethod(MethodHookParam param) throws Throwable { - Activity activity = (Activity)param.thisObject; - if (activity == null) - return; - - settings.reload(); - - Set immersiveApps = settings.getStringSet("immersiveApps", new HashSet()); - - if (!immersiveApps.contains(activity.getPackageName())) - return; - - activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); - } - }); - - XposedBridge.hookAllMethods(Activity.class, "onWindowFocusChanged", new XC_MethodHook() { - @Override - protected void afterHookedMethod(MethodHookParam param) throws Throwable { - Activity activity = (Activity)param.thisObject; - if (activity == null) - return; - - Set immersiveApps = settings.getStringSet("immersiveApps", new HashSet()); - - if (!immersiveApps.contains(activity.getPackageName())) - return; - - activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); - } - }); } - public void taskbarFixes(LoadPackageParam lpparam) { - // Taskbar fixes, disable setting the black backgrounds when an app is maximized - if (!lpparam.packageName.equals("com.samsung.desktopsystemui")) - return; - - Class hookClass = null; - - hookClass = findClass("com.samsung.desktopsystemui.statusbar.phone.taskbar.views.TaskBarView", - lpparam.classLoader); - - XposedBridge.hookAllMethods(hookClass, "setDarkBackground", new XC_MethodHook() { - @Override - protected void beforeHookedMethod(MethodHookParam param) throws Throwable { - param.setResult(false); - } - }); - - hookClass = findClass("com.samsung.desktopsystemui.statusbar.phone.taskbar.desk.DeskStatusBarView", + public void makeAppsImmersive(LoadPackageParam lpparam) { + Class hookClass = findClass("com.android.internal.policy.MultiWindowDecorSupport", lpparam.classLoader); - XposedBridge.hookAllMethods(hookClass, "setDarkBackground", new XC_MethodHook() { + XposedBridge.hookAllMethods(hookClass, "isImmersiveMode", new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { - param.setResult(false); + param.setResult(true); } }); } @@ -137,35 +65,16 @@ public void taskbarResourceFixes(InitPackageResourcesParam resparam) { if (!resparam.packageName.equals("com.samsung.desktopsystemui")) return; - final boolean hideDexLogo = settings.getBoolean("hideDexLogo", true); final boolean hideTasksButton = settings.getBoolean("hideTasksButton", true); - final boolean hideAppOverflowButtons = settings.getBoolean("hideAppOverflowButtons", true); - final boolean hideStatusBarSeparators = settings.getBoolean("hideStatusBarSeparators", true); + final boolean hideTaskbarSeparators = settings.getBoolean("hideTaskbarSeparators", true); + final boolean spaceAboveAppDock = settings.getBoolean("fixTaskbar", true); - if (hideDexLogo || hideTasksButton || hideAppOverflowButtons || hideStatusBarSeparators) { + if (hideTasksButton || hideTaskbarSeparators || spaceAboveAppDock) { resparam.res.hookLayout("com.samsung.desktopsystemui", "layout", "taskbar", new XC_LayoutInflated() { @Override public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) throws Throwable { View view = null; - if (hideDexLogo) { - view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "dex_community", "id", "com.samsung.desktopsystemui")); - - view.setVisibility(View.GONE); - view.getLayoutParams().width = 0; - - view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "dex_community_divider", "id", "com.samsung.desktopsystemui")); - - view.setVisibility(View.GONE); - view.getLayoutParams().width = 0; - - MarginLayoutParams marginParams = (MarginLayoutParams)view.getLayoutParams(); - marginParams.setMarginStart(0); - marginParams.setMarginEnd(0); - } - if (hideTasksButton) { view = (View)liparam.view.findViewById(liparam.res.getIdentifier( "recent_apps", "id", "com.samsung.desktopsystemui")); @@ -178,35 +87,18 @@ public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) marginParams.setMarginEnd(0); } - if (hideAppOverflowButtons) { - view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "button_scroll_left", "id", "com.samsung.desktopsystemui")); - - view.setVisibility(View.GONE); - view.getLayoutParams().width = 0; - + if (hideTaskbarSeparators) { view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "button_scroll_right", "id", "com.samsung.desktopsystemui")); + "all_apps_divider", "id", "com.samsung.desktopsystemui")); view.setVisibility(View.GONE); view.getLayoutParams().width = 0; - } - - if (hideStatusBarSeparators) { - view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "size_control", "id", "com.samsung.desktopsystemui")); + view.setPadding(0, 0, 0, 0); MarginLayoutParams marginParams = (MarginLayoutParams)view.getLayoutParams(); marginParams.setMarginStart(0); marginParams.setMarginEnd(0); - view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "desk_status_bar_container", "id", "com.samsung.desktopsystemui")); - - marginParams = (MarginLayoutParams)view.getLayoutParams(); - marginParams.setMarginStart(0); - marginParams.setMarginEnd(0); - view = (View)liparam.view.findViewById(liparam.res.getIdentifier( "taskbar_divider", "id", "com.samsung.desktopsystemui")); @@ -217,67 +109,20 @@ public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) marginParams = (MarginLayoutParams)view.getLayoutParams(); marginParams.setMarginStart(0); marginParams.setMarginEnd(0); + } + if (spaceAboveAppDock) { view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "global_function", "id", "com.samsung.desktopsystemui")); + "appdock_container", "id", "com.samsung.desktopsystemui")); - view.setPadding(0, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); + view.setPadding(0, 4, 0, 0); } } }); - - if (hideStatusBarSeparators) { - resparam.res.hookLayout("com.samsung.desktopsystemui", "layout", "desk_status_bar", new XC_LayoutInflated() { - @Override - public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) throws Throwable { - View view = null; - - view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "notification_icon_area", "id", "com.samsung.desktopsystemui")); - - view.setPadding(0, view.getPaddingTop(), 0, view.getPaddingBottom()); - - MarginLayoutParams marginParams = (MarginLayoutParams)view.getLayoutParams(); - marginParams.setMarginStart(0); - marginParams.setMarginEnd(0); - - view = (View)liparam.view.findViewById(liparam.res.getIdentifier( - "system_icon_area_outer", "id", "com.samsung.desktopsystemui")); - - view.setPadding(0, view.getPaddingTop(), 0, view.getPaddingBottom()); - } - }); - - resparam.res.setReplacement( - "com.samsung.desktopsystemui", "drawable", "desk_panel_view_bg", new XResources.DrawableLoader() { - @Override - public Drawable newDrawable(XResources res, int id) throws Throwable { - return new ColorDrawable(Color.TRANSPARENT); - } - }); - - resparam.res.setReplacement( - "com.samsung.desktopsystemui", "drawable", "quick_connect_hidden_icon", new XResources.DrawableLoader() { - @SuppressWarnings("deprecation") - @Override - public Drawable newDrawable(XResources res, int id) throws Throwable { - return res.getDrawable(android.R.drawable.arrow_up_float); - } - }); - - resparam.res.setReplacement( - "com.samsung.desktopsystemui", "drawable", "stat_notify_more_for_desk", new XResources.DrawableLoader() { - @SuppressWarnings("deprecation") - @Override - public Drawable newDrawable(XResources res, int id) throws Throwable { - return res.getDrawable(android.R.drawable.arrow_up_float); - } - }); - } } if (settings.getBoolean("hideNoSIMIcon", true)) { - resparam.res.hookLayout("com.samsung.desktopsystemui", "layout", "desk_signal_cluster_view", new XC_LayoutInflated() { + resparam.res.hookLayout("com.samsung.desktopsystemui", "layout", "desk_signal_cluster_view_25", new XC_LayoutInflated() { @Override public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) throws Throwable { View view = null; @@ -302,43 +147,34 @@ public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) } }); } - } - - public void keyboardFixes(LoadPackageParam lpparam) { - // Fix floating keyboard for none qwery layouts too - if (!lpparam.packageName.equals("com.samsung.android.honeyboard")) - return; - Class hookClass = null; - - // context, keyboardtype/ , com/samsung/android/honeyboard/base/i/b/a;->i()Z, - // if-eqz, const-string "KeyboardViewType.VIEW_FLOATING" - // else, const-string "KeyboardViewType.VIEW_NORMAL" - hookClass = findClass("com.samsung.android.honeyboard.base.i.b.a", - lpparam.classLoader); + if (settings.getBoolean("hideBatteryPercentage", true)) { + resparam.res.hookLayout("com.samsung.desktopsystemui", "layout", "battery_percentage_view", new XC_LayoutInflated() { + @Override + public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) throws Throwable { + View view = null; - XposedBridge.hookAllMethods(hookClass, "i", new XC_MethodHook() { - @Override - protected void afterHookedMethod(MethodHookParam param) throws Throwable { - param.setResult(true); - } - }); - } + view = (View)liparam.view.findViewById(liparam.res.getIdentifier( + "battery_percentage_view", "id", "com.samsung.desktopsystemui")); - public void keyboardResourceFixes(InitPackageResourcesParam resparam) { - if (!resparam.packageName.equals("com.samsung.android.honeyboard")) - return; + view.setVisibility(View.GONE); + } + }); - resparam.res.setReplacement( - "com.samsung.android.honeyboard", "drawable", "desktop_decor_caption_title", new XResources.DrawableLoader() { + resparam.res.hookLayout("com.samsung.desktopsystemui", "layout", "desk_system_icons", new XC_LayoutInflated() { @Override - public Drawable newDrawable(XResources res, int id) throws Throwable { - if ((res.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES) - return new ColorDrawable(Color.BLACK); + public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam) throws Throwable { + View view = null; + + view = (View)liparam.view.findViewById(liparam.res.getIdentifier( + "system_icons_battery_container", "id", "com.samsung.desktopsystemui")); - return new ColorDrawable(Color.LTGRAY); + MarginLayoutParams marginParams = (MarginLayoutParams)view.getLayoutParams(); + marginParams.setMarginStart(10); + marginParams.setMarginEnd(10); } }); + } } public void sbrowserFixes(LoadPackageParam lpparam) { @@ -368,34 +204,4 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { } }); } - - public void weatherFixes(LoadPackageParam lpparam) { - // Enable weather statusbar notification in Dex - if (!lpparam.packageName.equals("com.sec.android.daemonapp")) - return; - - Class hookClass = null; - - hookClass = findClass("com.sec.android.daemonapp.app.notification.NotificationUtil", - lpparam.classLoader); - - XposedBridge.hookAllMethods(hookClass, "isDesktopMode", new XC_MethodHook() { - @Override - protected void afterHookedMethod(MethodHookParam param) throws Throwable { - param.setResult(false); - } - }); - - //hookClass = findClass("com.samsung.android.weather.infrastructure.system.android.DesktopModeManager", - //hookClass = findClass("com.samsung.android.weather.infrastructure.system.sdl.DesktopModeManager", - hookClass = findClass("com.samsung.android.weather.infrastructure.system.sep.DesktopModeManager", - lpparam.classLoader); - - XposedBridge.hookAllMethods(hookClass, "isDesktopMode", new XC_MethodHook() { - @Override - protected void afterHookedMethod(MethodHookParam param) throws Throwable { - param.setResult(false); - } - }); - } }