From: LuK1337 Date: Thu, 16 Feb 2017 16:08:53 +0000 (+0100) Subject: Update for topic:rootless X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c00f212d51e97bdf99508cb7cf2c8ea1283e0542;p=GitHub%2FStricted%2Fandroid_vendor_extra.git Update for topic:rootless --- diff --git a/patch.sh b/patch.sh index 66fa8d4..9752206 100755 --- a/patch.sh +++ b/patch.sh @@ -5,10 +5,13 @@ REPOSITORIES=( 'packages/apps/Settings' 'packages/apps/ExactCalculator' 'packages/apps/PhoneCommon' + 'packages/apps/masquerade' 'build' + 'system/core' 'system/sepolicy' 'frameworks/native' 'frameworks/base' + 'vendor/cm' ) for repository in "${REPOSITORIES[@]}"; do diff --git a/patches/frameworks/base/0001-OMS7-N-Support-tagging-resources-as-OK-to-overlay-1-.patch b/patches/frameworks/base/0001-OMS7-N-Support-tagging-resources-as-OK-to-overlay-1-.patch index 49866ce..51d4813 100644 --- a/patches/frameworks/base/0001-OMS7-N-Support-tagging-resources-as-OK-to-overlay-1-.patch +++ b/patches/frameworks/base/0001-OMS7-N-Support-tagging-resources-as-OK-to-overlay-1-.patch @@ -1,7 +1,7 @@ -From b43513fd7b0692aa757e1e6b1d299ffe1875dcdd Mon Sep 17 00:00:00 2001 +From 8dc3129826885706e51627f70113794e3f040ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Tue, 15 Dec 2015 16:08:31 +0100 -Subject: [PATCH 01/38] OMS7-N: Support tagging resources as OK to overlay +Subject: [PATCH 01/39] OMS7-N: Support tagging resources as OK to overlay [1/11] This will allow applications to have a resource xml defining what diff --git a/patches/frameworks/base/0002-OMS7-N-Introduce-the-OverlayManagerService-2-11.patch b/patches/frameworks/base/0002-OMS7-N-Introduce-the-OverlayManagerService-2-11.patch index 8a1e4da..4331788 100644 --- a/patches/frameworks/base/0002-OMS7-N-Introduce-the-OverlayManagerService-2-11.patch +++ b/patches/frameworks/base/0002-OMS7-N-Introduce-the-OverlayManagerService-2-11.patch @@ -1,7 +1,7 @@ -From 37fcdce6e621c21cdf1010ca600b7722d5a1bc5a Mon Sep 17 00:00:00 2001 +From c8f9bc6207c9db6805446f41661fdd9345a6d924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Tue, 15 Dec 2015 16:40:23 +0100 -Subject: [PATCH 02/38] OMS7-N: Introduce the OverlayManagerService [2/11] +Subject: [PATCH 02/39] OMS7-N: Introduce the OverlayManagerService [2/11] Add a new system service to manage Runtime Resource Overlays. This will offload the PackageManagerService and allow administration of overlay diff --git a/patches/frameworks/base/0003-OMS7-N-Integrate-OverlayManagerService-into-framewor.patch b/patches/frameworks/base/0003-OMS7-N-Integrate-OverlayManagerService-into-framewor.patch index 6d4bb11..cf77499 100644 --- a/patches/frameworks/base/0003-OMS7-N-Integrate-OverlayManagerService-into-framewor.patch +++ b/patches/frameworks/base/0003-OMS7-N-Integrate-OverlayManagerService-into-framewor.patch @@ -1,7 +1,7 @@ -From ca6a779643bb2b80e14318c8866f6f4970f70a0a Mon Sep 17 00:00:00 2001 +From 5d7e6ea290e2c8c080212193511dfe4989020332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Thu, 2 Jun 2016 09:35:31 +0200 -Subject: [PATCH 03/38] OMS7-N: Integrate OverlayManagerService into framework +Subject: [PATCH 03/39] OMS7-N: Integrate OverlayManagerService into framework [3/11] Hand over ownership of overlays to OverlayManagerService. diff --git a/patches/frameworks/base/0004-OMS7-N-Set-EXTRA_REPLACING-correctly-in-ACTION_PACKA.patch b/patches/frameworks/base/0004-OMS7-N-Set-EXTRA_REPLACING-correctly-in-ACTION_PACKA.patch index 9b3130e..37f23d1 100644 --- a/patches/frameworks/base/0004-OMS7-N-Set-EXTRA_REPLACING-correctly-in-ACTION_PACKA.patch +++ b/patches/frameworks/base/0004-OMS7-N-Set-EXTRA_REPLACING-correctly-in-ACTION_PACKA.patch @@ -1,7 +1,7 @@ -From a1d27bf6ba22b9189350bf26df2918ff2ac551c8 Mon Sep 17 00:00:00 2001 +From 982489be050f0b26b0871c1545a608cedbd64497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Mon, 25 Apr 2016 16:29:22 +0200 -Subject: [PATCH 04/38] OMS7-N: Set EXTRA_REPLACING correctly in +Subject: [PATCH 04/39] OMS7-N: Set EXTRA_REPLACING correctly in ACTION_PACKAGE_ADDED [4/11] When broadcasting ACTION_PACKAGE_ADDED the recipients of the Intent are diff --git a/patches/frameworks/base/0005-OMS7-N-idmap-suppress-print-for-padded-resources-5-1.patch b/patches/frameworks/base/0005-OMS7-N-idmap-suppress-print-for-padded-resources-5-1.patch index 096abf5..f1396a4 100644 --- a/patches/frameworks/base/0005-OMS7-N-idmap-suppress-print-for-padded-resources-5-1.patch +++ b/patches/frameworks/base/0005-OMS7-N-idmap-suppress-print-for-padded-resources-5-1.patch @@ -1,7 +1,7 @@ -From d2d59caef4a066b8149b09d0bd4e25ac4e01732e Mon Sep 17 00:00:00 2001 +From f384d2dd985179f638384b8ffad71f791ebff489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Mon, 29 Feb 2016 14:12:35 +0100 -Subject: [PATCH 05/38] OMS7-N: idmap: suppress print for padded resources +Subject: [PATCH 05/39] OMS7-N: idmap: suppress print for padded resources [5/11] Change-Id: I565ccf515068b96927e4317cc9c06543415bb324 diff --git a/patches/frameworks/base/0006-OMS7-N-Fix-memory-leak-during-idmap-creation-6-11.patch b/patches/frameworks/base/0006-OMS7-N-Fix-memory-leak-during-idmap-creation-6-11.patch index 3658556..4dd77bd 100644 --- a/patches/frameworks/base/0006-OMS7-N-Fix-memory-leak-during-idmap-creation-6-11.patch +++ b/patches/frameworks/base/0006-OMS7-N-Fix-memory-leak-during-idmap-creation-6-11.patch @@ -1,7 +1,7 @@ -From a25413bc2f0537766385bbfbfa2ddad6c10b7e3d Mon Sep 17 00:00:00 2001 +From a511e7456e007b4b2783f78e7f3bdcdfc5686157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Thu, 2 Jun 2016 09:34:36 +0200 -Subject: [PATCH 06/38] OMS7-N: Fix memory leak during idmap creation [6/11] +Subject: [PATCH 06/39] OMS7-N: Fix memory leak during idmap creation [6/11] Plug a memory leak in AssetManager::createIdmap. diff --git a/patches/frameworks/base/0007-OMS7-N-installd-add-command-rmidmap-7-11.patch b/patches/frameworks/base/0007-OMS7-N-installd-add-command-rmidmap-7-11.patch index bf3eb28..28dcfb4 100644 --- a/patches/frameworks/base/0007-OMS7-N-installd-add-command-rmidmap-7-11.patch +++ b/patches/frameworks/base/0007-OMS7-N-installd-add-command-rmidmap-7-11.patch @@ -1,7 +1,7 @@ -From e8847e7d2ddacae26e0a571b2c2a2a106a9b4f1f Mon Sep 17 00:00:00 2001 +From 0bf0a38a8adb2c37eb48bfc052d3307cd765943d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Thu, 2 Jun 2016 09:35:09 +0200 -Subject: [PATCH 07/38] OMS7-N: installd: add command 'rmidmap' [7/11] +Subject: [PATCH 07/39] OMS7-N: installd: add command 'rmidmap' [7/11] Add an installd command to remove an idmap file. This is the inverse of the 'idmap' command and is intended for clean-up once an idmap file is diff --git a/patches/frameworks/base/0008-OMS7-N-Disable-Zygote-preloaded-drawables-8-11.patch b/patches/frameworks/base/0008-OMS7-N-Disable-Zygote-preloaded-drawables-8-11.patch index 8444337..98fe8cf 100644 --- a/patches/frameworks/base/0008-OMS7-N-Disable-Zygote-preloaded-drawables-8-11.patch +++ b/patches/frameworks/base/0008-OMS7-N-Disable-Zygote-preloaded-drawables-8-11.patch @@ -1,7 +1,7 @@ -From 961527ef5940fdf23c7c4311981c835b5fd0f699 Mon Sep 17 00:00:00 2001 +From 1efd19a1d85b18a7d3a64d42fd7318bc3c611e1f Mon Sep 17 00:00:00 2001 From: Josh Guilfoyle Date: Wed, 26 Jan 2011 23:28:43 -0800 -Subject: [PATCH 08/38] OMS7-N: Disable Zygote preloaded drawables [8/11] +Subject: [PATCH 08/39] OMS7-N: Disable Zygote preloaded drawables [8/11] With a theme applied, most of these preloaded drawables go unused. Any assets the theme has redirected will need to be loaded with each app diff --git a/patches/frameworks/base/0009-OMS7-N-Persistence-on-boot-through-OverlayManagerSer.patch b/patches/frameworks/base/0009-OMS7-N-Persistence-on-boot-through-OverlayManagerSer.patch index 807cd02..5b86b91 100644 --- a/patches/frameworks/base/0009-OMS7-N-Persistence-on-boot-through-OverlayManagerSer.patch +++ b/patches/frameworks/base/0009-OMS7-N-Persistence-on-boot-through-OverlayManagerSer.patch @@ -1,7 +1,7 @@ -From 881efe212818d0cd62fb90f41f15bd368c7cc58d Mon Sep 17 00:00:00 2001 +From 9c44db7a6126968c051a1fcfeeef7d3604b7b29c Mon Sep 17 00:00:00 2001 From: Nicholas Chum Date: Sun, 19 Jun 2016 10:37:13 -0400 -Subject: [PATCH 09/38] OMS7-N: Persistence on boot through +Subject: [PATCH 09/39] OMS7-N: Persistence on boot through OverlayManagerServiceImpl [9/11] Overlays should not be enforced by the traditional OverlayManagerService diff --git a/patches/frameworks/base/0010-OMS7-N-Do-not-enforce-code-policy-limiting-overlay-i.patch b/patches/frameworks/base/0010-OMS7-N-Do-not-enforce-code-policy-limiting-overlay-i.patch index eb9d9d7..432bb95 100644 --- a/patches/frameworks/base/0010-OMS7-N-Do-not-enforce-code-policy-limiting-overlay-i.patch +++ b/patches/frameworks/base/0010-OMS7-N-Do-not-enforce-code-policy-limiting-overlay-i.patch @@ -1,7 +1,7 @@ -From accdb618c530796534fc4b84e69fc81ea6d98f07 Mon Sep 17 00:00:00 2001 +From 80ac3c5bd7cda0c8621aec4864a6152b0687b35c Mon Sep 17 00:00:00 2001 From: Nicholas Chum Date: Thu, 27 Oct 2016 07:08:00 +0200 -Subject: [PATCH 10/38] OMS7-N: Do not enforce code policy limiting overlay +Subject: [PATCH 10/39] OMS7-N: Do not enforce code policy limiting overlay installation [10/11] Change-Id: Iea317f3771f25dbfcbf4938e88cace12fd97d7eb diff --git a/patches/frameworks/base/0011-OMS7-N-Implement-multi-target-enable-disable-and-dis.patch b/patches/frameworks/base/0011-OMS7-N-Implement-multi-target-enable-disable-and-dis.patch index 317b504..e5cbd7f 100644 --- a/patches/frameworks/base/0011-OMS7-N-Implement-multi-target-enable-disable-and-dis.patch +++ b/patches/frameworks/base/0011-OMS7-N-Implement-multi-target-enable-disable-and-dis.patch @@ -1,7 +1,7 @@ -From d3a24aa7becbcc6ce61d0e13a07b87525d0769fd Mon Sep 17 00:00:00 2001 +From 222657694ae34a145284e35dda583805d3851ae2 Mon Sep 17 00:00:00 2001 From: Jacob McSwain Date: Sun, 26 Jun 2016 15:21:52 -0500 -Subject: [PATCH 11/38] OMS7-N: Implement multi-target enable/disable and +Subject: [PATCH 11/39] OMS7-N: Implement multi-target enable/disable and disable-all [11/11] Just use the enable option like normal, but you can add more arguments diff --git a/patches/frameworks/base/0012-Themes-Expose-resolver-hardcoded-colors.patch b/patches/frameworks/base/0012-Themes-Expose-resolver-hardcoded-colors.patch index b832530..9364ff1 100644 --- a/patches/frameworks/base/0012-Themes-Expose-resolver-hardcoded-colors.patch +++ b/patches/frameworks/base/0012-Themes-Expose-resolver-hardcoded-colors.patch @@ -1,7 +1,7 @@ -From e1469be527249a4015953afaef58ea65b96ab673 Mon Sep 17 00:00:00 2001 +From 30faae7536ebb3d2879161ed8d0adde3bbaf1ebb Mon Sep 17 00:00:00 2001 From: Dave Kover Date: Fri, 9 Dec 2016 10:47:17 -0700 -Subject: [PATCH 12/38] Themes: Expose resolver hardcoded colors +Subject: [PATCH 12/39] Themes: Expose resolver hardcoded colors commit dbbd5e70cc65002df41561474b03362022dd6716 Author: Dave Kover diff --git a/patches/frameworks/base/0013-Themes-Allow-Immersive-cling-colors-to-be-fully-them.patch b/patches/frameworks/base/0013-Themes-Allow-Immersive-cling-colors-to-be-fully-them.patch index b7660db..26a0656 100644 --- a/patches/frameworks/base/0013-Themes-Allow-Immersive-cling-colors-to-be-fully-them.patch +++ b/patches/frameworks/base/0013-Themes-Allow-Immersive-cling-colors-to-be-fully-them.patch @@ -1,7 +1,7 @@ -From 3871ec03b79a47e40ed9405edbdf502500603dff Mon Sep 17 00:00:00 2001 +From 2626e4fd9102ccdb4b1abf2242dc98d67f9c5382 Mon Sep 17 00:00:00 2001 From: Nicholas Chum Date: Tue, 17 Nov 2015 18:57:11 -0500 -Subject: [PATCH 13/38] Themes: Allow Immersive cling colors to be fully themed +Subject: [PATCH 13/39] Themes: Allow Immersive cling colors to be fully themed This allows the immersive mode help tooltip to be themed completely by removing hardcoded framework calls. Let the themer decide what they want diff --git a/patches/frameworks/base/0014-Themes-Allow-Permission-Icons-to-be-fully-themed.patch b/patches/frameworks/base/0014-Themes-Allow-Permission-Icons-to-be-fully-themed.patch index 7ef7eaf..b985153 100644 --- a/patches/frameworks/base/0014-Themes-Allow-Permission-Icons-to-be-fully-themed.patch +++ b/patches/frameworks/base/0014-Themes-Allow-Permission-Icons-to-be-fully-themed.patch @@ -1,7 +1,7 @@ -From 2d1f47489f89e1d16ba15f126cabf79b592e64e8 Mon Sep 17 00:00:00 2001 +From 7e132632f4317e887c9a4f0a7176d691a10d7e6a Mon Sep 17 00:00:00 2001 From: Nicholas Chum Date: Mon, 23 Nov 2015 23:49:15 -0500 -Subject: [PATCH 14/38] Themes: Allow Permission Icons to be fully themed +Subject: [PATCH 14/39] Themes: Allow Permission Icons to be fully themed This removes the forced @android:color/black tint on the permission icons during app sideload through PackageInstaller. diff --git a/patches/frameworks/base/0015-Themes-Allow-Navbar-ripple-color-to-be-themed.patch b/patches/frameworks/base/0015-Themes-Allow-Navbar-ripple-color-to-be-themed.patch index 9945da4..a1c4859 100644 --- a/patches/frameworks/base/0015-Themes-Allow-Navbar-ripple-color-to-be-themed.patch +++ b/patches/frameworks/base/0015-Themes-Allow-Navbar-ripple-color-to-be-themed.patch @@ -1,7 +1,7 @@ -From 877df2f3564c0511e5a8ba7b9b2c91c89d2a6e01 Mon Sep 17 00:00:00 2001 +From 115c01b1fb6ca51b5c7599618f0097c0f4b5853e Mon Sep 17 00:00:00 2001 From: Dave Kover Date: Thu, 14 Apr 2016 10:19:13 +0700 -Subject: [PATCH 15/38] Themes: Allow Navbar ripple color to be themed +Subject: [PATCH 15/39] Themes: Allow Navbar ripple color to be themed PS1: Layers Commit by @setiawanjimmy diff --git a/patches/frameworks/base/0016-SystemUI-Expose-QS-edit-item-decoration-background-c.patch b/patches/frameworks/base/0016-SystemUI-Expose-QS-edit-item-decoration-background-c.patch index 7c8bf64..d2b4787 100644 --- a/patches/frameworks/base/0016-SystemUI-Expose-QS-edit-item-decoration-background-c.patch +++ b/patches/frameworks/base/0016-SystemUI-Expose-QS-edit-item-decoration-background-c.patch @@ -1,7 +1,7 @@ -From aff3bc9220590e6cced7b8cfaefae6bb005843c6 Mon Sep 17 00:00:00 2001 +From 5dea0080ea8ddb30e3f13e415aee1aa8f1748524 Mon Sep 17 00:00:00 2001 From: Ivan Iskandar Date: Sun, 18 Sep 2016 21:33:18 +0700 -Subject: [PATCH 16/38] SystemUI: Expose QS edit item decoration background +Subject: [PATCH 16/39] SystemUI: Expose QS edit item decoration background color PS2: diff --git a/patches/frameworks/base/0017-Allow-custom-alpha-for-notification-shade-bg-color.patch b/patches/frameworks/base/0017-Allow-custom-alpha-for-notification-shade-bg-color.patch index 35c3023..b3eaff3 100644 --- a/patches/frameworks/base/0017-Allow-custom-alpha-for-notification-shade-bg-color.patch +++ b/patches/frameworks/base/0017-Allow-custom-alpha-for-notification-shade-bg-color.patch @@ -1,7 +1,7 @@ -From 5772f09122cb0bd56cbd7121a3fd4d2389ef8102 Mon Sep 17 00:00:00 2001 +From 98380a5481203bb3b1fc87c9858956de2adc740f Mon Sep 17 00:00:00 2001 From: Simao Gomes Viana Date: Fri, 25 Nov 2016 20:50:29 +0100 -Subject: [PATCH 17/38] Allow custom alpha for notification shade bg color +Subject: [PATCH 17/39] Allow custom alpha for notification shade bg color Change-Id: If621df83d994feae0448a734408ba85ac8329325 --- diff --git a/patches/frameworks/base/0018-Themes-Expose-various-QuickSettings-text-colors.patch b/patches/frameworks/base/0018-Themes-Expose-various-QuickSettings-text-colors.patch index b0e6c93..3a3aab1 100644 --- a/patches/frameworks/base/0018-Themes-Expose-various-QuickSettings-text-colors.patch +++ b/patches/frameworks/base/0018-Themes-Expose-various-QuickSettings-text-colors.patch @@ -1,7 +1,7 @@ -From 8a1870f105abf0e2236e96fc315e7851c5af0d9b Mon Sep 17 00:00:00 2001 +From 09d5a2a8420cb4b80e3bd5d5076573d8cd5f29ff Mon Sep 17 00:00:00 2001 From: "Niklas Schnettler (Sh4dowSoul)" Date: Wed, 5 Oct 2016 18:07:43 +0200 -Subject: [PATCH 18/38] Themes: Expose various QuickSettings text colors +Subject: [PATCH 18/39] Themes: Expose various QuickSettings text colors Change-Id: Iaea71ca83afbc3d8cc6faea6afac16cabb46cfff --- diff --git a/patches/frameworks/base/0019-Notifications-Expose-a-bool-to-disable-dynamic-color.patch b/patches/frameworks/base/0019-Notifications-Expose-a-bool-to-disable-dynamic-color.patch index d9a2078..f0f5625 100644 --- a/patches/frameworks/base/0019-Notifications-Expose-a-bool-to-disable-dynamic-color.patch +++ b/patches/frameworks/base/0019-Notifications-Expose-a-bool-to-disable-dynamic-color.patch @@ -1,7 +1,7 @@ -From 3a0db1599e4075a7e9b08d0926e699da38378f45 Mon Sep 17 00:00:00 2001 +From b072c46400630130d11199c37dbcdc00f122188e Mon Sep 17 00:00:00 2001 From: Nicholas Chum Date: Sat, 27 Aug 2016 10:56:46 -0400 -Subject: [PATCH 19/38] Notifications: Expose a bool to disable dynamic colors +Subject: [PATCH 19/39] Notifications: Expose a bool to disable dynamic colors This commit allows a themer to overlay a boolean value in config.xml to disable dynamic colors applied to the app title and app icon of each diff --git a/patches/frameworks/base/0020-Notification-dynamic-colors-bool-compatible-with-OMS.patch b/patches/frameworks/base/0020-Notification-dynamic-colors-bool-compatible-with-OMS.patch index 38b9274..cccb0aa 100644 --- a/patches/frameworks/base/0020-Notification-dynamic-colors-bool-compatible-with-OMS.patch +++ b/patches/frameworks/base/0020-Notification-dynamic-colors-bool-compatible-with-OMS.patch @@ -1,7 +1,7 @@ -From e484b9a479870311436fa12bc6df4494a9822525 Mon Sep 17 00:00:00 2001 +From 523b039278acdf5a7044b1e33af5844bde06cc51 Mon Sep 17 00:00:00 2001 From: George G Date: Mon, 14 Nov 2016 14:49:47 +0200 -Subject: [PATCH 20/38] Notification dynamic colors bool compatible with OMS7 +Subject: [PATCH 20/39] Notification dynamic colors bool compatible with OMS7 OMS7 introduced this fine piece of code: https://github.com/SubstratumResources/platform_frameworks_base/blob/n-oms7/core/java/android/app/ResourcesManager.java#L897..#L904 diff --git a/patches/frameworks/base/0021-Allow-prevention-of-doze-notification-color-inversio.patch b/patches/frameworks/base/0021-Allow-prevention-of-doze-notification-color-inversio.patch index ac03ef9..d88eb54 100644 --- a/patches/frameworks/base/0021-Allow-prevention-of-doze-notification-color-inversio.patch +++ b/patches/frameworks/base/0021-Allow-prevention-of-doze-notification-color-inversio.patch @@ -1,7 +1,7 @@ -From acc1fe734b3cf4343191dad13cef6f651f9d044a Mon Sep 17 00:00:00 2001 +From ec0c1b4b8f2088b531f5e28666ff2d2c536cd7eb Mon Sep 17 00:00:00 2001 From: Daniel Koman Date: Fri, 17 Apr 2015 11:56:28 -0600 -Subject: [PATCH 21/38] Allow prevention of doze notification color inversion +Subject: [PATCH 21/39] Allow prevention of doze notification color inversion Removed empty newline at the end -- KreAch3R Removed slims files for aosp roms -- Bgill55 diff --git a/patches/frameworks/base/0022-OMS7-compatible-Ambient-notification-inversion.patch b/patches/frameworks/base/0022-OMS7-compatible-Ambient-notification-inversion.patch index b367c90..81b45bd 100644 --- a/patches/frameworks/base/0022-OMS7-compatible-Ambient-notification-inversion.patch +++ b/patches/frameworks/base/0022-OMS7-compatible-Ambient-notification-inversion.patch @@ -1,7 +1,7 @@ -From 1e00e3dec282ac00f3eab9d663adce880d519c4b Mon Sep 17 00:00:00 2001 +From 45f68624cd0345615aeffda1158d402ac7c5acac Mon Sep 17 00:00:00 2001 From: George G Date: Mon, 14 Nov 2016 14:44:17 +0200 -Subject: [PATCH 22/38] OMS7 compatible 'Ambient notification inversion' +Subject: [PATCH 22/39] OMS7 compatible 'Ambient notification inversion' OMS7 introduced this fine piece of code: https://github.com/SubstratumResources/platform_frameworks_base/blob/n-oms7/core/java/android/app/ResourcesManager.java#L897..#L904 diff --git a/patches/frameworks/base/0023-SystemUI-Use-own-drawables-for-QS-expand-icon.patch b/patches/frameworks/base/0023-SystemUI-Use-own-drawables-for-QS-expand-icon.patch index 7342e2f..b181736 100644 --- a/patches/frameworks/base/0023-SystemUI-Use-own-drawables-for-QS-expand-icon.patch +++ b/patches/frameworks/base/0023-SystemUI-Use-own-drawables-for-QS-expand-icon.patch @@ -1,7 +1,7 @@ -From 4935cc9f77a490d87115c679812d844a44f4c099 Mon Sep 17 00:00:00 2001 +From 4a9f18596e8c45c0dc17407039b730fbf173d03d Mon Sep 17 00:00:00 2001 From: Ivan Iskandar Date: Mon, 5 Dec 2016 19:00:04 +0700 -Subject: [PATCH 23/38] SystemUI: Use own drawables for QS expand icon +Subject: [PATCH 23/39] SystemUI: Use own drawables for QS expand icon This was using the volume panel drawables used also on volume panel. So with this commit themers can give different icon for either QS diff --git a/patches/frameworks/base/0024-N-Extras-Add-dynamic-theme-BootAnimation-support.patch b/patches/frameworks/base/0024-N-Extras-Add-dynamic-theme-BootAnimation-support.patch index 46c73af..f4c334a 100644 --- a/patches/frameworks/base/0024-N-Extras-Add-dynamic-theme-BootAnimation-support.patch +++ b/patches/frameworks/base/0024-N-Extras-Add-dynamic-theme-BootAnimation-support.patch @@ -1,7 +1,7 @@ -From 91bfe07e4c527b269e263730f650d36f2d699593 Mon Sep 17 00:00:00 2001 +From 5bfb6898a0b37ee4d1835fc31e39d83af78d8ff7 Mon Sep 17 00:00:00 2001 From: 0xD34D Date: Mon, 9 Jan 2017 07:19:41 +0530 -Subject: [PATCH 24/38] N-Extras: Add dynamic theme BootAnimation support +Subject: [PATCH 24/39] N-Extras: Add dynamic theme BootAnimation support Extracted from "Themes: Port to CM13 [1/3]" http://review.cyanogenmod.org/#/c/113273/14 diff --git a/patches/frameworks/base/0025-N-Extras-Add-dynamic-theme-fonts-support.patch b/patches/frameworks/base/0025-N-Extras-Add-dynamic-theme-fonts-support.patch index 6cc1418..52a2850 100644 --- a/patches/frameworks/base/0025-N-Extras-Add-dynamic-theme-fonts-support.patch +++ b/patches/frameworks/base/0025-N-Extras-Add-dynamic-theme-fonts-support.patch @@ -1,7 +1,7 @@ -From f94acee53b3fccbc654e6cf433d54a8372257c6e Mon Sep 17 00:00:00 2001 +From b2a5047293b699bad5b3402b4a89b9cade942bc7 Mon Sep 17 00:00:00 2001 From: 0xD34D Date: Wed, 22 Jun 2016 23:54:23 +0300 -Subject: [PATCH 25/38] N-Extras: Add dynamic theme fonts support +Subject: [PATCH 25/39] N-Extras: Add dynamic theme fonts support Due to the nature of the removal of assetSeq in OMS7+, we now use the more controllable font scale updating code to update the fonts on diff --git a/patches/frameworks/base/0026-N-Extras-AudioService-Allow-system-effect-sounds-to-.patch b/patches/frameworks/base/0026-N-Extras-AudioService-Allow-system-effect-sounds-to-.patch index 6a10837..60165dc 100644 --- a/patches/frameworks/base/0026-N-Extras-AudioService-Allow-system-effect-sounds-to-.patch +++ b/patches/frameworks/base/0026-N-Extras-AudioService-Allow-system-effect-sounds-to-.patch @@ -1,7 +1,7 @@ -From 2ae9c134e5eefee70bb1abce584b0db310baa8f5 Mon Sep 17 00:00:00 2001 +From 053a5873c01639b5911dc0218b225a97d41e6517 Mon Sep 17 00:00:00 2001 From: Nicholas Chum Date: Sun, 17 Jul 2016 17:56:40 -0400 -Subject: [PATCH 26/38] N-Extras: AudioService: Allow system effect sounds to +Subject: [PATCH 26/39] N-Extras: AudioService: Allow system effect sounds to be themed This commit checks whether there is a preexisting file in the themed diff --git a/patches/frameworks/base/0027-OMS7-N-ApplicationsState-add-filter-for-Substratum-o.patch b/patches/frameworks/base/0027-OMS7-N-ApplicationsState-add-filter-for-Substratum-o.patch index 6952725..0144f5f 100644 --- a/patches/frameworks/base/0027-OMS7-N-ApplicationsState-add-filter-for-Substratum-o.patch +++ b/patches/frameworks/base/0027-OMS7-N-ApplicationsState-add-filter-for-Substratum-o.patch @@ -1,7 +1,7 @@ -From 3722812f93a0ba0de99a435bfdc0f121a5f650d7 Mon Sep 17 00:00:00 2001 +From 82df27f007a1b852634bc305eafe044a7aa48736 Mon Sep 17 00:00:00 2001 From: George G Date: Mon, 4 Jul 2016 06:25:15 +0300 -Subject: [PATCH 27/38] OMS7-N: ApplicationsState: add filter for Substratum +Subject: [PATCH 27/39] OMS7-N: ApplicationsState: add filter for Substratum overlays [1/2] This commit allows the framework to handle the filtering of the diff --git a/patches/frameworks/base/0028-OMS7-N-ApplicationsState-add-filter-for-Substratum-i.patch b/patches/frameworks/base/0028-OMS7-N-ApplicationsState-add-filter-for-Substratum-i.patch index cd37775..6bfe3e2 100644 --- a/patches/frameworks/base/0028-OMS7-N-ApplicationsState-add-filter-for-Substratum-i.patch +++ b/patches/frameworks/base/0028-OMS7-N-ApplicationsState-add-filter-for-Substratum-i.patch @@ -1,7 +1,7 @@ -From 2cffbe56ae7585e6d863b9647e88303e921bc4de Mon Sep 17 00:00:00 2001 +From c9f5177b9a4614f0cd5602993839050fae0fa643 Mon Sep 17 00:00:00 2001 From: Kuba Schenk Date: Thu, 1 Dec 2016 21:48:26 +0100 -Subject: [PATCH 28/38] OMS7-N: ApplicationsState: add filter for Substratum +Subject: [PATCH 28/39] OMS7-N: ApplicationsState: add filter for Substratum icon overlays [1/2] This commit allows the framework to handle the filtering of the icon overlays found for OMS. diff --git a/patches/frameworks/base/0029-Themes-Expose-QS-battery.patch b/patches/frameworks/base/0029-Themes-Expose-QS-battery.patch index 27cb85e..c79f427 100644 --- a/patches/frameworks/base/0029-Themes-Expose-QS-battery.patch +++ b/patches/frameworks/base/0029-Themes-Expose-QS-battery.patch @@ -1,7 +1,7 @@ -From 81a4c442d12408b9d19ead73134d12cc777adf4b Mon Sep 17 00:00:00 2001 +From edb54e92df68678b2d3b7178c2e23b1f890972da Mon Sep 17 00:00:00 2001 From: Abdulwahab Isam Date: Fri, 7 Oct 2016 08:30:11 +0300 -Subject: [PATCH 29/38] Themes: Expose QS battery +Subject: [PATCH 29/39] Themes: Expose QS battery This is needed for white themes like Belo. Should function the same with dark themes as well. diff --git a/patches/frameworks/base/0030-OMS-Introduce-MODIFY_OVERLAYS-permission-for-user-ap.patch b/patches/frameworks/base/0030-OMS-Introduce-MODIFY_OVERLAYS-permission-for-user-ap.patch index 9cc93f7..e7230d0 100644 --- a/patches/frameworks/base/0030-OMS-Introduce-MODIFY_OVERLAYS-permission-for-user-ap.patch +++ b/patches/frameworks/base/0030-OMS-Introduce-MODIFY_OVERLAYS-permission-for-user-ap.patch @@ -1,7 +1,7 @@ -From 1808dee12401982a7df5f7538a40f78de9c1dfe8 Mon Sep 17 00:00:00 2001 +From 3f3902d3bae9bc8cb3c304580ea69936cb0edd9c Mon Sep 17 00:00:00 2001 From: bigrushdog Date: Mon, 19 Dec 2016 04:33:31 -0800 -Subject: [PATCH 30/38] OMS: Introduce MODIFY_OVERLAYS permission for user apps +Subject: [PATCH 30/39] OMS: Introduce MODIFY_OVERLAYS permission for user apps This permission will grant the app read and write permissions to access OverlayManagerService. If caller does not posess diff --git a/patches/frameworks/base/0031-SystemUI-Expose-switch-bar-title.patch b/patches/frameworks/base/0031-SystemUI-Expose-switch-bar-title.patch index 816ed3c..408159b 100644 --- a/patches/frameworks/base/0031-SystemUI-Expose-switch-bar-title.patch +++ b/patches/frameworks/base/0031-SystemUI-Expose-switch-bar-title.patch @@ -1,7 +1,7 @@ -From 05d4715f44f7ae4e33517d404c528ac90520cf91 Mon Sep 17 00:00:00 2001 +From 49d41589da4ae6d7229cde9fa3bf7c9679788e45 Mon Sep 17 00:00:00 2001 From: daveyannihilation Date: Sun, 1 Jan 2017 01:47:53 -0700 -Subject: [PATCH 31/38] SystemUI: Expose switch bar title +Subject: [PATCH 31/39] SystemUI: Expose switch bar title This is needed for the power notifications switchbar in SystemUI Tuner, amongst other things. diff --git a/patches/frameworks/base/0032-Themes-Expose-manifest-styles-for-themes.patch b/patches/frameworks/base/0032-Themes-Expose-manifest-styles-for-themes.patch index 8e06450..05a1baa 100644 --- a/patches/frameworks/base/0032-Themes-Expose-manifest-styles-for-themes.patch +++ b/patches/frameworks/base/0032-Themes-Expose-manifest-styles-for-themes.patch @@ -1,7 +1,7 @@ -From e1dfd205fa7e1f3c7008e72fb15fe01577ad944c Mon Sep 17 00:00:00 2001 +From 9eeec9c55f7509b89963a5fe36c3d274d871ab60 Mon Sep 17 00:00:00 2001 From: Bryan Owens Date: Fri, 6 Jan 2017 21:12:15 +0800 -Subject: [PATCH 32/38] Themes: Expose manifest styles for themes +Subject: [PATCH 32/39] Themes: Expose manifest styles for themes Change-Id: Ie3a4fdead4f4fa1c121018b38de1c86a05bbcff2 --- diff --git a/patches/frameworks/base/0033-OMS-StrictMode-and-files-under-data-system-theme.patch b/patches/frameworks/base/0033-OMS-StrictMode-and-files-under-data-system-theme.patch index fb4a2d6..bb8bf7a 100644 --- a/patches/frameworks/base/0033-OMS-StrictMode-and-files-under-data-system-theme.patch +++ b/patches/frameworks/base/0033-OMS-StrictMode-and-files-under-data-system-theme.patch @@ -1,7 +1,7 @@ -From 6f4471f0ce013aa2372be0d1740a18003a348a1e Mon Sep 17 00:00:00 2001 +From 96b9021830fde7f2544016d5c51c16a076a49484 Mon Sep 17 00:00:00 2001 From: mickybart Date: Sat, 19 Nov 2016 19:05:05 -0500 -Subject: [PATCH 33/38] OMS: StrictMode and files under /data/system/theme/ +Subject: [PATCH 33/39] OMS: StrictMode and files under /data/system/theme/ Themes are using /data/system/theme/ to push some files like LowBattery.ogg (audio notification) When the device battery trigger the low battery state, the sound is not played due diff --git a/patches/frameworks/base/0034-doze-allow-grayscale-even-if-invert-boolean-is-false.patch b/patches/frameworks/base/0034-doze-allow-grayscale-even-if-invert-boolean-is-false.patch index 0cc255e..9d91eab 100644 --- a/patches/frameworks/base/0034-doze-allow-grayscale-even-if-invert-boolean-is-false.patch +++ b/patches/frameworks/base/0034-doze-allow-grayscale-even-if-invert-boolean-is-false.patch @@ -1,7 +1,7 @@ -From 6b8eab5e96bf1889d8ffb4f4da9ed6552018d81f Mon Sep 17 00:00:00 2001 +From 29d865f6db1f5ea6d6866831943ead4382a958bb Mon Sep 17 00:00:00 2001 From: Daniel Koman Date: Wed, 28 Sep 2016 15:28:26 +0200 -Subject: [PATCH 34/38] doze: allow grayscale even if invert boolean is false +Subject: [PATCH 34/39] doze: allow grayscale even if invert boolean is false for dark themes, we are setting the config boolean for inverting doze notifications to false. in addition to preventing diff --git a/patches/frameworks/base/0035-Expose-external-qs-tile-tint-color.patch b/patches/frameworks/base/0035-Expose-external-qs-tile-tint-color.patch index bedb5dd..cf154e0 100644 --- a/patches/frameworks/base/0035-Expose-external-qs-tile-tint-color.patch +++ b/patches/frameworks/base/0035-Expose-external-qs-tile-tint-color.patch @@ -1,7 +1,7 @@ -From 3dc4ac418abd5cb3e3fa49377fbc12a6c88fae8c Mon Sep 17 00:00:00 2001 +From 344ae621e0b9fea43506d99b7fb12e95414f7825 Mon Sep 17 00:00:00 2001 From: Alex Cruz Date: Tue, 24 Jan 2017 11:14:46 +0100 -Subject: [PATCH 35/38] Expose external qs tile tint color +Subject: [PATCH 35/39] Expose external qs tile tint color This should allow themers to get around issues like this (see pic below) diff --git a/patches/frameworks/base/0036-graphics-ADB-N-icon-compatible-with-OMS7.patch b/patches/frameworks/base/0036-graphics-ADB-N-icon-compatible-with-OMS7.patch index 0197473..71c2b22 100644 --- a/patches/frameworks/base/0036-graphics-ADB-N-icon-compatible-with-OMS7.patch +++ b/patches/frameworks/base/0036-graphics-ADB-N-icon-compatible-with-OMS7.patch @@ -1,7 +1,7 @@ -From eef9bb93ec4e320cda2d3bdcb52838226040626b Mon Sep 17 00:00:00 2001 +From 4160deefa178641c4ad0a04d4666e2f1f5032d79 Mon Sep 17 00:00:00 2001 From: George G Date: Thu, 2 Feb 2017 01:52:27 +0200 -Subject: [PATCH 36/38] graphics: ADB "N" icon compatible with OMS7 +Subject: [PATCH 36/39] graphics: ADB "N" icon compatible with OMS7 It's the same problem as the booleans again. This time, it affected the adb "N" icon in the statusbar. This commit should fix this. diff --git a/patches/frameworks/base/0037-Set-external-QS-tiles-tint-mode-to-SRC_ATOP.patch b/patches/frameworks/base/0037-Set-external-QS-tiles-tint-mode-to-SRC_ATOP.patch index b506a2d..0f70678 100644 --- a/patches/frameworks/base/0037-Set-external-QS-tiles-tint-mode-to-SRC_ATOP.patch +++ b/patches/frameworks/base/0037-Set-external-QS-tiles-tint-mode-to-SRC_ATOP.patch @@ -1,7 +1,7 @@ -From 00fbcc2ad550555e8059fac66d621d427851ed81 Mon Sep 17 00:00:00 2001 +From 7c68e1ec39a7031020eaaadebdb0aee86f48cec1 Mon Sep 17 00:00:00 2001 From: Alex Cruz Date: Sat, 4 Feb 2017 14:13:26 +0100 -Subject: [PATCH 37/38] Set external QS tiles tint mode to SRC_ATOP +Subject: [PATCH 37/39] Set external QS tiles tint mode to SRC_ATOP While the external qs tile tint color was exposed, we had the same problem we had with the external icons in Settings which is if a themer set the color diff --git a/patches/frameworks/base/0038-Themes-Expose-Keyguard-affordance-circle-background.patch b/patches/frameworks/base/0038-Themes-Expose-Keyguard-affordance-circle-background.patch index c400219..539a2f4 100644 --- a/patches/frameworks/base/0038-Themes-Expose-Keyguard-affordance-circle-background.patch +++ b/patches/frameworks/base/0038-Themes-Expose-Keyguard-affordance-circle-background.patch @@ -1,7 +1,7 @@ -From 727d6a18ff231377156a16bcbd544a71dd0fdf3f Mon Sep 17 00:00:00 2001 +From 4bfd7364e528492112373eb81ae4ff97a42658f0 Mon Sep 17 00:00:00 2001 From: Branden M Date: Wed, 1 Feb 2017 22:22:45 -0600 -Subject: [PATCH 38/38] Themes: Expose Keyguard affordance circle background +Subject: [PATCH 38/39] Themes: Expose Keyguard affordance circle background Change-Id: Id4a078cdbc944fa0c0736103045a0382d49ecb80 --- diff --git a/patches/frameworks/base/0039-Add-a-protected-broadcast-for-Masquerade-events.patch b/patches/frameworks/base/0039-Add-a-protected-broadcast-for-Masquerade-events.patch new file mode 100644 index 0000000..bb47cd2 --- /dev/null +++ b/patches/frameworks/base/0039-Add-a-protected-broadcast-for-Masquerade-events.patch @@ -0,0 +1,44 @@ +From f0e66274ad4cc5f8adc34ccb07db3162f11a35f8 Mon Sep 17 00:00:00 2001 +From: bigrushdog +Date: Sat, 14 Jan 2017 23:33:38 -0800 +Subject: [PATCH 39/39] Add a protected broadcast for Masquerade events + +Parse extras to get event details. Docs will be available +in Masquerade source code + +Change-Id: I24ca3d11438bb830ce97af8b0e935c0700b394e6 +--- + core/res/AndroidManifest.xml | 2 ++ + services/core/java/com/android/server/pm/PackageManagerService.java | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml +index 36df6eac13e..768b04c86c5 100644 +--- a/core/res/AndroidManifest.xml ++++ b/core/res/AndroidManifest.xml +@@ -517,6 +517,8 @@ + + + ++ ++ + + + +diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java +index faaff1f08a2..79032a915ca 100644 +--- a/services/core/java/com/android/server/pm/PackageManagerService.java ++++ b/services/core/java/com/android/server/pm/PackageManagerService.java +@@ -4568,7 +4568,8 @@ public class PackageManagerService extends IPackageManager.Stub { + if (actionName.startsWith("android.net.netmon.lingerExpired") + || actionName.startsWith("com.android.server.sip.SipWakeupTimer") + || actionName.startsWith("com.android.internal.telephony.data-reconnect") +- || actionName.startsWith("android.net.netmon.launchCaptivePortalApp")) { ++ || actionName.startsWith("android.net.netmon.launchCaptivePortalApp") ++ || actionName.startsWith("masquerade.substratum.STATUS_CHANGED")) { + return true; + } + } +-- +2.11.1 + diff --git a/patches/packages/apps/masquerade/0001-Rewrite-Masquerade-for-UID-system-ops-1-3.patch b/patches/packages/apps/masquerade/0001-Rewrite-Masquerade-for-UID-system-ops-1-3.patch new file mode 100644 index 0000000..1789e66 --- /dev/null +++ b/patches/packages/apps/masquerade/0001-Rewrite-Masquerade-for-UID-system-ops-1-3.patch @@ -0,0 +1,2284 @@ +From 2b7192e30c8a93b716def9fc564e90867e0f96f3 Mon Sep 17 00:00:00 2001 +From: bigrushdog +Date: Wed, 14 Dec 2016 01:06:32 -0800 +Subject: [PATCH 1/3] Rewrite Masquerade for UID system ops [1/3] + +Allow Substratum to offload a handful of functions +to system to support rootless operation + +Credit @Surge1223 for cleaning up restartUI function +https://github.com/VelvetProject/packages_apps_masquerade/commit/3484db3dda1e7bf7e3f6fda049b903968f1506e7 + +Change-Id: Ie379fc81e5b80550e044df59c80a60b4890c340c +--- + app/src/main/AndroidManifest.xml | 33 +- + .../substratum/activities/LoaderActivity.java | 17 - + .../substratum/receivers/BootReceiver.java | 13 + + .../UninstallReceiver.java} | 11 +- + .../substratum/services/BootDetector.java | 15 - + .../masquerade/substratum/services/JobService.java | 1005 ++++++++++++++++++++ + .../masquerade/substratum/services/MasqDemo.java | 137 +++ + .../java/masquerade/substratum/util/Helper.java | 113 --- + .../substratum/util/IconPackApplicator.java | 136 --- + .../substratum/util/ReadOverlaysFile.java | 46 - + .../main/java/masquerade/substratum/util/Root.java | 83 -- + .../masquerade/substratum/util/Uninstaller.java | 107 --- + .../java/masquerade/substratum/utils/IOUtils.java | 170 ++++ + .../masquerade/substratum/utils/SoundUtils.java | 210 ++++ + 14 files changed, 1555 insertions(+), 541 deletions(-) + delete mode 100644 app/src/main/java/masquerade/substratum/activities/LoaderActivity.java + create mode 100644 app/src/main/java/masquerade/substratum/receivers/BootReceiver.java + rename app/src/main/java/masquerade/substratum/{services/UninstallDetector.java => receivers/UninstallReceiver.java} (87%) + delete mode 100644 app/src/main/java/masquerade/substratum/services/BootDetector.java + create mode 100644 app/src/main/java/masquerade/substratum/services/JobService.java + create mode 100644 app/src/main/java/masquerade/substratum/services/MasqDemo.java + delete mode 100644 app/src/main/java/masquerade/substratum/util/Helper.java + delete mode 100644 app/src/main/java/masquerade/substratum/util/IconPackApplicator.java + delete mode 100644 app/src/main/java/masquerade/substratum/util/ReadOverlaysFile.java + delete mode 100644 app/src/main/java/masquerade/substratum/util/Root.java + delete mode 100644 app/src/main/java/masquerade/substratum/util/Uninstaller.java + create mode 100644 app/src/main/java/masquerade/substratum/utils/IOUtils.java + create mode 100644 app/src/main/java/masquerade/substratum/utils/SoundUtils.java + +diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml +index aaffdf2..13db0f9 100644 +--- a/app/src/main/AndroidManifest.xml ++++ b/app/src/main/AndroidManifest.xml +@@ -1,12 +1,20 @@ + ++ android:versionCode="21" ++ android:versionName="twentyone - something" ++ coreApp="true" ++ android:sharedUserId="android.uid.system"> + + + + + ++ ++ ++ ++ ++ ++ + + +- ++ + + + + +- ++ + + + + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ + + +diff --git a/app/src/main/java/masquerade/substratum/activities/LoaderActivity.java b/app/src/main/java/masquerade/substratum/activities/LoaderActivity.java +deleted file mode 100644 +index 3af5ec3..0000000 +--- a/app/src/main/java/masquerade/substratum/activities/LoaderActivity.java ++++ /dev/null +@@ -1,17 +0,0 @@ +-package masquerade.substratum.activities; +- +-import android.app.Activity; +-import android.os.Bundle; +-import android.util.Log; +- +-import masquerade.substratum.util.Root; +- +-public class LoaderActivity extends Activity { +- @Override +- protected void onCreate(Bundle savedInstanceState) { +- super.onCreate(savedInstanceState); +- Log.d("Masquerade", "Masquerade is now securing superuser permissions!"); +- Root.requestRootAccess(); +- finish(); +- } +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/receivers/BootReceiver.java b/app/src/main/java/masquerade/substratum/receivers/BootReceiver.java +new file mode 100644 +index 0000000..ebc0c8b +--- /dev/null ++++ b/app/src/main/java/masquerade/substratum/receivers/BootReceiver.java +@@ -0,0 +1,13 @@ ++package masquerade.substratum.receivers; ++ ++import android.content.BroadcastReceiver; ++import android.content.Context; ++import android.content.Intent; ++ ++ ++public class BootReceiver extends BroadcastReceiver { ++ @Override ++ public void onReceive(Context context, Intent intent) { ++ // do something ++ } ++} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/services/UninstallDetector.java b/app/src/main/java/masquerade/substratum/receivers/UninstallReceiver.java +similarity index 87% +rename from app/src/main/java/masquerade/substratum/services/UninstallDetector.java +rename to app/src/main/java/masquerade/substratum/receivers/UninstallReceiver.java +index 7af387b..b377e27 100644 +--- a/app/src/main/java/masquerade/substratum/services/UninstallDetector.java ++++ b/app/src/main/java/masquerade/substratum/receivers/UninstallReceiver.java +@@ -1,4 +1,4 @@ +-package masquerade.substratum.services; ++package masquerade.substratum.receivers; + + import android.content.BroadcastReceiver; + import android.content.Context; +@@ -11,20 +11,18 @@ import android.util.Log; + import java.util.ArrayList; + import java.util.List; + +-import masquerade.substratum.util.ReadOverlaysFile; +-import masquerade.substratum.util.Root; + +-public class UninstallDetector extends BroadcastReceiver { ++public class UninstallReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + if ("android.intent.action.PACKAGE_REMOVED".equals(intent.getAction())) { + Uri packageName = intent.getData(); + if (packageName.toString().substring(8).equals("projekt.substratum")) { +- new performUninstalls().execute(""); ++// new performUninstalls().execute(""); + } + } + } +- ++/* + public class performUninstalls extends AsyncTask { + @Override + protected String doInBackground(String... sUrl) { +@@ -45,4 +43,5 @@ public class UninstallDetector extends BroadcastReceiver { + return null; + } + } ++ */ + } +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/services/BootDetector.java b/app/src/main/java/masquerade/substratum/services/BootDetector.java +deleted file mode 100644 +index 3981487..0000000 +--- a/app/src/main/java/masquerade/substratum/services/BootDetector.java ++++ /dev/null +@@ -1,15 +0,0 @@ +-package masquerade.substratum.services; +- +-import android.content.BroadcastReceiver; +-import android.content.Context; +-import android.content.Intent; +- +-import masquerade.substratum.util.Helper; +- +-public class BootDetector extends BroadcastReceiver { +- @Override +- public void onReceive(Context context, Intent intent) { +- Intent pushIntent = new Intent(context, Helper.class); +- context.startService(pushIntent); +- } +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/services/JobService.java b/app/src/main/java/masquerade/substratum/services/JobService.java +new file mode 100644 +index 0000000..3c1b859 +--- /dev/null ++++ b/app/src/main/java/masquerade/substratum/services/JobService.java +@@ -0,0 +1,1005 @@ ++ ++package masquerade.substratum.services; ++ ++import android.app.ActivityManager; ++import android.app.ActivityManagerNative; ++import android.app.PendingIntent; ++import android.app.Service; ++import android.content.BroadcastReceiver; ++import android.content.ComponentName; ++import android.content.Context; ++import android.content.IIntentReceiver; ++import android.content.IIntentSender; ++import android.content.Intent; ++import android.content.IntentFilter; ++import android.content.IntentSender; ++import android.content.om.IOverlayManager; ++import android.content.om.OverlayInfo; ++import android.content.pm.IPackageInstallObserver2; ++import android.content.pm.IPackageManager; ++import android.content.pm.PackageInstaller; ++import android.content.pm.PackageManager; ++import android.content.pm.PackageManager.NameNotFoundException; ++import android.content.res.AssetManager; ++import android.content.res.Configuration; ++import android.graphics.Typeface; ++import android.media.RingtoneManager; ++import android.os.Binder; ++import android.os.Bundle; ++import android.os.FileUtils; ++import android.os.Handler; ++import android.os.HandlerThread; ++import android.os.IBinder; ++import android.os.Looper; ++import android.os.Message; ++import android.os.Process; ++import android.os.RemoteException; ++import android.os.ServiceManager; ++import android.os.SystemProperties; ++import android.os.UserHandle; ++import android.provider.Settings; ++import android.text.TextUtils; ++import android.util.Log; ++ ++import java.io.BufferedInputStream; ++import java.io.BufferedOutputStream; ++import java.io.File; ++import java.io.FileInputStream; ++import java.io.FileNotFoundException; ++import java.io.FileOutputStream; ++import java.io.IOException; ++import java.io.InputStream; ++import java.io.OutputStream; ++import java.lang.reflect.Method; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Locale; ++import java.util.concurrent.SynchronousQueue; ++import java.util.concurrent.TimeUnit; ++import java.util.zip.ZipEntry; ++import java.util.zip.ZipInputStream; ++ ++import masquerade.substratum.utils.IOUtils; ++import masquerade.substratum.utils.SoundUtils; ++ ++import com.android.internal.statusbar.IStatusBarService; ++ ++public class JobService extends Service { ++ private static final String TAG = JobService.class.getSimpleName(); ++ private static final boolean DEBUG = true; ++ ++ private static final String MASQUERADE_TOKEN = "masquerade_token"; ++ private static final String SUBSTRATUM_PACKAGE = "projekt.substratum"; ++ private static final String[] AUTHORIZED_CALLERS = new String[] { ++ SUBSTRATUM_PACKAGE, ++ "masquerade.substratum" ++ }; ++ ++ public static final String INTENT_STATUS_CHANGED = "masquerade.substratum.STATUS_CHANGED"; ++ ++ public static final String PRIMARY_COMMAND_KEY = "primary_command_key"; ++ public static final String JOB_TIME_KEY = "job_time_key"; ++ public static final String INSTALL_LIST_KEY = "install_list"; ++ public static final String UNINSTALL_LIST_KEY = "uninstall_list"; ++ public static final String WITH_RESTART_UI_KEY = "with_restart_ui"; ++ public static final String BOOTANIMATION_FILE_NAME = "bootanimation_file_name"; ++ public static final String FONTS_PID = "fonts_pid"; ++ public static final String FONTS_FILENAME = "fonts_filename"; ++ public static final String AUDIO_PID = "audio_pid"; ++ public static final String AUDIO_FILENAME = "audio_filename"; ++ public static final String COMMAND_VALUE_JOB_COMPLETE = "job_complete"; ++ public static final String COMMAND_VALUE_INSTALL = "install"; ++ public static final String COMMAND_VALUE_UNINSTALL = "uninstall"; ++ public static final String COMMAND_VALUE_RESTART_UI = "restart_ui"; ++ public static final String COMMAND_VALUE_CONFIGURATION_SHIM = "configuration_shim"; ++ public static final String COMMAND_VALUE_BOOTANIMATION = "bootanimation"; ++ public static final String COMMAND_VALUE_FONTS = "fonts"; ++ public static final String COMMAND_VALUE_AUDIO = "audio"; ++ ++ private static IOverlayManager mOMS; ++ private static IPackageManager mPM; ++ ++ private HandlerThread mWorker; ++ private JobHandler mJobHandler; ++ private MainHandler mMainHandler; ++ private final List mJobQueue = new ArrayList<>(0); ++ private long mLastJobTime; ++ ++ @Override ++ public void onCreate() { ++ mWorker = new HandlerThread("BackgroundWorker", Process.THREAD_PRIORITY_BACKGROUND); ++ mWorker.start(); ++ mJobHandler = new JobHandler(mWorker.getLooper()); ++ mMainHandler = new MainHandler(Looper.getMainLooper()); ++ } ++ ++ @Override ++ public int onStartCommand(Intent intent, int flags, int startId) { ++ // verify identity ++ if (!isCallerAuthorized(intent)) { ++ log("caller not authorized, aborting"); ++ return START_NOT_STICKY; ++ } ++ ++ // one job at a time please ++ // if (isProcessing()) { ++ // log("Got start command while still processing last job, aborting"); ++ // return START_NOT_STICKY; ++ // } ++ // filter out duplicate intents ++ long jobTime = intent.getLongExtra(JOB_TIME_KEY, 1); ++ if (jobTime == 1 || jobTime == mLastJobTime) { ++ log("got empty jobtime or duplicate job time, aborting"); ++ return START_NOT_STICKY; ++ } ++ mLastJobTime = jobTime; ++ ++ // must have a primary command ++ String command = intent.getStringExtra(PRIMARY_COMMAND_KEY); ++ if (TextUtils.isEmpty(command)) { ++ log("Got empty primary command, aborting"); ++ return START_NOT_STICKY; ++ } ++ ++ // queue up the job ++ ++ List jobs_to_add = new ArrayList<>(0); ++ ++ log("Starting job with primary command " + command + " With job time " + jobTime); ++ if (TextUtils.equals(command, COMMAND_VALUE_INSTALL)) { ++ List paths = intent.getStringArrayListExtra(INSTALL_LIST_KEY); ++ for (String path : paths) { ++ jobs_to_add.add(new Installer(path)); ++ } ++ } else if (TextUtils.equals(command, COMMAND_VALUE_UNINSTALL)) { ++ List packages = intent.getStringArrayListExtra(UNINSTALL_LIST_KEY); ++ for (String _package : packages) { ++ jobs_to_add.add(new Remover(_package)); ++ } ++ if (intent.getBooleanExtra(WITH_RESTART_UI_KEY, false)) { ++ jobs_to_add.add(new UiResetJob()); ++ } ++ } else if (TextUtils.equals(command, COMMAND_VALUE_RESTART_UI)) { ++ jobs_to_add.add(new UiResetJob()); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_CONFIGURATION_SHIM)) { ++ jobs_to_add.add(new LocaleChanger(getApplicationContext(), mMainHandler)); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_BOOTANIMATION)) { ++ String fileName = intent.getStringExtra(BOOTANIMATION_FILE_NAME); ++ if (TextUtils.isEmpty(fileName)) { ++ jobs_to_add.add(new BootAnimationJob(true)); ++ } else { ++ jobs_to_add.add(new BootAnimationJob(fileName)); ++ } ++ } else if (TextUtils.equals(command, COMMAND_VALUE_FONTS)) { ++ String pid = intent.getStringExtra(FONTS_PID); ++ String fileName = intent.getStringExtra(FONTS_FILENAME); ++ jobs_to_add.add(new FontsJob(pid, fileName)); ++ jobs_to_add.add(new UiResetJob()); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_AUDIO)) { ++ String pid = intent.getStringExtra(AUDIO_PID); ++ String fileName = intent.getStringExtra(AUDIO_FILENAME); ++ jobs_to_add.add(new SoundsJob(pid, fileName)); ++ jobs_to_add.add(new UiResetJob()); ++ } ++ ++ if (jobs_to_add.size() > 0) { ++ log("Adding new jobs to job queue"); ++ synchronized (mJobQueue) { ++ mJobQueue.addAll(jobs_to_add); ++ } ++ if (!mJobHandler.hasMessages(JobHandler.MESSAGE_CHECK_QUEUE)) { ++ mJobHandler.sendEmptyMessage(JobHandler.MESSAGE_CHECK_QUEUE); ++ } ++ } ++ ++ return START_NOT_STICKY; ++ } ++ ++ @Override ++ public IBinder onBind(Intent intent) { ++ return null; ++ } ++ ++ @Override ++ public void onDestroy() { ++ ++ } ++ ++ private boolean isProcessing() { ++ return mJobQueue.size() > 0; ++ } ++ ++ private class LocalService extends Binder { ++ public JobService getService() { ++ return JobService.this; ++ } ++ } ++ ++ private static IOverlayManager getOMS() { ++ if (mOMS == null) { ++ mOMS = IOverlayManager.Stub.asInterface( ++ ServiceManager.getService("overlay")); ++ } ++ return mOMS; ++ } ++ ++ private static IPackageManager getPM() { ++ if (mPM == null) { ++ mPM = IPackageManager.Stub.asInterface( ++ ServiceManager.getService("package")); ++ } ++ return mPM; ++ } ++ ++ private void install(String path, IPackageInstallObserver2 observer) { ++ try { ++ getPM().installPackageAsUser(path, observer, PackageManager.INSTALL_REPLACE_EXISTING, ++ null, ++ UserHandle.USER_SYSTEM); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ private void uninstall(String packageName) { ++ try { ++ final LocalIntentReceiver receiver = new LocalIntentReceiver(); ++ getPM().getPackageInstaller().uninstall(packageName, null /* callerPackageName */, 0, ++ receiver.getIntentSender(), UserHandle.USER_SYSTEM); ++ final Intent result = receiver.getResult(); ++ final int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS, ++ PackageInstaller.STATUS_FAILURE); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ private void disableOverlay(String packageName) { ++ try { ++ getOMS().setEnabled(packageName, false, UserHandle.USER_SYSTEM, false); ++ } catch (RemoteException e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ private boolean isOverlayEnabled(String packageName) { ++ boolean enabled = false; ++ try { ++ OverlayInfo info = getOMS().getOverlayInfo(packageName, UserHandle.USER_ALL); ++ enabled = info.isEnabled(); ++ } catch (RemoteException e) { ++ e.printStackTrace(); ++ } ++ return enabled; ++ } ++ ++ private void copyFonts(String pid, String zipFileName) { ++ // prepare local cache dir for font package assembly ++ log("Copy Fonts - Package ID = " + pid + " filename = " + zipFileName); ++ File cacheDir = new File(getCacheDir(), "/FontCache/"); ++ if (cacheDir.exists()) { ++ IOUtils.deleteRecursive(cacheDir); ++ } ++ cacheDir.mkdir(); ++ ++ // copy system fonts into our cache dir ++ IOUtils.copyFolder("/system/fonts", cacheDir.getAbsolutePath()); ++ ++ // append zip to filename since it is probably removed ++ // for list presentation ++ if (!zipFileName.endsWith(".zip")) { ++ zipFileName = zipFileName + ".zip"; ++ } ++ ++ // copy target themed fonts zip to our cache dir ++ Context themeContext = getAppContext(pid); ++ AssetManager am = themeContext.getAssets(); ++ try { ++ InputStream inputStream = am.open("fonts/" + zipFileName); ++ OutputStream outputStream = new FileOutputStream(getCacheDir() ++ .getAbsolutePath() + "/FontCache/" + zipFileName); ++ IOUtils.bufferedCopy(inputStream, outputStream); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ ++ // unzip new fonts and delete zip file, overwriting any system fonts ++ File fontZip = new File(getCacheDir(), "/FontCache/" + zipFileName); ++ IOUtils.unzip(fontZip.getAbsolutePath(), cacheDir.getAbsolutePath()); ++ fontZip.delete(); ++ ++ // check if theme zip included a fonts.xml. If not, Substratum ++ // is kind enough to provide one for us in it's assets ++ try { ++ File testConfig = new File(getCacheDir(), "/FontCache/" + "fonts.xml"); ++ if (!testConfig.exists()) { ++ Context subContext = getSubsContext(); ++ AssetManager subsAm = subContext.getAssets(); ++ InputStream inputStream = subsAm.open("fonts.xml"); ++ OutputStream outputStream = new FileOutputStream(testConfig); ++ IOUtils.bufferedCopy(inputStream, outputStream); ++ } ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ ++ // prepare system theme fonts folder and copy new fonts folder from our cache ++ IOUtils.deleteThemedFonts(); ++ IOUtils.createFontDirIfNotExists(); ++ IOUtils.copyFolder(cacheDir.getAbsolutePath(), IOUtils.SYSTEM_THEME_FONT_PATH); ++ ++ // set permissions on font files and config xml ++ File themeFonts = new File(IOUtils.SYSTEM_THEME_FONT_PATH); ++ for (File f : themeFonts.listFiles()) { ++ FileUtils.setPermissions(f, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); ++ } ++ ++ // let system know it's time for a font change ++ SystemProperties.set("sys.refresh_theme", "1"); ++ float fontSize = Float.valueOf(Settings.System.getString( ++ getContentResolver(), Settings.System.FONT_SCALE)); ++ Settings.System.putString(getContentResolver(), ++ Settings.System.FONT_SCALE, String.valueOf(fontSize + 0.0000001)); ++ } ++ ++ private void clearFonts() { ++ IOUtils.deleteThemedFonts(); ++ SystemProperties.set("sys.refresh_theme", "1"); ++ Typeface.recreateDefaults(); ++ float fontSize = Float.valueOf(Settings.System.getString( ++ getContentResolver(), Settings.System.FONT_SCALE)); ++ Settings.System.putString(getContentResolver(), ++ Settings.System.FONT_SCALE, String.valueOf(fontSize + 0.0000001)); ++ } ++ ++ private void applyThemedSounds(String pid, String zipFileName) { ++ // prepare local cache dir for font package assembly ++ log("Copy sounds - Package ID = " + pid + " filename = " + zipFileName); ++ File cacheDir = new File(getCacheDir(), "/SoundsCache/"); ++ if (cacheDir.exists()) { ++ IOUtils.deleteRecursive(cacheDir); ++ } ++ cacheDir.mkdir(); ++ ++ // append zip to filename since it is probably removed ++ // for list presentation ++ if (!zipFileName.endsWith(".zip")) { ++ zipFileName = zipFileName + ".zip"; ++ } ++ ++ // copy target themed sounds zip to our cache dir ++ Context themeContext = getAppContext(pid); ++ AssetManager am = themeContext.getAssets(); ++ try { ++ InputStream inputStream = am.open("audio/" + zipFileName); ++ OutputStream outputStream = new FileOutputStream(getCacheDir() ++ .getAbsolutePath() + "/SoundsCache/" + zipFileName); ++ IOUtils.bufferedCopy(inputStream, outputStream); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ ++ // unzip new sounds and delete zip file ++ File soundsZip = new File(getCacheDir(), "/SoundsCache/" + zipFileName); ++ IOUtils.unzip(soundsZip.getAbsolutePath(), cacheDir.getAbsolutePath()); ++ soundsZip.delete(); ++ ++ clearSounds(this); ++ IOUtils.createAudioDirIfNotExists(); ++ ++ File uiSoundsCache = new File(getCacheDir(), "/SoundsCache/ui/"); ++ if (uiSoundsCache.exists() && uiSoundsCache.isDirectory()) { ++ IOUtils.createUiSoundsDirIfNotExists(); ++ File effect_tick_mp3 = new File(getCacheDir(), "/SoundsCache/ui/Effect_Tick.mp3"); ++ File effect_tick_ogg = new File(getCacheDir(), "/SoundsCache/ui/Effect_Tick.ogg"); ++ if (effect_tick_ogg.exists()) { ++ IOUtils.bufferedCopy(effect_tick_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Effect_Tick.ogg")); ++ SoundUtils.setUIAudible(this, effect_tick_ogg, new File ++ ("/data/system/theme/audio/ui/Effect_Tick.ogg"), RingtoneManager ++ .TYPE_RINGTONE, "Effect_Tick"); ++ } else if (effect_tick_mp3.exists()) { ++ IOUtils.bufferedCopy(effect_tick_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Effect_Tick.mp3")); ++ SoundUtils.setUIAudible(this, effect_tick_mp3, new File ++ ("/data/system/theme/audio/ui/Effect_Tick.mp3"), RingtoneManager ++ .TYPE_RINGTONE, "Effect_Tick"); ++ } else { ++ SoundUtils.setDefaultUISounds(getContentResolver(), "lock_sound", "Lock.ogg"); ++ } ++ File new_lock_mp3 = new File(getCacheDir(), "/SoundsCache/ui/Lock.mp3"); ++ File new_lock_ogg = new File(getCacheDir(), "/SoundsCache/ui/Lock.ogg"); ++ if (new_lock_ogg.exists()) { ++ IOUtils.bufferedCopy(new_lock_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Lock.ogg")); ++ SoundUtils.setUISounds(getContentResolver(), "lock_sound", "/data/system/theme/audio/ui/Lock.ogg"); ++ } else if (new_lock_mp3.exists()) { ++ IOUtils.bufferedCopy(new_lock_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Lock.mp3")); ++ SoundUtils.setUISounds(getContentResolver(), "lock_sound", "/data/system/theme/audio/ui/Lock.mp3"); ++ } else { ++ SoundUtils.setDefaultUISounds(getContentResolver(), "lock_sound", "Lock.ogg"); ++ } ++ File new_unlock_mp3 = new File(getCacheDir(), "/SoundsCache/ui/Unlock.mp3"); ++ File new_unlock_ogg = new File(getCacheDir(), "/SoundsCache/ui/Unlock.ogg"); ++ if (new_unlock_ogg.exists()) { ++ IOUtils.bufferedCopy(new_unlock_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Unlock.ogg")); ++ SoundUtils.setUISounds(getContentResolver(), "unlock_sound", "/data/system/theme/audio/ui/Unlock.ogg"); ++ } else if (new_unlock_mp3.exists()) { ++ IOUtils.bufferedCopy(new_unlock_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Unlock.mp3")); ++ SoundUtils.setUISounds(getContentResolver(), "unlock_sound", "/data/system/theme/audio/ui/Unlock.mp3"); ++ } else { ++ SoundUtils.setDefaultUISounds(getContentResolver(), "unlock_sound", "Unlock.ogg"); ++ } ++ File new_lowbattery_mp3 = new File(getCacheDir(), "/SoundsCache/ui/LowBattery.mp3"); ++ File new_lowbattery_ogg = new File(getCacheDir(), "/SoundsCache/ui/LowBattery.ogg"); ++ if (new_lowbattery_ogg.exists()) { ++ IOUtils.bufferedCopy(new_lowbattery_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "LowBattery.ogg")); ++ SoundUtils.setUISounds(getContentResolver(), "low_battery_sound", "/data/system/theme/audio/ui/LowBattery.ogg"); ++ } else if (new_lowbattery_mp3.exists()) { ++ IOUtils.bufferedCopy(new_lowbattery_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "LowBattery.mp3")); ++ SoundUtils.setUISounds(getContentResolver(), "low_battery_sound", "/data/system/theme/audio/ui/LowBattery.mp3"); ++ } else { ++ SoundUtils.setDefaultUISounds(getContentResolver(), "low_battery_sound", "LowBattery.ogg"); ++ } ++ File uiSounds = new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH); ++ if (uiSounds.exists() && uiSounds.isDirectory()) { ++ for (File f : uiSounds.listFiles()) { ++ FileUtils.setPermissions(f, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); ++ } ++ } ++ } ++ File alarmCache = new File(getCacheDir(), "/SoundsCache/alarms/"); ++ if (alarmCache.exists() && alarmCache.isDirectory()) { ++ IOUtils.createAlarmDirIfNotExists(); ++ File new_alarm_mp3 = new File(getCacheDir(), "/SoundsCache/alarms/alarm.mp3"); ++ File new_alarm_ogg = new File(getCacheDir(), "/SoundsCache/alarms/alarm.ogg"); ++ if (new_alarm_ogg.exists()) { ++ IOUtils.bufferedCopy(new_alarm_ogg, new File(IOUtils.SYSTEM_THEME_ALARM_PATH + File.separator + "alarm.ogg")); ++ int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_alarm_metadata", "string", SUBSTRATUM_PACKAGE); ++ SoundUtils.setAudible(this, new File("/data/system/theme/audio/alarms/alarm.ogg"), ++ new File(alarmCache.getAbsolutePath(), "alarm.ogg"), ++ RingtoneManager.TYPE_ALARM, ++ getSubsContext().getString(metaDataId)); ++ } else if (new_alarm_mp3.exists()) { ++ IOUtils.bufferedCopy(new_alarm_mp3, new File(IOUtils.SYSTEM_THEME_ALARM_PATH + File.separator + "alarm.mp3")); ++ int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_alarm_metadata", "string", SUBSTRATUM_PACKAGE); ++ SoundUtils.setAudible(this, new File("/data/system/theme/audio/alarms/alarm.mp3"), ++ new File(alarmCache.getAbsolutePath(), "alarm.mp3"), ++ RingtoneManager.TYPE_ALARM, ++ getSubsContext().getString(metaDataId)); ++ } else { ++ SoundUtils.setDefaultAudible(this, RingtoneManager.TYPE_ALARM); ++ } ++ File alarms = new File(IOUtils.SYSTEM_THEME_ALARM_PATH); ++ if (alarms.exists() && alarms.isDirectory()) { ++ for (File f : alarms.listFiles()) { ++ FileUtils.setPermissions(f, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); ++ } ++ } ++ } ++ File notifCache = new File(getCacheDir(), "/SoundsCache/notifications/"); ++ if (notifCache.exists() && notifCache.isDirectory()) { ++ IOUtils.createNotificationDirIfNotExists(); ++ File new_notif_mp3 = new File(getCacheDir(), "/SoundsCache/notifications/notification.mp3"); ++ File new_notif_ogg = new File(getCacheDir(), "/SoundsCache/notifications/notification.ogg"); ++ if (new_notif_ogg.exists()) { ++ IOUtils.bufferedCopy(new_notif_ogg, new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH + File.separator + "notification.ogg")); ++ int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_notification_metadata", "string", SUBSTRATUM_PACKAGE); ++ SoundUtils.setAudible(this, new File("/data/system/theme/audio/notifications/notification.ogg"), ++ new File(notifCache.getAbsolutePath(), "notification.ogg"), ++ RingtoneManager.TYPE_NOTIFICATION, ++ getSubsContext().getString(metaDataId)); ++ } else if (new_notif_mp3.exists()) { ++ IOUtils.bufferedCopy(new_notif_mp3, new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH + File.separator + "notification.mp3")); ++ int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_notification_metadata", "string", SUBSTRATUM_PACKAGE); ++ SoundUtils.setAudible(this, new File("/data/system/theme/audio/notifications/notification.mp3"), ++ new File(notifCache.getAbsolutePath(), "notification.mp3"), ++ RingtoneManager.TYPE_NOTIFICATION, ++ getSubsContext().getString(metaDataId)); ++ } else { ++ SoundUtils.setDefaultAudible(this, RingtoneManager.TYPE_NOTIFICATION); ++ } ++ File notifs = new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH); ++ if (notifs.exists() && notifs.isDirectory()) { ++ for (File f : notifs.listFiles()) { ++ FileUtils.setPermissions(f, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); ++ } ++ } ++ } ++ File ringtoneCache = new File(getCacheDir(), "/SoundsCache/ringtones/"); ++ if (ringtoneCache.exists() && ringtoneCache.isDirectory()) { ++ IOUtils.createRingtoneDirIfNotExists(); ++ File new_ring_mp3 = new File(getCacheDir(), "/SoundsCache/ringtones/ringtone.mp3"); ++ File new_ring_ogg = new File(getCacheDir(), "/SoundsCache/ringtones/ringtone.ogg"); ++ if (new_ring_ogg.exists()) { ++ IOUtils.bufferedCopy(new_ring_ogg, new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH + File.separator + "ringtone.ogg")); ++ int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_ringtone_metadata", "string", SUBSTRATUM_PACKAGE); ++ SoundUtils.setAudible(this, new File("/data/system/theme/audio/ringtones/ringtone.ogg"), ++ new File(notifCache.getAbsolutePath(), "ringtone.ogg"), ++ RingtoneManager.TYPE_RINGTONE, ++ getSubsContext().getString(metaDataId)); ++ } else if (new_ring_mp3.exists()) { ++ IOUtils.bufferedCopy(new_ring_mp3, new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH + File.separator + "ringtone.mp3")); ++ int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_ringtone_metadata", "string", SUBSTRATUM_PACKAGE); ++ SoundUtils.setAudible(this, new File("/data/system/theme/audio/ringtones/ringtone.mp3"), ++ new File(notifCache.getAbsolutePath(), "ringtone.mp3"), ++ RingtoneManager.TYPE_RINGTONE, ++ getSubsContext().getString(metaDataId)); ++ } else { ++ SoundUtils.setDefaultAudible(this, RingtoneManager.TYPE_RINGTONE); ++ } ++ File rings = new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH); ++ if (rings.exists() && rings.isDirectory()) { ++ for (File f : rings.listFiles()) { ++ FileUtils.setPermissions(f, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); ++ } ++ } ++ } ++ } ++ ++ private void clearSounds(Context ctx) { ++ IOUtils.deleteThemedAudio(); ++ SoundUtils.setDefaultAudible(JobService.this, RingtoneManager.TYPE_ALARM); ++ SoundUtils.setDefaultAudible(JobService.this, RingtoneManager.TYPE_NOTIFICATION); ++ SoundUtils.setDefaultAudible(JobService.this, RingtoneManager.TYPE_RINGTONE); ++ SoundUtils.setDefaultUISounds(getContentResolver(), "lock_sound", "Lock.ogg"); ++ SoundUtils.setDefaultUISounds(getContentResolver(), "unlock_sound", "Unlock.ogg"); ++ SoundUtils.setDefaultUISounds(getContentResolver(), "low_battery_sound", ++ "LowBattery.ogg"); ++ } ++ ++ private void copyBootAnimation(String fileName) { ++ try { ++ clearBootAnimation(); ++ File source = new File(fileName); ++ File dest = new File(IOUtils.SYSTEM_THEME_BOOTANIMATION_PATH); ++ IOUtils.bufferedCopy(source, dest); ++ source.delete(); ++ FileUtils.setPermissions(IOUtils.SYSTEM_THEME_BOOTANIMATION_PATH, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IROTH, -1, -1); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ private void clearBootAnimation() { ++ try { ++ File f = new File(IOUtils.SYSTEM_THEME_BOOTANIMATION_PATH); ++ if (f.exists()) { ++ f.delete(); ++ } ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ private void restartUi() { ++ try { ++ ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE); ++ Class ActivityManagerNative = Class.forName("android.app.ActivityManagerNative"); ++ Method getDefault = ActivityManagerNative.getDeclaredMethod("getDefault", null); ++ Object amn = getDefault.invoke(null, null); ++ Method killApplicationProcess = amn.getClass().getDeclaredMethod("killApplicationProcess", String.class, int.class); ++ stopService(new Intent().setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService"))); ++ am.killBackgroundProcesses("com.android.systemui"); ++ for (ActivityManager.RunningAppProcessInfo app : am.getRunningAppProcesses()) { ++ if ("com.android.systemui".equals(app.processName)) { ++ killApplicationProcess.invoke(amn, app.processName, app.uid); ++ break; ++ } ++ } ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ private void killPackage(String packageName) { ++ try { ++ ActivityManagerNative.getDefault().forceStopPackage(packageName, ++ UserHandle.USER_SYSTEM); ++ } catch (RemoteException e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ private Context getSubsContext() { ++ return getAppContext(SUBSTRATUM_PACKAGE); ++ } ++ ++ private Context getAppContext(String packageName) { ++ Context ctx = null; ++ try { ++ ctx = getApplicationContext().createPackageContext(packageName, ++ Context.CONTEXT_IGNORE_SECURITY); ++ } catch (NameNotFoundException e) { ++ e.printStackTrace(); ++ } ++ return ctx; ++ } ++ ++ public static void log(String msg) { ++ if (DEBUG) { ++ Log.e(TAG, msg); ++ } ++ } ++ ++ private boolean isCallerAuthorized(Intent intent) { ++ PendingIntent token = null; ++ try { ++ token = (PendingIntent) intent.getParcelableExtra(MASQUERADE_TOKEN); ++ } catch (Exception e) { ++ log("Attempt to start serivce without a token, unauthorized"); ++ } ++ if (token == null) { ++ return false; ++ } ++ // SECOND: we got a token, validate originating package ++ // if not in our whitelist, return null ++ String callingPackage = token.getCreatorPackage(); ++ boolean isValidPackage = false; ++ for (int i = 0; i < AUTHORIZED_CALLERS.length; i++) { ++ if (TextUtils.equals(callingPackage, AUTHORIZED_CALLERS[i])) { ++ log(callingPackage ++ + " is an authorized calling package, next validate calling package perms"); ++ isValidPackage = true; ++ break; ++ } ++ } ++ if (!isValidPackage) { ++ log(callingPackage + " is not an authorized calling package"); ++ return false; ++ } ++ return true; ++ } ++ ++ private class MainHandler extends Handler { ++ public static final int MSG_JOB_QUEUE_EMPTY = 1; ++ ++ public MainHandler(Looper looper) { ++ super(looper); ++ } ++ ++ @Override ++ public void handleMessage(Message msg) { ++ switch (msg.what) { ++ case MSG_JOB_QUEUE_EMPTY: ++ Intent intent = new Intent(INTENT_STATUS_CHANGED); ++ intent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_JOB_COMPLETE); ++ sendBroadcastAsUser(intent, UserHandle.ALL); ++ break; ++ } ++ } ++ } ++ ++ private class JobHandler extends Handler { ++ private static final int MESSAGE_CHECK_QUEUE = 1; ++ private static final int MESSAGE_DEQUEUE = 2; ++ ++ public JobHandler(Looper looper) { ++ super(looper); ++ } ++ ++ @Override ++ public void handleMessage(Message msg) { ++ switch (msg.what) { ++ case MESSAGE_CHECK_QUEUE: ++ Runnable job; ++ synchronized (mJobQueue) { ++ job = mJobQueue.get(0); ++ } ++ if (job != null) { ++ job.run(); ++ } ++ break; ++ case MESSAGE_DEQUEUE: ++ Runnable toRemove = (Runnable) msg.obj; ++ synchronized (mJobQueue) { ++ mJobQueue.remove(toRemove); ++ if (mJobQueue.size() > 0) { ++ this.sendEmptyMessage(MESSAGE_CHECK_QUEUE); ++ } else { ++ log("Job queue empty! All done"); ++ mMainHandler.sendEmptyMessage(MainHandler.MSG_JOB_QUEUE_EMPTY); ++ } ++ } ++ break; ++ default: ++ log("Unknown message " + msg.what); ++ break; ++ } ++ } ++ } ++ ++ private class StopPackageJob implements Runnable { ++ String mPackage; ++ ++ public void StopPackageJob(String _package) { ++ mPackage = _package; ++ } ++ ++ @Override ++ public void run() { ++ killPackage(mPackage); ++ log("Killed package " + mPackage); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ StopPackageJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class UiResetJob implements Runnable { ++ @Override ++ public void run() { ++ restartUi(); ++ log("Restarting SystemUI..."); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ UiResetJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class FontsJob implements Runnable { ++ boolean mClear; ++ String mPid; ++ String mFileName; ++ ++ public FontsJob(String pid, String fileName) { ++ if (pid == null) { ++ mClear = true; ++ } else { ++ mPid = pid; ++ mFileName = fileName; ++ } ++ } ++ ++ @Override ++ public void run() { ++ if (mClear) { ++ log("Resetting system font"); ++ clearFonts(); ++ } else { ++ log("Setting theme font"); ++ copyFonts(mPid, mFileName); ++ } ++ Intent intent = new Intent(INTENT_STATUS_CHANGED); ++ intent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_FONTS); ++ sendBroadcastAsUser(intent, UserHandle.ALL); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ FontsJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class SoundsJob implements Runnable { ++ boolean mClear; ++ String mPid; ++ String mFileName; ++ ++ public SoundsJob(String pid, String fileName) { ++ if (pid == null) { ++ mClear = true; ++ } else { ++ mPid = pid; ++ mFileName = fileName; ++ } ++ } ++ ++ @Override ++ public void run() { ++ if (mClear) { ++ log("Resetting system sounds"); ++ clearSounds(JobService.this); ++ } else { ++ log("Setting theme sounds"); ++ applyThemedSounds(mPid, mFileName); ++ } ++ Intent intent = new Intent(INTENT_STATUS_CHANGED); ++ intent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_AUDIO); ++ sendBroadcastAsUser(intent, UserHandle.ALL); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ SoundsJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class BootAnimationJob implements Runnable { ++ String mFileName; ++ final boolean mClear; ++ ++ public BootAnimationJob(boolean clear) { ++ mClear = true; ++ } ++ ++ public BootAnimationJob(String fileName) { ++ mFileName = fileName; ++ mClear = false; ++ } ++ ++ @Override ++ public void run() { ++ if (mClear) { ++ log("Resetting system boot animation"); ++ clearBootAnimation(); ++ } else { ++ log("Setting themed boot animation"); ++ copyBootAnimation(mFileName); ++ } ++ Intent intent = new Intent(INTENT_STATUS_CHANGED); ++ intent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_BOOTANIMATION); ++ sendBroadcastAsUser(intent, UserHandle.ALL); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ BootAnimationJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class Installer implements Runnable, IPackageInstallObserver2 { ++ String mPath; ++ ++ public Installer(String path) { ++ mPath = path; ++ } ++ ++ @Override ++ public IBinder asBinder() { ++ return null; ++ } ++ ++ @Override ++ public void onUserActionRequired(Intent intent) throws RemoteException { ++ log("Installer - user action required callback with " + mPath); ++ } ++ ++ @Override ++ public void onPackageInstalled(String basePackageName, int returnCode, String msg, ++ Bundle extras) throws RemoteException { ++ log("Installer - successfully installed " + basePackageName + " from " + mPath); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, Installer.this); ++ mJobHandler.sendMessage(message); ++ } ++ ++ @Override ++ public void run() { ++ log("Installer - installing " + mPath); ++ install(mPath, this); ++ } ++ } ++ ++ private class Remover implements Runnable { ++ String mPackage; ++ ++ public Remover(String _package) { ++ mPackage = _package; ++ } ++ ++ @Override ++ public void run() { ++ if (isOverlayEnabled(mPackage)) { ++ log("Remover - disabling overlay for " + mPackage); ++ disableOverlay(mPackage); ++ } ++ log("Remover - uninstalling " + mPackage); ++ uninstall(mPackage); ++ } ++ } ++ ++ private class LocaleChanger extends BroadcastReceiver implements Runnable { ++ private boolean mIsRegistered; ++ private boolean mDoRestore; ++ private Context mContext; ++ private Handler mHandler; ++ private Locale mCurrentLocale; ++ ++ public LocaleChanger(Context context, Handler mainHandler) { ++ mContext = context; ++ mHandler = mainHandler; ++ } ++ ++ @Override ++ public void run() { ++ Intent i = new Intent(Intent.ACTION_MAIN); ++ i.addCategory(Intent.CATEGORY_HOME); ++ mContext.startActivity(i); ++ mHandler.postDelayed(new Runnable() { ++ @Override ++ public void run() { ++ spoofLocale(); ++ } ++ }, 500); ++ } ++ ++ private void register() { ++ if (!mIsRegistered) { ++ IntentFilter filter = new IntentFilter(); ++ filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); ++ mContext.registerReceiver(LocaleChanger.this, filter); ++ mIsRegistered = true; ++ } ++ } ++ ++ private void unregister() { ++ if (mIsRegistered) { ++ mContext.unregisterReceiver(LocaleChanger.this); ++ mIsRegistered = false; ++ } ++ } ++ ++ private void spoofLocale() { ++ Configuration config; ++ log("LocaleChanger - spoofing locale for configuation change shim"); ++ try { ++ register(); ++ config = ActivityManagerNative.getDefault().getConfiguration(); ++ mCurrentLocale = config.locale; ++ Locale toSpoof = Locale.JAPAN; ++ if (mCurrentLocale == Locale.JAPAN) { ++ toSpoof = Locale.CHINA; ++ } ++ config.setLocale(toSpoof); ++ config.userSetLocale = true; ++ ActivityManagerNative.getDefault().updateConfiguration(config); ++ } catch (RemoteException e) { ++ e.printStackTrace(); ++ return; ++ } ++ } ++ ++ private void restoreLocale() { ++ Configuration config; ++ log("LocaleChanger - restoring original locale for configuation change shim"); ++ try { ++ unregister(); ++ config = ActivityManagerNative.getDefault().getConfiguration(); ++ config.setLocale(mCurrentLocale); ++ config.userSetLocale = true; ++ ActivityManagerNative.getDefault().updateConfiguration(config); ++ } catch (RemoteException e) { ++ e.printStackTrace(); ++ return; ++ } ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ LocaleChanger.this); ++ mJobHandler.sendMessage(message); ++ } ++ ++ @Override ++ public void onReceive(Context context, Intent intent) { ++ mHandler.postDelayed(new Runnable() { ++ @Override ++ public void run() { ++ restoreLocale(); ++ } ++ }, 500); ++ } ++ } ++ ++ private static class LocalIntentReceiver { ++ private final SynchronousQueue mResult = new SynchronousQueue<>(); ++ ++ private IIntentSender.Stub mLocalSender = new IIntentSender.Stub() { ++ @Override ++ public void send(int code, Intent intent, String resolvedType, ++ IIntentReceiver finishedReceiver, String requiredPermission, Bundle options) { ++ try { ++ mResult.offer(intent, 5, TimeUnit.SECONDS); ++ } catch (InterruptedException e) { ++ throw new RuntimeException(e); ++ } ++ } ++ }; ++ ++ public IntentSender getIntentSender() { ++ return new IntentSender((IIntentSender) mLocalSender); ++ } ++ ++ public Intent getResult() { ++ try { ++ return mResult.take(); ++ } catch (InterruptedException e) { ++ throw new RuntimeException(e); ++ } ++ } ++ } ++} +diff --git a/app/src/main/java/masquerade/substratum/services/MasqDemo.java b/app/src/main/java/masquerade/substratum/services/MasqDemo.java +new file mode 100644 +index 0000000..b00d6e0 +--- /dev/null ++++ b/app/src/main/java/masquerade/substratum/services/MasqDemo.java +@@ -0,0 +1,137 @@ ++ ++package masquerade.substratum.services; ++ ++import java.util.ArrayList; ++import java.util.List; ++ ++import android.app.PendingIntent; ++import android.content.BroadcastReceiver; ++import android.content.Context; ++import android.content.Intent; ++import android.text.TextUtils; ++ ++public class MasqDemo { ++ public static final String MASQUERADE_TOKEN = "masquerade_token"; ++ public static final String PRIMARY_COMMAND_KEY = "primary_command_key"; ++ public static final String JOB_TIME_KEY = "job_time_key"; ++ public static final String INSTALL_LIST_KEY = "install_list"; ++ public static final String UNINSTALL_LIST_KEY = "uninstall_list"; ++ public static final String WITH_RESTART_UI_KEY = "with_restart_ui"; ++ public static final String BOOTANIMATION_PID_KEY = "bootanimation_pid"; ++ public static final String BOOTANIMATION_FILE_NAME = "bootanimation_file_name"; ++ public static final String FONTS_PID = "fonts_pid"; ++ public static final String FONTS_FILENAME = "fonts_filename"; ++ public static final String AUDIO_PID = "audio_pid"; ++ public static final String AUDIO_FILENAME = "audio_filename"; ++ public static final String COMMAND_VALUE_INSTALL = "install"; ++ public static final String COMMAND_VALUE_UNINSTALL = "uninstall"; ++ public static final String COMMAND_VALUE_RESTART_UI = "restart_ui"; ++ public static final String COMMAND_VALUE_CONFIGURATION_SHIM = "configuration_shim"; ++ public static final String COMMAND_VALUE_BOOTANIMATION = "bootanimation"; ++ public static final String COMMAND_VALUE_FONTS = "fonts"; ++ public static final String COMMAND_VALUE_AUDIO = "audio"; ++ public static final String INTENT_STATUS_CHANGED = "masquerade.substratum.STATUS_CHANGED"; ++ public static final String COMMAND_VALUE_JOB_COMPLETE = "job_complete"; ++ ++ class MasqReceiver extends BroadcastReceiver { ++ @Override ++ public void onReceive(Context context, Intent intent) { ++ if (TextUtils.equals(intent.getAction(), INTENT_STATUS_CHANGED)) { ++ String command = intent.getStringExtra(PRIMARY_COMMAND_KEY); ++ if (TextUtils.equals(command, COMMAND_VALUE_FONTS)) { ++ // update ui, dismiss progress dialog, etc ++ } else if (TextUtils.equals(command, COMMAND_VALUE_BOOTANIMATION)) { ++ ++ } else if (TextUtils.equals(command, COMMAND_VALUE_AUDIO)) { ++ ++ } else if (TextUtils.equals(command, COMMAND_VALUE_JOB_COMPLETE)) { ++ ++ } ++ } ++ } ++ } ++ ++ // demo code for building a base intent for JobService commands ++ public static Intent getMasqIntent(Context ctx) { ++ Intent intent = new Intent(); ++ intent.setClassName("masquerade.substratum", "masquerade.substratum.services.JobService"); ++ // Credit StackOverflow http://stackoverflow.com/a/28132098 ++ // Use dummy PendingIntent for service to validate caller at onBind ++ PendingIntent pending = PendingIntent.getActivity(ctx, 0, new Intent(), 0); ++ intent.putExtra(MASQUERADE_TOKEN, pending); ++ intent.putExtra(JOB_TIME_KEY, System.currentTimeMillis()); ++ return intent; ++ } ++ ++ public static void install(Context context, ArrayList overlay_apks) { ++ // populate list however ++ Intent masqIntent = getMasqIntent(context); ++ masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_INSTALL); ++ masqIntent.putExtra(INSTALL_LIST_KEY, overlay_apks); ++ context.startService(masqIntent); ++ } ++ ++ public static void uninstall(Context context, ArrayList packages_to_remove) { ++ Intent masqIntent = getMasqIntent(context); ++ masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_UNINSTALL); ++ masqIntent.putExtra(UNINSTALL_LIST_KEY, packages_to_remove); ++ // only need to set if true, will restart SystemUI when done processing packages ++ masqIntent.putExtra(WITH_RESTART_UI_KEY, true); ++ context.startService(masqIntent); ++ } ++ ++ public static void restartSystemUI(Context context) { ++ Intent masqIntent = getMasqIntent(context); ++ masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_RESTART_UI); ++ context.startService(masqIntent); ++ } ++ ++ public static void configurationChangeShim(Context context) { ++ Intent masqIntent = getMasqIntent(context); ++ masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_CONFIGURATION_SHIM); ++ context.startService(masqIntent); ++ } ++ ++ public static void clearThemedBootAnimation(Context context) { ++ applyThemedBootAnimation(context, null); ++ } ++ ++ public static void applyThemedBootAnimation(Context context, String fileName) { ++ Intent masqIntent = getMasqIntent(context); ++ masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_BOOTANIMATION); ++ if (fileName != null) { ++ masqIntent.putExtra(BOOTANIMATION_FILE_NAME, fileName); ++ } else { ++ // nothing. to reset to stock, just don't add PID and FILE ++ } ++ context.startService(masqIntent); ++ } ++ ++ public static void clearThemedFont(Context context) { ++ applyThemedFont(context, null, null); ++ } ++ ++ public static void applyThemedFont(Context context, String pid, String fileName) { ++ Intent masqIntent = getMasqIntent(context); ++ masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_FONTS); ++ if (pid != null) { ++ masqIntent.putExtra(FONTS_PID, pid); ++ masqIntent.putExtra(FONTS_FILENAME, fileName); ++ } ++ context.startService(masqIntent); ++ } ++ ++ public static void clearThemedSounds(Context context) { ++ applyThemedSounds(context, null, null); ++ } ++ ++ public static void applyThemedSounds(Context context, String pid, String fileName) { ++ Intent masqIntent = getMasqIntent(context); ++ masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_AUDIO); ++ if (pid != null) { ++ masqIntent.putExtra(AUDIO_PID, pid); ++ masqIntent.putExtra(AUDIO_FILENAME, fileName); ++ } ++ context.startService(masqIntent); ++ } ++} +diff --git a/app/src/main/java/masquerade/substratum/util/Helper.java b/app/src/main/java/masquerade/substratum/util/Helper.java +deleted file mode 100644 +index cccf493..0000000 +--- a/app/src/main/java/masquerade/substratum/util/Helper.java ++++ /dev/null +@@ -1,113 +0,0 @@ +-package masquerade.substratum.util; +- +-import android.app.PendingIntent; +-import android.content.BroadcastReceiver; +-import android.content.Context; +-import android.content.Intent; +-import android.os.Handler; +-import android.text.TextUtils; +-import android.util.Log; +- +-public class Helper extends BroadcastReceiver { +- +- private static final String SUBSTRATUM_PACKAGE = "projekt.substratum"; +- private static final String MASQUERADE_TOKEN = "masquerade_token"; +- private static final String[] AUTHORIZED_CALLERS = new String[]{ +- SUBSTRATUM_PACKAGE, +- "masquerade.substratum" +- }; +- +- @Override +- public void onReceive(Context context, Intent intent) { +- if (!isCallerAuthorized(intent)) { +- Log.d("Masquerade", "Caller not authorized"); +- return; +- } +- Log.d("Masquerade", +- "BroadcastReceiver has accepted Substratum's commands and is running now..."); +- Root.requestRootAccess(); +- +- if (intent.getStringExtra("substratum-check") != null) { +- if (intent.getStringExtra("substratum-check").equals("masquerade-ball")) { +- Intent runCommand = new Intent(); +- runCommand.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); +- runCommand.setAction("projekt.substratum.MASQUERADE_BALL"); +- runCommand.putExtra("substratum-check", "masquerade-ball"); +- context.sendBroadcast(runCommand); +- Log.d("Masquerade", "BroadcastReceiver was triggered to check for system " + +- "integrity and service activation."); +- } +- } else if (intent.getStringArrayListExtra("pm-uninstall") != null) { +- new Uninstaller().uninstall(intent, "pm-uninstall", false, +- intent.getBooleanExtra("restart_systemui", false)); +- } else if (intent.getStringArrayListExtra("pm-uninstall-specific") != null) { +- new Uninstaller().uninstall(intent, "pm-uninstall-specific", true, +- intent.getBooleanExtra("restart_systemui", false)); +- } else if (intent.getStringArrayListExtra("icon-handler") != null) { +- String icon_pack_name = intent.getStringArrayListExtra("icon-handler").get(0); +- String main_delay = intent.getStringArrayListExtra("icon-handler").get(2); +- String delay_one = intent.getStringArrayListExtra("icon-handler").get(3); +- String delay_two = intent.getStringArrayListExtra("icon-handler").get(4); +- final String bypass = intent.getStringArrayListExtra("icon-handler").get(5); +- if (bypass == null) { +- if (intent.getStringArrayListExtra("icon-handler").get(1).contains("pm") || +- intent.getStringArrayListExtra("icon-handler").get(1).contains("om") || +- intent.getStringArrayListExtra("icon-handler").get(1).contains("overlay")) { +- Log.d("Masquerade", "Running command: \"" + +- intent.getStringArrayListExtra("icon-handler").get(1) + "\""); +- Root.runCommand(intent.getStringArrayListExtra("icon-handler").get(1)); +- } +- } +- final Context mContext = context; +- final String icon_pack = icon_pack_name; +- final String delay_one_time = delay_one; +- final String delay_two_time = delay_two; +- final Handler handle = new Handler(); +- handle.postDelayed(new Runnable() { +- @Override +- public void run() { +- new IconPackApplicator().apply( +- mContext, icon_pack, delay_one_time, delay_two_time, bypass == null); +- } +- }, Integer.parseInt(main_delay)); +- } else if (intent.getStringExtra("om-commands") != null) { +- if (intent.getStringExtra("om-commands").contains("pm") || +- intent.getStringExtra("om-commands").contains("om") || +- intent.getStringExtra("om-commands").contains("overlay")) { +- Log.d("Masquerade", "Running command: \"" + +- intent.getStringExtra("om-commands") + "\""); +- Root.runCommand(intent.getStringExtra("om-commands")); +- } +- } +- } +- +- private boolean isCallerAuthorized(Intent intent) { +- PendingIntent token = null; +- try { +- token = intent.getParcelableExtra(MASQUERADE_TOKEN); +- } catch (Exception e) { +- Log.d("Masquerade", "Attempt to start service without a token, unauthorized"); +- } +- if (token == null) { +- return false; +- } +- // SECOND: we got a token, validate originating package +- // if not in our white list, return null +- String callingPackage = token.getCreatorPackage(); +- boolean isValidPackage = false; +- for (int i = 0; i < AUTHORIZED_CALLERS.length; i++) { +- if (TextUtils.equals(callingPackage, AUTHORIZED_CALLERS[i])) { +- Log.d("Masquerade", callingPackage +- + " is an authorized calling package, next validate calling package perms"); +- isValidPackage = true; +- break; +- } +- } +- if (!isValidPackage) { +- Log.d("Masquerade", callingPackage +- + " is not an authorized calling package"); +- return false; +- } +- return true; +- } +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/util/IconPackApplicator.java b/app/src/main/java/masquerade/substratum/util/IconPackApplicator.java +deleted file mode 100644 +index fb5d682..0000000 +--- a/app/src/main/java/masquerade/substratum/util/IconPackApplicator.java ++++ /dev/null +@@ -1,136 +0,0 @@ +-package masquerade.substratum.util; +- +-import android.content.Context; +-import android.content.Intent; +-import android.content.pm.PackageManager; +-import android.content.res.Resources; +-import android.os.Handler; +-import android.util.Log; +-import android.widget.Toast; +- +-import java.util.Locale; +- +-class IconPackApplicator { +- +- private Context mContext; +- private String iconPackName; +- private String toast_text = null; +- private int delayOne, delayTwo; +- private Boolean bypass; +- +- private static void grantPermission(final String packager, final String permission) { +- Root.runCommand("pm grant " + packager + " " + permission); +- } +- +- void apply(Context mContext, String iconPackName, String delayOne, String delayTwo, +- Boolean bypass) { +- this.mContext = mContext; +- this.iconPackName = iconPackName; +- this.delayOne = Integer.parseInt(delayOne); +- this.delayTwo = Integer.parseInt(delayTwo); +- this.bypass = bypass; +- iconInjector(); +- } +- +- private boolean checkChangeConfigurationPermissions() { +- String permission = "android.permission.CHANGE_CONFIGURATION"; +- int res = mContext.checkCallingOrSelfPermission(permission); +- return (res == PackageManager.PERMISSION_GRANTED); +- } +- +- private void iconInjector() { +- if (!checkChangeConfigurationPermissions()) { +- Log.e("Masquerade", "Masquerade was not granted " + +- "CHANGE_CONFIGURATION permissions, allowing now..."); +- grantPermission("masquerade.substratum", +- "android.permission.CHANGE_CONFIGURATION"); +- } else { +- Log.d("Masquerade", +- "Masquerade already granted CHANGE_CONFIGURATION permissions!"); +- } +- try { +- // Move home, since this is where we want our config code affected +- Intent i = new Intent(Intent.ACTION_MAIN); +- i.addCategory(Intent.CATEGORY_HOME); +- mContext.startActivity(i); +- +- // Take a fragment of memory to remember what the user's default config is +- final Locale current_locale = mContext.getResources().getConfiguration().locale; +- Locale to_be_changed = Locale.JAPAN; +- // There are definitely Japanese locale users using our app, so we should take +- // account for these people and switch to Chinese for 2 seconds. +- if (current_locale == Locale.JAPAN) { +- to_be_changed = Locale.CHINA; +- } +- final Locale changer = to_be_changed; +- +- // Reflect back to framework and cause the language to change, we need this! +- Class activityManagerNative = Class.forName("android.app.ActivityManagerNative"); +- final Object am = activityManagerNative.getMethod("getDefault").invoke +- (activityManagerNative); +- final Object config = am.getClass().getMethod("getConfiguration").invoke(am); +- +- // Sniff Substratum's Resources +- try { +- Context otherContext = mContext.createPackageContext("projekt.substratum", 0); +- Resources resources = otherContext.getResources(); +- if (bypass) { +- int toast = resources.getIdentifier("studio_applied_toast", "string", +- "projekt.substratum"); +- toast_text = String.format(resources.getString(toast), iconPackName); +- } else { +- int toast = resources.getIdentifier("studio_configuration_changed", "string", +- "projekt.substratum"); +- toast_text = resources.getString(toast); +- } +- } catch (Exception e) { +- // Suppress warning +- } +- +- // First window refresh to kick the change on the home screen +- final Handler handle = new Handler(); +- handle.postDelayed(new Runnable() { +- @Override +- public void run() { +- try { +- config.getClass().getDeclaredField( +- "locale").set(config, changer); +- config.getClass().getDeclaredField( +- "userSetLocale").setBoolean(config, true); +- +- am.getClass().getMethod("updateConfiguration", +- android.content.res.Configuration.class).invoke(am, config); +- +- // Change the locale back to pre-icon pack application +- final Handler handler = new Handler(); +- handler.postDelayed(new Runnable() { +- @Override +- public void run() { +- try { +- config.getClass().getDeclaredField("locale").set( +- config, current_locale); +- config.getClass().getDeclaredField("userSetLocale") +- .setBoolean(config, true); +- +- am.getClass().getMethod("updateConfiguration", +- android.content.res.Configuration +- .class).invoke(am, config); +- +- if (toast_text != null) +- Toast.makeText( +- mContext, toast_text, Toast.LENGTH_SHORT).show(); +- } catch (Exception e) { +- // Suppress warning +- } +- } +- }, delayTwo); // 2 second delay for Home refresh +- } catch (Exception e) { +- // Suppress warning +- } +- } +- }, delayOne); // 1 second delay for Home refresh +- } catch (Exception e) { +- e.printStackTrace(); +- } +- } +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/util/ReadOverlaysFile.java b/app/src/main/java/masquerade/substratum/util/ReadOverlaysFile.java +deleted file mode 100644 +index 2909ea9..0000000 +--- a/app/src/main/java/masquerade/substratum/util/ReadOverlaysFile.java ++++ /dev/null +@@ -1,46 +0,0 @@ +-package masquerade.substratum.util; +- +-import android.os.Environment; +- +-import java.io.BufferedReader; +-import java.io.File; +-import java.io.FileReader; +-import java.io.IOException; +-import java.util.ArrayList; +-import java.util.List; +- +-public class ReadOverlaysFile { +- +- public static List main(String argv[]) { +- +- File current_overlays = new File(Environment +- .getExternalStorageDirectory().getAbsolutePath() + +- "/.substratum/current_overlays.xml"); +- if (current_overlays.exists()) { +- Root.runCommand("rm " + Environment +- .getExternalStorageDirectory().getAbsolutePath() + +- "/.substratum/current_overlays.xml"); +- } +- Root.runCommand("cp /data/system/overlays.xml " + +- Environment +- .getExternalStorageDirectory().getAbsolutePath() + +- "/.substratum/current_overlays.xml"); +- +- File file = new File(argv[0]); +- int state_count = Integer.parseInt(argv[1]); +- +- List list = new ArrayList<>(); +- +- try (BufferedReader br = new BufferedReader(new FileReader(file))) { +- for (String line; (line = br.readLine()) != null; ) { +- if (line.contains("state=\"" + state_count + "\"")) { +- String[] split = line.substring(21).split("\\s+"); +- list.add(split[0].substring(1, split[0].length() - 1)); +- } +- } +- } catch (IOException ioe) { +- // Exception +- } +- return list; +- } +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/util/Root.java b/app/src/main/java/masquerade/substratum/util/Root.java +deleted file mode 100644 +index 7c80720..0000000 +--- a/app/src/main/java/masquerade/substratum/util/Root.java ++++ /dev/null +@@ -1,83 +0,0 @@ +-package masquerade.substratum.util; +- +-import java.io.BufferedReader; +-import java.io.BufferedWriter; +-import java.io.IOException; +-import java.io.InputStreamReader; +-import java.io.OutputStreamWriter; +- +-public class Root { +- +- private static SU su; +- +- public static boolean requestRootAccess() { +- SU su = getSU(); +- su.runCommand("echo /testRoot/"); +- return !su.denied; +- } +- +- public static String runCommand(String command) { +- return getSU().runCommand(command); +- } +- +- private static SU getSU() { +- if (su == null) su = new SU(); +- else if (su.closed || su.denied) su = new SU(); +- return su; +- } +- +- private static class SU { +- +- private Process process; +- private BufferedWriter bufferedWriter; +- private BufferedReader bufferedReader; +- private boolean closed; +- private boolean denied; +- private boolean firstTry; +- +- SU() { +- try { +- firstTry = true; +- process = Runtime.getRuntime().exec("su"); +- bufferedWriter = new BufferedWriter(new OutputStreamWriter(process +- .getOutputStream())); +- bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream +- ())); +- } catch (IOException e) { +- denied = true; +- closed = true; +- } +- } +- +- synchronized String runCommand(final String command) { +- try { +- StringBuilder sb = new StringBuilder(); +- String callback = "/shellCallback/"; +- bufferedWriter.write(command + "\necho " + callback + "\n"); +- bufferedWriter.flush(); +- +- int i; +- char[] buffer = new char[256]; +- while (true) { +- sb.append(buffer, 0, bufferedReader.read(buffer)); +- if ((i = sb.indexOf(callback)) > -1) { +- sb.delete(i, i + callback.length()); +- break; +- } +- } +- firstTry = false; +- return sb.toString().trim(); +- } catch (IOException e) { +- closed = true; +- e.printStackTrace(); +- if (firstTry) denied = true; +- } catch (ArrayIndexOutOfBoundsException e) { +- denied = true; +- } catch (Exception e) { +- e.printStackTrace(); +- denied = true; +- } +- return null; +- } +- } +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/util/Uninstaller.java b/app/src/main/java/masquerade/substratum/util/Uninstaller.java +deleted file mode 100644 +index 4b1b056..0000000 +--- a/app/src/main/java/masquerade/substratum/util/Uninstaller.java ++++ /dev/null +@@ -1,107 +0,0 @@ +-package masquerade.substratum.util; +- +-import android.content.Intent; +-import android.os.AsyncTask; +-import android.os.Environment; +-import android.util.Log; +- +-import java.util.ArrayList; +-import java.util.List; +- +-class Uninstaller { +- +- private Intent mIntent; +- private String uninstallString; +- private boolean specific; +- private boolean restartSystemUI; +- +- void uninstall(Intent mIntent, String uninstallString, +- boolean specific, boolean restartSystemUI) { +- this.mIntent = mIntent; +- this.uninstallString = uninstallString; +- this.specific = specific; +- this.restartSystemUI = restartSystemUI; +- new UninstallAsync().execute(""); +- } +- +- private class UninstallAsync extends AsyncTask { +- +- @Override +- protected String doInBackground(String... sUrl) { +- uninstall_handler(mIntent, uninstallString, specific, restartSystemUI); +- return null; +- } +- +- private void uninstall_handler(Intent intent, String inheritor, +- boolean specific, boolean restartSystemUI) { +- try { +- String final_commands_disable = ""; +- String final_commands_uninstall = ""; +- +- Root.runCommand( +- "pm grant masquerade.substratum android.permission.READ_EXTERNAL_STORAGE"); +- Root.runCommand( +- "pm grant masquerade.substratum android.permission.WRITE_EXTERNAL_STORAGE"); +- +- ArrayList packages_to_uninstall = +- new ArrayList<>(intent.getStringArrayListExtra(inheritor)); +- String[] state5initial = {Environment.getExternalStorageDirectory() +- .getAbsolutePath() + +- "/.substratum/current_overlays.xml", "5"}; +- List state5overlays = ReadOverlaysFile.main(state5initial); +- +- for (int i = 0; i < packages_to_uninstall.size(); i++) { +- String current = packages_to_uninstall.get(i); +- +- Log.d("Masquerade", "Intent received to purge referendum package file \"" + +- current + "\""); +- if (state5overlays.contains(packages_to_uninstall.get(i))) { +- Log.d("Masquerade", "Package file \"" + current + +- "\" requires an overlay disable prior to uninstall..."); +- if (final_commands_disable.length() == 0) { +- final_commands_disable = "om disable " + current; +- } else { +- final_commands_disable = final_commands_disable + " " + current; +- } +- +- if (final_commands_uninstall.length() == 0) { +- final_commands_uninstall = "pm uninstall " + current; +- } else { +- final_commands_uninstall = final_commands_uninstall + +- " && pm uninstall " + current; +- } +- } else { +- Log.d("Masquerade", "\"" + current + +- "\" has been redirected to the package manager in " + +- "preparations of removal..."); +- Root.runCommand("pm uninstall " + current); +- } +- } +- +- if (final_commands_disable.length() > 0) { +- Log.d("Masquerade", "Disable commands: " + final_commands_disable); +- Root.runCommand(final_commands_disable); +- } +- if (final_commands_uninstall.length() > 0) { +- Log.d("Masquerade", "Uninstall commands: " + final_commands_uninstall); +- Root.runCommand(final_commands_uninstall); +- } +- +- if (restartSystemUI) { +- Root.runCommand("pkill com.android.systemui"); +- } +- +- if (!specific) { +- // Clear the resource idmapping files generated by OMS +- Log.d("Masquerade", "Cleaning up resource-cache directory..."); +- Root.runCommand("rm /data/resource-cache/*"); +- // Now clear the persistent overlays database +- Log.d("Masquerade", "Finalizing clean up of persistent overlays database..."); +- Root.runCommand("rm -rf /data/system/overlays.xml"); +- } +- } catch (Exception e) { +- e.printStackTrace(); +- } +- } +- } +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/utils/IOUtils.java b/app/src/main/java/masquerade/substratum/utils/IOUtils.java +new file mode 100644 +index 0000000..092c58c +--- /dev/null ++++ b/app/src/main/java/masquerade/substratum/utils/IOUtils.java +@@ -0,0 +1,170 @@ ++ ++package masquerade.substratum.utils; ++ ++import java.io.BufferedInputStream; ++import java.io.BufferedOutputStream; ++import java.io.File; ++import java.io.FileInputStream; ++import java.io.FileNotFoundException; ++import java.io.FileOutputStream; ++import java.io.InputStream; ++import java.io.OutputStream; ++import java.util.zip.ZipEntry; ++import java.util.zip.ZipInputStream; ++ ++import android.os.FileUtils; ++ ++public class IOUtils { ++ public static final String SYSTEM_THEME_PATH = "/data/system/theme"; ++ public static final String SYSTEM_THEME_FONT_PATH = SYSTEM_THEME_PATH + File.separator ++ + "fonts"; ++ public static final String SYSTEM_THEME_AUDIO_PATH = SYSTEM_THEME_PATH + File.separator ++ + "audio"; ++ public static final String SYSTEM_THEME_RINGTONE_PATH = SYSTEM_THEME_AUDIO_PATH ++ + File.separator + "ringtones"; ++ public static final String SYSTEM_THEME_NOTIFICATION_PATH = SYSTEM_THEME_AUDIO_PATH ++ + File.separator + "notifications"; ++ public static final String SYSTEM_THEME_ALARM_PATH = SYSTEM_THEME_AUDIO_PATH ++ + File.separator + "alarms"; ++ public static final String SYSTEM_THEME_UI_SOUNDS_PATH = SYSTEM_THEME_AUDIO_PATH ++ + File.separator + "ui"; ++ public static final String SYSTEM_THEME_BOOTANIMATION_PATH = SYSTEM_THEME_PATH + File.separator ++ + "bootanimation.zip"; ++ ++ public static boolean dirExists(String dirPath) { ++ final File dir = new File(dirPath); ++ return dir.exists() && dir.isDirectory(); ++ } ++ ++ public static void createDirIfNotExists(String dirPath) { ++ if (!dirExists(dirPath)) { ++ File dir = new File(dirPath); ++ if (dir.mkdir()) { ++ FileUtils.setPermissions(dir, FileUtils.S_IRWXU | ++ FileUtils.S_IRWXG | FileUtils.S_IROTH | FileUtils.S_IXOTH, -1, -1); ++ } ++ } ++ } ++ ++ public static void createFontDirIfNotExists() { ++ createDirIfNotExists(SYSTEM_THEME_FONT_PATH); ++ } ++ ++ public static void createAudioDirIfNotExists() { ++ createDirIfNotExists(SYSTEM_THEME_AUDIO_PATH); ++ } ++ ++ public static void createRingtoneDirIfNotExists() { ++ createDirIfNotExists(SYSTEM_THEME_RINGTONE_PATH); ++ } ++ ++ public static void createNotificationDirIfNotExists() { ++ createDirIfNotExists(SYSTEM_THEME_NOTIFICATION_PATH); ++ } ++ ++ public static void createAlarmDirIfNotExists() { ++ createDirIfNotExists(SYSTEM_THEME_ALARM_PATH); ++ } ++ ++ public static void createUiSoundsDirIfNotExists() { ++ createDirIfNotExists(SYSTEM_THEME_UI_SOUNDS_PATH); ++ } ++ ++ public static void deleteThemedFonts() { ++ try { ++ deleteRecursive(new File(SYSTEM_THEME_FONT_PATH)); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ public static void deleteThemedAudio() { ++ try { ++ deleteRecursive(new File(SYSTEM_THEME_UI_SOUNDS_PATH)); ++ deleteRecursive(new File(SYSTEM_THEME_RINGTONE_PATH)); ++ deleteRecursive(new File(SYSTEM_THEME_NOTIFICATION_PATH)); ++ deleteRecursive(new File(SYSTEM_THEME_ALARM_PATH)); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ public static void copyFolder(String source, String dest) { ++ File dir = new File(source); ++ File[] files = dir.listFiles(); ++ for (File file : files) { ++ try { ++ String sourceFile = dir + File.separator + file.getName(); ++ String destinationFile = dest + File.separator + file.getName(); ++ bufferedCopy(new File(sourceFile), new File(destinationFile)); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ } ++ ++ public static void unzip(String source, String destination) { ++ try (ZipInputStream inputStream = new ZipInputStream( ++ new BufferedInputStream(new FileInputStream(source)))) { ++ ZipEntry zipEntry; ++ int count; ++ byte[] buffer = new byte[8192]; ++ while ((zipEntry = inputStream.getNextEntry()) != null) { ++ File file = new File(destination, zipEntry.getName()); ++ File dir = zipEntry.isDirectory() ? file : file.getParentFile(); ++ if (!dir.isDirectory() && !dir.mkdirs()) ++ throw new FileNotFoundException("Failed to ensure directory: " + ++ dir.getAbsolutePath()); ++ if (zipEntry.isDirectory()) ++ continue; ++ try (FileOutputStream outputStream = new FileOutputStream(file)) { ++ while ((count = inputStream.read(buffer)) != -1) ++ outputStream.write(buffer, 0, count); ++ } ++ } ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ public static void bufferedCopy(String source, String dest) { ++ try { ++ bufferedCopy(new FileInputStream(source), new FileOutputStream(dest)); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ public static void bufferedCopy(File source, File dest) { ++ try { ++ bufferedCopy(new FileInputStream(source), new FileOutputStream(dest)); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ public static void bufferedCopy(InputStream source, OutputStream dest) { ++ try { ++ BufferedInputStream in = new BufferedInputStream(source); ++ BufferedOutputStream out = new BufferedOutputStream(dest); ++ byte[] buff = new byte[32 * 1024]; ++ int len; ++ while ((len = in.read(buff)) > 0) { ++ out.write(buff, 0, len); ++ } ++ in.close(); ++ out.close(); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ public static void deleteRecursive(File fileOrDirectory) { ++ if (fileOrDirectory.isDirectory()) ++ for (File child : fileOrDirectory.listFiles()) ++ deleteRecursive(child); ++ ++ fileOrDirectory.delete(); ++ } ++ ++} +diff --git a/app/src/main/java/masquerade/substratum/utils/SoundUtils.java b/app/src/main/java/masquerade/substratum/utils/SoundUtils.java +new file mode 100644 +index 0000000..72c6052 +--- /dev/null ++++ b/app/src/main/java/masquerade/substratum/utils/SoundUtils.java +@@ -0,0 +1,210 @@ ++ ++package masquerade.substratum.utils; ++ ++import java.io.File; ++import java.util.Arrays; ++ ++import android.content.ContentResolver; ++import android.content.ContentValues; ++import android.content.Context; ++import android.database.Cursor; ++import android.media.RingtoneManager; ++import android.net.Uri; ++import android.os.SystemProperties; ++import android.os.UserHandle; ++import android.provider.MediaStore; ++import android.util.Log; ++import android.provider.Settings; ++ ++public class SoundUtils { ++ private static final String SYSTEM_MEDIA_PATH = "/system/media/audio"; ++ private static final String SYSTEM_ALARMS_PATH = ++ SYSTEM_MEDIA_PATH + File.separator + "alarms"; ++ private static final String SYSTEM_RINGTONES_PATH = ++ SYSTEM_MEDIA_PATH + File.separator + "ringtones"; ++ private static final String SYSTEM_NOTIFICATIONS_PATH = ++ SYSTEM_MEDIA_PATH + File.separator + "notifications"; ++ private static final String MEDIA_CONTENT_URI = "content://media/internal/audio/media"; ++ ++ public static void updateGlobalSettings(ContentResolver resolver, String uri, String val) { ++ Settings.Global.putStringForUser(resolver, uri, val, UserHandle.USER_ALL); ++ } ++ ++ public static boolean setUISounds(ContentResolver resolver, String sound_name, String location) { ++ if (allowedUISound(sound_name)) { ++ updateGlobalSettings(resolver, sound_name, location); ++ return true; ++ } ++ return false; ++ } ++ ++ public static void setDefaultUISounds(ContentResolver resolver, String sound_name, ++ String sound_file) { ++ updateGlobalSettings(resolver, sound_name, "/system/media/audio/ui/" + sound_file); ++ } ++ ++ // This string array contains all the SystemUI acceptable sound files ++ public static Boolean allowedUISound(String targetValue) { ++ String[] allowed_themable = { ++ "lock_sound", ++ "unlock_sound", ++ "low_battery_sound" ++ }; ++ return Arrays.asList(allowed_themable).contains(targetValue); ++ } ++ ++ public static String getDefaultAudiblePath(int type) { ++ final String name; ++ final String path; ++ switch (type) { ++ case RingtoneManager.TYPE_ALARM: ++ name = SystemProperties.get("ro.config.alarm_alert"); ++ path = name != null ? SYSTEM_ALARMS_PATH + File.separator + name : null; ++ break; ++ case RingtoneManager.TYPE_NOTIFICATION: ++ name = SystemProperties.get("ro.config.notification_sound"); ++ path = name != null ? SYSTEM_NOTIFICATIONS_PATH + File.separator + name : null; ++ break; ++ case RingtoneManager.TYPE_RINGTONE: ++ name = SystemProperties.get("ro.config.ringtone"); ++ path = name != null ? SYSTEM_RINGTONES_PATH + File.separator + name : null; ++ break; ++ default: ++ path = null; ++ break; ++ } ++ return path; ++ } ++ ++ public static void clearAudibles(Context context, String audiblePath) { ++ final File audibleDir = new File(audiblePath); ++ if (audibleDir.exists() && audibleDir.isDirectory()) { ++ String[] files = audibleDir.list(); ++ final ContentResolver resolver = context.getContentResolver(); ++ for (String s : files) { ++ final String filePath = audiblePath + File.separator + s; ++ Uri uri = MediaStore.Audio.Media.getContentUriForPath(filePath); ++ resolver.delete(uri, MediaStore.MediaColumns.DATA + "=\"" ++ + filePath + "\"", null); ++ boolean deleted = (new File(filePath)).delete(); ++ if (deleted) ++ Log.e("SoundsHandler", "Database cleared"); ++ } ++ } ++ } ++ ++ public static boolean setAudible(Context context, File ringtone, File ringtoneCache, int type, ++ String name) { ++ final String path = ringtone.getAbsolutePath(); ++ final String mimeType = name.endsWith(".ogg") ? "application/ogg" : "application/mp3"; ++ ContentValues values = new ContentValues(); ++ values.put(MediaStore.MediaColumns.DATA, path); ++ values.put(MediaStore.MediaColumns.TITLE, name); ++ values.put(MediaStore.MediaColumns.MIME_TYPE, mimeType); ++ values.put(MediaStore.MediaColumns.SIZE, ringtoneCache.length()); ++ values.put(MediaStore.Audio.Media.IS_RINGTONE, type == RingtoneManager.TYPE_RINGTONE); ++ values.put(MediaStore.Audio.Media.IS_NOTIFICATION, ++ type == RingtoneManager.TYPE_NOTIFICATION); ++ values.put(MediaStore.Audio.Media.IS_ALARM, type == RingtoneManager.TYPE_ALARM); ++ values.put(MediaStore.Audio.Media.IS_MUSIC, false); ++ ++ Uri uri = MediaStore.Audio.Media.getContentUriForPath(path); ++ Uri newUri = null; ++ Cursor c = context.getContentResolver().query(uri, ++ new String[] { ++ MediaStore.MediaColumns._ID ++ }, ++ MediaStore.MediaColumns.DATA + "='" + path + "'", ++ null, null); ++ if (c != null && c.getCount() > 0) { ++ c.moveToFirst(); ++ long id = c.getLong(0); ++ c.close(); ++ newUri = Uri.withAppendedPath(Uri.parse(MEDIA_CONTENT_URI), "" + id); ++ context.getContentResolver().update(uri, values, ++ MediaStore.MediaColumns._ID + "=" + id, null); ++ } ++ if (newUri == null) ++ newUri = context.getContentResolver().insert(uri, values); ++ try { ++ RingtoneManager.setActualDefaultRingtoneUri(context, type, newUri); ++ } catch (Exception e) { ++ return false; ++ } ++ return true; ++ } ++ ++ public static boolean setUIAudible(Context context, File localized_ringtone, ++ File ringtone_file, int type, String name) { ++ final String path = ringtone_file.getAbsolutePath(); ++ ++ final String path_clone = "/system/media/audio/ui/" + name + ".ogg"; ++ ++ ContentValues values = new ContentValues(); ++ values.put(MediaStore.MediaColumns.DATA, path); ++ values.put(MediaStore.MediaColumns.TITLE, name); ++ values.put(MediaStore.MediaColumns.MIME_TYPE, "application/ogg"); ++ values.put(MediaStore.MediaColumns.SIZE, localized_ringtone.length()); ++ values.put(MediaStore.Audio.Media.IS_RINGTONE, false); ++ values.put(MediaStore.Audio.Media.IS_NOTIFICATION, false); ++ values.put(MediaStore.Audio.Media.IS_ALARM, false); ++ values.put(MediaStore.Audio.Media.IS_MUSIC, true); ++ ++ Uri uri = MediaStore.Audio.Media.getContentUriForPath(path); ++ Uri newUri = null; ++ Cursor c = context.getContentResolver().query(uri, ++ new String[] { ++ MediaStore.MediaColumns._ID ++ }, ++ MediaStore.MediaColumns.DATA + "='" + path_clone + "'", ++ null, null); ++ if (c != null && c.getCount() > 0) { ++ c.moveToFirst(); ++ long id = c.getLong(0); ++ Log.e("ContentResolver", id + ""); ++ c.close(); ++ newUri = Uri.withAppendedPath(Uri.parse(MEDIA_CONTENT_URI), "" + id); ++ try { ++ context.getContentResolver().update(uri, values, ++ MediaStore.MediaColumns._ID + "=" + id, null); ++ } catch (Exception e) { ++ Log.d("SoundsHandler", "The content provider does not need to be updated."); ++ } ++ } ++ if (newUri == null) ++ newUri = context.getContentResolver().insert(uri, values); ++ try { ++ RingtoneManager.setActualDefaultRingtoneUri(context, type, newUri); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ return false; ++ } ++ return true; ++ } ++ ++ public static boolean setDefaultAudible(Context context, int type) { ++ final String audiblePath = getDefaultAudiblePath(type); ++ if (audiblePath != null) { ++ Uri uri = MediaStore.Audio.Media.getContentUriForPath(audiblePath); ++ Cursor c = context.getContentResolver().query(uri, ++ new String[] { ++ MediaStore.MediaColumns._ID ++ }, ++ MediaStore.MediaColumns.DATA + "='" + audiblePath + "'", ++ null, null); ++ if (c != null && c.getCount() > 0) { ++ c.moveToFirst(); ++ long id = c.getLong(0); ++ c.close(); ++ uri = Uri.withAppendedPath( ++ Uri.parse(MEDIA_CONTENT_URI), "" + id); ++ } ++ if (uri != null) ++ RingtoneManager.setActualDefaultRingtoneUri(context, type, uri); ++ } else { ++ return false; ++ } ++ return true; ++ } ++ ++} +-- +2.11.1 + diff --git a/patches/packages/apps/masquerade/0002-Finalize-masquerade-rootless-functionality-with-Subs.patch b/patches/packages/apps/masquerade/0002-Finalize-masquerade-rootless-functionality-with-Subs.patch new file mode 100644 index 0000000..0388c7d --- /dev/null +++ b/patches/packages/apps/masquerade/0002-Finalize-masquerade-rootless-functionality-with-Subs.patch @@ -0,0 +1,952 @@ +From 30c65ea40cde9403e3a5bf7030b50b75a57061d5 Mon Sep 17 00:00:00 2001 +From: Ivan Iskandar +Date: Mon, 6 Feb 2017 22:20:49 +0700 +Subject: [PATCH 2/3] Finalize masquerade rootless functionality with + Substratum [2/3] + +Change-Id: I69d3bfd6740dbbf8e864962aff764dd7707d1329 +--- + .../masquerade/substratum/services/JobService.java | 605 ++++++++++++++++----- + .../java/masquerade/substratum/utils/IOUtils.java | 45 +- + .../masquerade/substratum/utils/SoundUtils.java | 2 +- + 3 files changed, 503 insertions(+), 149 deletions(-) + +diff --git a/app/src/main/java/masquerade/substratum/services/JobService.java b/app/src/main/java/masquerade/substratum/services/JobService.java +index 3c1b859..20cf166 100644 +--- a/app/src/main/java/masquerade/substratum/services/JobService.java ++++ b/app/src/main/java/masquerade/substratum/services/JobService.java +@@ -1,4 +1,3 @@ +- + package masquerade.substratum.services; + + import android.app.ActivityManager; +@@ -15,6 +14,7 @@ import android.content.IntentFilter; + import android.content.IntentSender; + import android.content.om.IOverlayManager; + import android.content.om.OverlayInfo; ++import android.content.pm.IPackageDeleteObserver; + import android.content.pm.IPackageInstallObserver2; + import android.content.pm.IPackageManager; + import android.content.pm.PackageInstaller; +@@ -26,6 +26,7 @@ import android.graphics.Typeface; + import android.media.RingtoneManager; + import android.os.Binder; + import android.os.Bundle; ++import android.os.Environment; + import android.os.FileUtils; + import android.os.Handler; + import android.os.HandlerThread; +@@ -81,12 +82,18 @@ public class JobService extends Service { + public static final String JOB_TIME_KEY = "job_time_key"; + public static final String INSTALL_LIST_KEY = "install_list"; + public static final String UNINSTALL_LIST_KEY = "uninstall_list"; +- public static final String WITH_RESTART_UI_KEY = "with_restart_ui"; + public static final String BOOTANIMATION_FILE_NAME = "bootanimation_file_name"; + public static final String FONTS_PID = "fonts_pid"; + public static final String FONTS_FILENAME = "fonts_filename"; + public static final String AUDIO_PID = "audio_pid"; + public static final String AUDIO_FILENAME = "audio_filename"; ++ public static final String ENABLE_LIST_KEY = "enable_list"; ++ public static final String DISABLE_LIST_KEY = "disable_list"; ++ public static final String PRIORITY_LIST_KEY = "priority_list"; ++ public static final String SOURCE_FILE_KEY = "source_file"; ++ public static final String DESTINATION_FILE_KEY = "destination_file"; ++ public static final String WITH_DELETE_PARENT_KEY = "delete_parent"; ++ public static final String PROFILE_NAME_KEY = "profile_name"; + public static final String COMMAND_VALUE_JOB_COMPLETE = "job_complete"; + public static final String COMMAND_VALUE_INSTALL = "install"; + public static final String COMMAND_VALUE_UNINSTALL = "uninstall"; +@@ -95,6 +102,13 @@ public class JobService extends Service { + public static final String COMMAND_VALUE_BOOTANIMATION = "bootanimation"; + public static final String COMMAND_VALUE_FONTS = "fonts"; + public static final String COMMAND_VALUE_AUDIO = "audio"; ++ public static final String COMMAND_VALUE_ENABLE = "enable"; ++ public static final String COMMAND_VALUE_DISABLE = "disable"; ++ public static final String COMMAND_VALUE_PRIORITY = "priority"; ++ public static final String COMMAND_VALUE_COPY = "copy"; ++ public static final String COMMAND_VALUE_MOVE = "move"; ++ public static final String COMMAND_VALUE_DELETE = "delete"; ++ public static final String COMMAND_VALUE_PROFILE = "profile"; + + private static IOverlayManager mOMS; + private static IPackageManager mPM; +@@ -104,6 +118,7 @@ public class JobService extends Service { + private MainHandler mMainHandler; + private final List mJobQueue = new ArrayList<>(0); + private long mLastJobTime; ++ private boolean mIsRunning; + + @Override + public void onCreate() { +@@ -121,11 +136,10 @@ public class JobService extends Service { + return START_NOT_STICKY; + } + +- // one job at a time please +- // if (isProcessing()) { +- // log("Got start command while still processing last job, aborting"); +- // return START_NOT_STICKY; +- // } ++ // Don't run job if there is another running job ++ mIsRunning = false; ++ if (isProcessing()) mIsRunning = true; ++ + // filter out duplicate intents + long jobTime = intent.getLongExtra(JOB_TIME_KEY, 1); + if (jobTime == 1 || jobTime == mLastJobTime) { +@@ -156,9 +170,7 @@ public class JobService extends Service { + for (String _package : packages) { + jobs_to_add.add(new Remover(_package)); + } +- if (intent.getBooleanExtra(WITH_RESTART_UI_KEY, false)) { +- jobs_to_add.add(new UiResetJob()); +- } ++ if (shouldRestartUi(packages)) jobs_to_add.add(new UiResetJob()); + } else if (TextUtils.equals(command, COMMAND_VALUE_RESTART_UI)) { + jobs_to_add.add(new UiResetJob()); + } else if (TextUtils.equals(command, COMMAND_VALUE_CONFIGURATION_SHIM)) { +@@ -180,6 +192,44 @@ public class JobService extends Service { + String fileName = intent.getStringExtra(AUDIO_FILENAME); + jobs_to_add.add(new SoundsJob(pid, fileName)); + jobs_to_add.add(new UiResetJob()); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_ENABLE)) { ++ List packages = intent.getStringArrayListExtra(ENABLE_LIST_KEY); ++ for (String _package : packages) { ++ jobs_to_add.add(new Enabler(_package)); ++ } ++ if (shouldRestartUi(packages)) jobs_to_add.add(new UiResetJob()); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_DISABLE)) { ++ List packages = intent.getStringArrayListExtra(DISABLE_LIST_KEY); ++ for (String _package : packages) { ++ jobs_to_add.add(new Disabler(_package)); ++ } ++ if (shouldRestartUi(packages)) jobs_to_add.add(new UiResetJob()); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_PRIORITY)) { ++ List packages = intent.getStringArrayListExtra(PRIORITY_LIST_KEY); ++ jobs_to_add.add(new PriorityJob(packages)); ++ if (shouldRestartUi(packages)) jobs_to_add.add(new UiResetJob()); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_COPY)) { ++ String source = intent.getStringExtra(SOURCE_FILE_KEY); ++ String destination = intent.getStringExtra(DESTINATION_FILE_KEY); ++ jobs_to_add.add(new CopyJob(source, destination)); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_MOVE)) { ++ String source = intent.getStringExtra(SOURCE_FILE_KEY); ++ String destination = intent.getStringExtra(DESTINATION_FILE_KEY); ++ jobs_to_add.add(new MoveJob(source, destination)); ++ } else if (TextUtils.equals(command, COMMAND_VALUE_DELETE)) { ++ String dir = intent.getStringExtra(SOURCE_FILE_KEY); ++ if (intent.getBooleanExtra(WITH_DELETE_PARENT_KEY, true)) { ++ jobs_to_add.add(new DeleteJob(dir)); ++ } else { ++ for (File child : new File(dir).listFiles()) { ++ jobs_to_add.add(new DeleteJob(child.getAbsolutePath())); ++ } ++ } ++ } else if (TextUtils.equals(command, COMMAND_VALUE_PROFILE)) { ++ List enable = intent.getStringArrayListExtra(ENABLE_LIST_KEY); ++ List disable = intent.getStringArrayListExtra(DISABLE_LIST_KEY); ++ String profile = intent.getStringExtra(PROFILE_NAME_KEY); ++ jobs_to_add.add(new ProfileJob(profile, disable, enable)); + } + + if (jobs_to_add.size() > 0) { +@@ -233,7 +283,8 @@ public class JobService extends Service { + + private void install(String path, IPackageInstallObserver2 observer) { + try { +- getPM().installPackageAsUser(path, observer, PackageManager.INSTALL_REPLACE_EXISTING, ++ getPM().installPackageAsUser(path, observer, ++ PackageManager.INSTALL_REPLACE_EXISTING, + null, + UserHandle.USER_SYSTEM); + } catch (Exception e) { +@@ -241,22 +292,17 @@ public class JobService extends Service { + } + } + +- private void uninstall(String packageName) { ++ private void uninstall(String packageName, IPackageDeleteObserver observer) { + try { +- final LocalIntentReceiver receiver = new LocalIntentReceiver(); +- getPM().getPackageInstaller().uninstall(packageName, null /* callerPackageName */, 0, +- receiver.getIntentSender(), UserHandle.USER_SYSTEM); +- final Intent result = receiver.getResult(); +- final int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS, +- PackageInstaller.STATUS_FAILURE); ++ getPM().deletePackageAsUser(packageName, observer, 0, UserHandle.USER_SYSTEM); + } catch (Exception e) { + e.printStackTrace(); + } + } + +- private void disableOverlay(String packageName) { ++ private void switchOverlay(String packageName, boolean enable) { + try { +- getOMS().setEnabled(packageName, false, UserHandle.USER_SYSTEM, false); ++ getOMS().setEnabled(packageName, enable, UserHandle.USER_SYSTEM, false); + } catch (RemoteException e) { + e.printStackTrace(); + } +@@ -265,14 +311,25 @@ public class JobService extends Service { + private boolean isOverlayEnabled(String packageName) { + boolean enabled = false; + try { +- OverlayInfo info = getOMS().getOverlayInfo(packageName, UserHandle.USER_ALL); +- enabled = info.isEnabled(); ++ OverlayInfo info = getOMS().getOverlayInfo(packageName, UserHandle.USER_SYSTEM); ++ if (info != null) { ++ enabled = info.isEnabled(); ++ } else { ++ log("info is null"); ++ } + } catch (RemoteException e) { + e.printStackTrace(); + } + return enabled; + } + ++ private boolean shouldRestartUi(List overlays) { ++ for (String o : overlays) { ++ if (o.startsWith("com.android.systemui")) return true; ++ } ++ return false; ++ } ++ + private void copyFonts(String pid, String zipFileName) { + // prepare local cache dir for font package assembly + log("Copy Fonts - Package ID = " + pid + " filename = " + zipFileName); +@@ -328,23 +385,26 @@ public class JobService extends Service { + IOUtils.createFontDirIfNotExists(); + IOUtils.copyFolder(cacheDir.getAbsolutePath(), IOUtils.SYSTEM_THEME_FONT_PATH); + +- // set permissions on font files and config xml +- File themeFonts = new File(IOUtils.SYSTEM_THEME_FONT_PATH); +- for (File f : themeFonts.listFiles()) { +- FileUtils.setPermissions(f, +- FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); +- } +- + // let system know it's time for a font change +- SystemProperties.set("sys.refresh_theme", "1"); +- float fontSize = Float.valueOf(Settings.System.getString( +- getContentResolver(), Settings.System.FONT_SCALE)); +- Settings.System.putString(getContentResolver(), +- Settings.System.FONT_SCALE, String.valueOf(fontSize + 0.0000001)); ++ refreshFonts(); + } + + private void clearFonts() { + IOUtils.deleteThemedFonts(); ++ refreshFonts(); ++ } ++ ++ private void refreshFonts() { ++ // set permissions on font files and config xml ++ File themeFonts = new File(IOUtils.SYSTEM_THEME_FONT_PATH); ++ if (themeFonts.exists()) { ++ // Set permissions ++ IOUtils.setPermissionsRecursive(themeFonts, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, ++ FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IROTH | FileUtils.S_IXOTH); ++ } ++ ++ // let system know it's time for a font change + SystemProperties.set("sys.refresh_theme", "1"); + Typeface.recreateDefaults(); + float fontSize = Float.valueOf(Settings.System.getString( +@@ -395,56 +455,29 @@ public class JobService extends Service { + File effect_tick_ogg = new File(getCacheDir(), "/SoundsCache/ui/Effect_Tick.ogg"); + if (effect_tick_ogg.exists()) { + IOUtils.bufferedCopy(effect_tick_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Effect_Tick.ogg")); +- SoundUtils.setUIAudible(this, effect_tick_ogg, new File +- ("/data/system/theme/audio/ui/Effect_Tick.ogg"), RingtoneManager +- .TYPE_RINGTONE, "Effect_Tick"); + } else if (effect_tick_mp3.exists()) { + IOUtils.bufferedCopy(effect_tick_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Effect_Tick.mp3")); +- SoundUtils.setUIAudible(this, effect_tick_mp3, new File +- ("/data/system/theme/audio/ui/Effect_Tick.mp3"), RingtoneManager +- .TYPE_RINGTONE, "Effect_Tick"); +- } else { +- SoundUtils.setDefaultUISounds(getContentResolver(), "lock_sound", "Lock.ogg"); + } + File new_lock_mp3 = new File(getCacheDir(), "/SoundsCache/ui/Lock.mp3"); + File new_lock_ogg = new File(getCacheDir(), "/SoundsCache/ui/Lock.ogg"); + if (new_lock_ogg.exists()) { + IOUtils.bufferedCopy(new_lock_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Lock.ogg")); +- SoundUtils.setUISounds(getContentResolver(), "lock_sound", "/data/system/theme/audio/ui/Lock.ogg"); + } else if (new_lock_mp3.exists()) { + IOUtils.bufferedCopy(new_lock_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Lock.mp3")); +- SoundUtils.setUISounds(getContentResolver(), "lock_sound", "/data/system/theme/audio/ui/Lock.mp3"); +- } else { +- SoundUtils.setDefaultUISounds(getContentResolver(), "lock_sound", "Lock.ogg"); + } + File new_unlock_mp3 = new File(getCacheDir(), "/SoundsCache/ui/Unlock.mp3"); + File new_unlock_ogg = new File(getCacheDir(), "/SoundsCache/ui/Unlock.ogg"); + if (new_unlock_ogg.exists()) { + IOUtils.bufferedCopy(new_unlock_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Unlock.ogg")); +- SoundUtils.setUISounds(getContentResolver(), "unlock_sound", "/data/system/theme/audio/ui/Unlock.ogg"); + } else if (new_unlock_mp3.exists()) { + IOUtils.bufferedCopy(new_unlock_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Unlock.mp3")); +- SoundUtils.setUISounds(getContentResolver(), "unlock_sound", "/data/system/theme/audio/ui/Unlock.mp3"); +- } else { +- SoundUtils.setDefaultUISounds(getContentResolver(), "unlock_sound", "Unlock.ogg"); + } + File new_lowbattery_mp3 = new File(getCacheDir(), "/SoundsCache/ui/LowBattery.mp3"); + File new_lowbattery_ogg = new File(getCacheDir(), "/SoundsCache/ui/LowBattery.ogg"); + if (new_lowbattery_ogg.exists()) { + IOUtils.bufferedCopy(new_lowbattery_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "LowBattery.ogg")); +- SoundUtils.setUISounds(getContentResolver(), "low_battery_sound", "/data/system/theme/audio/ui/LowBattery.ogg"); + } else if (new_lowbattery_mp3.exists()) { + IOUtils.bufferedCopy(new_lowbattery_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "LowBattery.mp3")); +- SoundUtils.setUISounds(getContentResolver(), "low_battery_sound", "/data/system/theme/audio/ui/LowBattery.mp3"); +- } else { +- SoundUtils.setDefaultUISounds(getContentResolver(), "low_battery_sound", "LowBattery.ogg"); +- } +- File uiSounds = new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH); +- if (uiSounds.exists() && uiSounds.isDirectory()) { +- for (File f : uiSounds.listFiles()) { +- FileUtils.setPermissions(f, +- FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); +- } + } + } + File alarmCache = new File(getCacheDir(), "/SoundsCache/alarms/"); +@@ -454,27 +487,8 @@ public class JobService extends Service { + File new_alarm_ogg = new File(getCacheDir(), "/SoundsCache/alarms/alarm.ogg"); + if (new_alarm_ogg.exists()) { + IOUtils.bufferedCopy(new_alarm_ogg, new File(IOUtils.SYSTEM_THEME_ALARM_PATH + File.separator + "alarm.ogg")); +- int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_alarm_metadata", "string", SUBSTRATUM_PACKAGE); +- SoundUtils.setAudible(this, new File("/data/system/theme/audio/alarms/alarm.ogg"), +- new File(alarmCache.getAbsolutePath(), "alarm.ogg"), +- RingtoneManager.TYPE_ALARM, +- getSubsContext().getString(metaDataId)); + } else if (new_alarm_mp3.exists()) { + IOUtils.bufferedCopy(new_alarm_mp3, new File(IOUtils.SYSTEM_THEME_ALARM_PATH + File.separator + "alarm.mp3")); +- int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_alarm_metadata", "string", SUBSTRATUM_PACKAGE); +- SoundUtils.setAudible(this, new File("/data/system/theme/audio/alarms/alarm.mp3"), +- new File(alarmCache.getAbsolutePath(), "alarm.mp3"), +- RingtoneManager.TYPE_ALARM, +- getSubsContext().getString(metaDataId)); +- } else { +- SoundUtils.setDefaultAudible(this, RingtoneManager.TYPE_ALARM); +- } +- File alarms = new File(IOUtils.SYSTEM_THEME_ALARM_PATH); +- if (alarms.exists() && alarms.isDirectory()) { +- for (File f : alarms.listFiles()) { +- FileUtils.setPermissions(f, +- FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); +- } + } + } + File notifCache = new File(getCacheDir(), "/SoundsCache/notifications/"); +@@ -484,27 +498,8 @@ public class JobService extends Service { + File new_notif_ogg = new File(getCacheDir(), "/SoundsCache/notifications/notification.ogg"); + if (new_notif_ogg.exists()) { + IOUtils.bufferedCopy(new_notif_ogg, new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH + File.separator + "notification.ogg")); +- int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_notification_metadata", "string", SUBSTRATUM_PACKAGE); +- SoundUtils.setAudible(this, new File("/data/system/theme/audio/notifications/notification.ogg"), +- new File(notifCache.getAbsolutePath(), "notification.ogg"), +- RingtoneManager.TYPE_NOTIFICATION, +- getSubsContext().getString(metaDataId)); + } else if (new_notif_mp3.exists()) { + IOUtils.bufferedCopy(new_notif_mp3, new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH + File.separator + "notification.mp3")); +- int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_notification_metadata", "string", SUBSTRATUM_PACKAGE); +- SoundUtils.setAudible(this, new File("/data/system/theme/audio/notifications/notification.mp3"), +- new File(notifCache.getAbsolutePath(), "notification.mp3"), +- RingtoneManager.TYPE_NOTIFICATION, +- getSubsContext().getString(metaDataId)); +- } else { +- SoundUtils.setDefaultAudible(this, RingtoneManager.TYPE_NOTIFICATION); +- } +- File notifs = new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH); +- if (notifs.exists() && notifs.isDirectory()) { +- for (File f : notifs.listFiles()) { +- FileUtils.setPermissions(f, +- FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); +- } + } + } + File ringtoneCache = new File(getCacheDir(), "/SoundsCache/ringtones/"); +@@ -514,29 +509,13 @@ public class JobService extends Service { + File new_ring_ogg = new File(getCacheDir(), "/SoundsCache/ringtones/ringtone.ogg"); + if (new_ring_ogg.exists()) { + IOUtils.bufferedCopy(new_ring_ogg, new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH + File.separator + "ringtone.ogg")); +- int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_ringtone_metadata", "string", SUBSTRATUM_PACKAGE); +- SoundUtils.setAudible(this, new File("/data/system/theme/audio/ringtones/ringtone.ogg"), +- new File(notifCache.getAbsolutePath(), "ringtone.ogg"), +- RingtoneManager.TYPE_RINGTONE, +- getSubsContext().getString(metaDataId)); + } else if (new_ring_mp3.exists()) { + IOUtils.bufferedCopy(new_ring_mp3, new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH + File.separator + "ringtone.mp3")); +- int metaDataId = getSubsContext().getResources().getIdentifier("content_resolver_ringtone_metadata", "string", SUBSTRATUM_PACKAGE); +- SoundUtils.setAudible(this, new File("/data/system/theme/audio/ringtones/ringtone.mp3"), +- new File(notifCache.getAbsolutePath(), "ringtone.mp3"), +- RingtoneManager.TYPE_RINGTONE, +- getSubsContext().getString(metaDataId)); +- } else { +- SoundUtils.setDefaultAudible(this, RingtoneManager.TYPE_RINGTONE); +- } +- File rings = new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH); +- if (rings.exists() && rings.isDirectory()) { +- for (File f : rings.listFiles()) { +- FileUtils.setPermissions(f, +- FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, -1, -1); +- } + } + } ++ ++ // let system know it's time for a sound change ++ refreshSounds(); + } + + private void clearSounds(Context ctx) { +@@ -550,6 +529,121 @@ public class JobService extends Service { + "LowBattery.ogg"); + } + ++ private void refreshSounds () { ++ File soundsDir = new File(IOUtils.SYSTEM_THEME_AUDIO_PATH); ++ if (soundsDir.exists()) { ++ // Set permissions ++ IOUtils.setPermissionsRecursive(soundsDir, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, ++ FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IROTH | FileUtils.S_IXOTH); ++ ++ File uiDir = new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH); ++ if (uiDir.exists()) { ++ File effect_tick_mp3 = new File(uiDir, "Effect_Tick.mp3"); ++ File effect_tick_ogg = new File(uiDir, "Effect_Tick.ogg"); ++ if (effect_tick_mp3.exists()) { ++ SoundUtils.setUIAudible(this, effect_tick_mp3, ++ effect_tick_mp3, RingtoneManager.TYPE_RINGTONE, ++ "Effect_Tick"); ++ } else if (effect_tick_ogg.exists()) { ++ SoundUtils.setUIAudible(this, effect_tick_ogg, ++ effect_tick_ogg, RingtoneManager.TYPE_RINGTONE, ++ "Effect_Tick"); ++ } else { ++ SoundUtils.setDefaultUISounds(getContentResolver(), ++ "Effect_Tick", ++ "Effect_Tick.ogg"); ++ } ++ ++ File lock_mp3 = new File(uiDir, "Lock.mp3"); ++ File lock_ogg = new File(uiDir, "Lock.ogg"); ++ if (lock_mp3.exists()) { ++ SoundUtils.setUISounds(getContentResolver(), "lock_sound", ++ lock_mp3.getAbsolutePath()); ++ } else if (lock_ogg.exists()) { ++ SoundUtils.setUISounds(getContentResolver(), "lock_sound", ++ lock_ogg.getAbsolutePath()); ++ } else { ++ SoundUtils.setDefaultUISounds(getContentResolver(), ++ "lock_sound", "Lock.ogg"); ++ } ++ ++ File unlock_mp3 = new File(uiDir, "Unlock.mp3"); ++ File unlock_ogg = new File(uiDir, "Unlock.ogg"); ++ if (unlock_mp3.exists()) { ++ SoundUtils.setUISounds(getContentResolver(), "unlock_sound", ++ unlock_mp3.getAbsolutePath()); ++ } else if (unlock_ogg.exists()) { ++ SoundUtils.setUISounds(getContentResolver(), "unlock_sound", ++ unlock_ogg.getAbsolutePath()); ++ } else { ++ SoundUtils.setDefaultUISounds(getContentResolver(), ++ "unlock_sound", "Unlock.ogg"); ++ } ++ ++ File lowbattery_mp3 = new File(uiDir, "LowBattery.mp3"); ++ File lowbattery_ogg = new File(uiDir, "LowBattery.ogg"); ++ if (lowbattery_mp3.exists()) { ++ SoundUtils.setUISounds(getContentResolver(), "low_battery_sound", ++ lowbattery_mp3.getAbsolutePath()); ++ } else if (lowbattery_ogg.exists()) { ++ SoundUtils.setUISounds(getContentResolver(), "low_battery_sound", ++ lowbattery_ogg.getAbsolutePath()); ++ } else { ++ SoundUtils.setDefaultUISounds(getContentResolver(), ++ "low_battery_sound", "LowBattery.ogg"); ++ } ++ } ++ ++ File notifDir = new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH); ++ if (notifDir.exists()) { ++ int metaDataId = getSubsContext().getResources().getIdentifier( ++ "content_resolver_notification_metadata", ++ "string", SUBSTRATUM_PACKAGE); ++ ++ File notification_mp3 = new File(notifDir, "notification.mp3"); ++ File notification_ogg = new File(notifDir, "notification.ogg"); ++ if (notification_mp3.exists()) { ++ SoundUtils.setAudible(this, notification_mp3, ++ notification_mp3, ++ RingtoneManager.TYPE_NOTIFICATION, ++ getSubsContext().getString(metaDataId)); ++ } else if (notification_ogg.exists()) { ++ SoundUtils.setAudible(this, notification_ogg, ++ notification_ogg, ++ RingtoneManager.TYPE_NOTIFICATION, ++ getSubsContext().getString(metaDataId)); ++ } else { ++ SoundUtils.setDefaultAudible(this, ++ RingtoneManager.TYPE_NOTIFICATION); ++ } ++ } ++ ++ File ringtoneDir = new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH); ++ if (ringtoneDir.exists()) { ++ int metaDataId = getSubsContext().getResources().getIdentifier( ++ "content_resolver_notification_metadata", ++ "string", SUBSTRATUM_PACKAGE); ++ ++ File ringtone_mp3 = new File(ringtoneDir, "ringtone.mp3"); ++ File ringtone_ogg = new File(ringtoneDir, "ringtone.ogg"); ++ if (ringtone_mp3.exists()) { ++ SoundUtils.setAudible(this, ringtone_mp3, ++ ringtone_mp3, ++ RingtoneManager.TYPE_RINGTONE, ++ getSubsContext().getString(metaDataId)); ++ } else if (ringtone_ogg.exists()) { ++ SoundUtils.setAudible(this, ringtone_ogg, ++ ringtone_ogg, ++ RingtoneManager.TYPE_RINGTONE, ++ getSubsContext().getString(metaDataId)); ++ } else { ++ SoundUtils.setDefaultAudible(this, ++ RingtoneManager.TYPE_RINGTONE); ++ } ++ } ++ } ++ } + private void copyBootAnimation(String fileName) { + try { + clearBootAnimation(); +@@ -557,8 +651,8 @@ public class JobService extends Service { + File dest = new File(IOUtils.SYSTEM_THEME_BOOTANIMATION_PATH); + IOUtils.bufferedCopy(source, dest); + source.delete(); +- FileUtils.setPermissions(IOUtils.SYSTEM_THEME_BOOTANIMATION_PATH, +- FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IROTH, -1, -1); ++ IOUtils.setPermissions(dest, ++ FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IROTH); + } catch (Exception e) { + e.printStackTrace(); + } +@@ -689,7 +783,7 @@ public class JobService extends Service { + synchronized (mJobQueue) { + job = mJobQueue.get(0); + } +- if (job != null) { ++ if (job != null && !mIsRunning) { + job.run(); + } + break; +@@ -698,8 +792,10 @@ public class JobService extends Service { + synchronized (mJobQueue) { + mJobQueue.remove(toRemove); + if (mJobQueue.size() > 0) { ++ mIsRunning = false; + this.sendEmptyMessage(MESSAGE_CHECK_QUEUE); + } else { ++ mIsRunning = false; + log("Job queue empty! All done"); + mMainHandler.sendEmptyMessage(MainHandler.MSG_JOB_QUEUE_EMPTY); + } +@@ -835,7 +931,7 @@ public class JobService extends Service { + } + } + +- private class Installer implements Runnable, IPackageInstallObserver2 { ++ private class Installer implements Runnable { + String mPath; + + public Installer(String path) { +@@ -843,27 +939,28 @@ public class JobService extends Service { + } + + @Override +- public IBinder asBinder() { +- return null; ++ public void run() { ++ log("Installer - installing " + mPath); ++ PackageInstallObserver observer = new PackageInstallObserver(Installer.this); ++ install(mPath, observer); + } ++ } + +- @Override +- public void onUserActionRequired(Intent intent) throws RemoteException { +- log("Installer - user action required callback with " + mPath); ++ private class PackageInstallObserver extends IPackageInstallObserver2.Stub { ++ Object mObject; ++ ++ public PackageInstallObserver(Object _object) { ++ mObject = _object; + } + +- @Override +- public void onPackageInstalled(String basePackageName, int returnCode, String msg, +- Bundle extras) throws RemoteException { +- log("Installer - successfully installed " + basePackageName + " from " + mPath); +- Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, Installer.this); +- mJobHandler.sendMessage(message); ++ public void onUserActionRequired(Intent intent) throws RemoteException { ++ log("Installer - user action required callback"); + } + +- @Override +- public void run() { +- log("Installer - installing " + mPath); +- install(mPath, this); ++ public void onPackageInstalled(String packageName, int returnCode, String msg, Bundle extras) { ++ log("Installer - successfully installed " + packageName); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, mObject); ++ mJobHandler.sendMessage(message); + } + } + +@@ -876,12 +973,242 @@ public class JobService extends Service { + + @Override + public void run() { ++ ++ // TODO: Fix isOverlayEnabled function, for now it's causing NPE + if (isOverlayEnabled(mPackage)) { + log("Remover - disabling overlay for " + mPackage); +- disableOverlay(mPackage); ++ switchOverlay(mPackage, false); + } ++ + log("Remover - uninstalling " + mPackage); +- uninstall(mPackage); ++ PackageDeleteObserver observer = new PackageDeleteObserver(Remover.this); ++ uninstall(mPackage, observer); ++ } ++ } ++ ++ private class PackageDeleteObserver extends IPackageDeleteObserver.Stub { ++ Object mObject; ++ ++ public PackageDeleteObserver(Object _object) { ++ mObject = _object; ++ } ++ ++ public void packageDeleted(String packageName, int returnCode) { ++ log("Remover - successfully removed " + packageName); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, mObject); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class Enabler implements Runnable { ++ String mPackage; ++ ++ public Enabler(String _package) { ++ mPackage = _package; ++ } ++ ++ @Override ++ public void run() { ++ log("Enabler - enabling overlay for " + mPackage); ++ switchOverlay(mPackage, true); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ Enabler.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class Disabler implements Runnable { ++ String mPackage; ++ ++ public Disabler(String _package) { ++ mPackage = _package; ++ } ++ ++ @Override ++ public void run() { ++ log("Disabler - disabling overlay for " + mPackage); ++ switchOverlay(mPackage, false); ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ Disabler.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class PriorityJob implements Runnable { ++ List mPackages; ++ ++ public PriorityJob(List _packages) { ++ mPackages = _packages; ++ } ++ ++ @Override ++ public void run() { ++ log("PriorityJob - processing priority changes"); ++ try { ++ int size = mPackages.size(); ++ for (int i = 0; i < size-1; i++) { ++ String parentName = mPackages.get(i); ++ String packageName = mPackages.get(i+1); ++ getOMS().setPriority(packageName, parentName, UserHandle.USER_SYSTEM); ++ } ++ } catch (RemoteException e) { ++ e.printStackTrace(); ++ } ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ PriorityJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class CopyJob implements Runnable { ++ String mSource; ++ String mDestination; ++ ++ public CopyJob(String _source, String _destination) { ++ mSource = _source; ++ mDestination = _destination; ++ } ++ ++ @Override ++ public void run() { ++ log("CopyJob - copying " + mSource + " to " + mDestination); ++ File sourceFile = new File(mSource); ++ if (sourceFile.exists()) { ++ if (sourceFile.isFile()) { ++ IOUtils.bufferedCopy(mSource, mDestination); ++ } else { ++ IOUtils.copyFolder(mSource, mDestination); ++ } ++ } else { ++ log("CopyJob - " + mSource + " is not exist! aborting..."); ++ } ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ CopyJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class MoveJob implements Runnable { ++ String mSource; ++ String mDestination; ++ ++ public MoveJob(String _source, String _destination) { ++ mSource = _source; ++ mDestination = _destination; ++ } ++ ++ @Override ++ public void run() { ++ log("MoveJob - moving " + mSource + " to " + mDestination); ++ File sourceFile = new File(mSource); ++ if (sourceFile.exists()) { ++ if (sourceFile.isFile()) { ++ IOUtils.bufferedCopy(mSource, mDestination); ++ } else { ++ IOUtils.copyFolder(mSource, mDestination); ++ } ++ IOUtils.deleteRecursive(sourceFile); ++ } else { ++ log("MoveJob - " + mSource + " is not exist! aborting..."); ++ } ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ MoveJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class DeleteJob implements Runnable { ++ String mFileOrDirectory; ++ ++ public DeleteJob(String _directory) { ++ mFileOrDirectory = _directory; ++ } ++ ++ @Override ++ public void run() { ++ log("DeleteJob - deleting " + mFileOrDirectory); ++ File file = new File(mFileOrDirectory); ++ if (file.exists()) { ++ IOUtils.deleteRecursive(file); ++ } else { ++ log("DeleteJob - " + mFileOrDirectory + " is already deleted!"); ++ } ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ DeleteJob.this); ++ mJobHandler.sendMessage(message); ++ } ++ } ++ ++ private class ProfileJob implements Runnable { ++ String mProfileName; ++ List mToBeDisabled; ++ List mToBeEnabled; ++ ++ public ProfileJob(String _name, List _toBeDisabled, List _toBeEnabled) { ++ mProfileName = _name; ++ mToBeDisabled = _toBeDisabled; ++ mToBeEnabled = _toBeEnabled; ++ } ++ ++ @Override ++ public void run() { ++ boolean restartUi = false; ++ log("Applying profile..."); ++ ++ // Need to restart SystemUI? ++ restartUi = shouldRestartUi(mToBeEnabled) || shouldRestartUi(mToBeDisabled); ++ ++ // Clear system theme folder content ++ File themeDir = new File(IOUtils.SYSTEM_THEME_PATH); ++ for (File f : themeDir.listFiles()) { ++ IOUtils.deleteRecursive(f); ++ } ++ ++ // Process theme folder ++ File profileDir = new File(Environment.getExternalStorageDirectory() ++ .getAbsolutePath() + "/substratum/profiles/" + ++ mProfileName + "/theme"); ++ ++ if (profileDir.exists()) { ++ File profileFonts = new File(profileDir, "fonts"); ++ if (profileFonts.exists()) { ++ IOUtils.copyFolder(profileFonts, new File(IOUtils.SYSTEM_THEME_FONT_PATH)); ++ refreshFonts(); ++ restartUi = true; ++ } else { ++ clearFonts(); ++ } ++ ++ File profileSounds = new File(profileDir, "audio"); ++ if (profileSounds.exists()) { ++ IOUtils.copyFolder(profileSounds, new File(IOUtils.SYSTEM_THEME_AUDIO_PATH)); ++ refreshSounds(); ++ restartUi = true; ++ } else { ++ clearSounds(JobService.this); ++ } ++ } ++ ++ // Disable all overlays installed ++ for (String overlay : mToBeDisabled) { ++ switchOverlay(overlay, false); ++ } ++ ++ // Enable provided overlays ++ for (String overlay : mToBeEnabled) { ++ switchOverlay(overlay, true); ++ } ++ ++ // Restart SystemUI when needed ++ if (restartUi) { ++ synchronized(mJobQueue) { ++ mJobQueue.add(new UiResetJob()); ++ } ++ } ++ ++ Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, ++ ProfileJob.this); ++ mJobHandler.sendMessage(message); + } + } + +diff --git a/app/src/main/java/masquerade/substratum/utils/IOUtils.java b/app/src/main/java/masquerade/substratum/utils/IOUtils.java +index 092c58c..06b5260 100644 +--- a/app/src/main/java/masquerade/substratum/utils/IOUtils.java ++++ b/app/src/main/java/masquerade/substratum/utils/IOUtils.java +@@ -40,8 +40,8 @@ public class IOUtils { + if (!dirExists(dirPath)) { + File dir = new File(dirPath); + if (dir.mkdir()) { +- FileUtils.setPermissions(dir, FileUtils.S_IRWXU | +- FileUtils.S_IRWXG | FileUtils.S_IROTH | FileUtils.S_IXOTH, -1, -1); ++ setPermissions(dir, FileUtils.S_IRWXU | FileUtils.S_IRWXG | ++ FileUtils.S_IROTH | FileUtils.S_IXOTH); + } + } + } +@@ -77,7 +77,7 @@ public class IOUtils { + e.printStackTrace(); + } + } +- ++ + public static void deleteThemedAudio() { + try { + deleteRecursive(new File(SYSTEM_THEME_UI_SOUNDS_PATH)); +@@ -89,20 +89,28 @@ public class IOUtils { + } + } + +- public static void copyFolder(String source, String dest) { +- File dir = new File(source); +- File[] files = dir.listFiles(); ++ public static void copyFolder(File source, File dest) { ++ if (!dest.exists()) dest.mkdirs(); ++ File[] files = source.listFiles(); + for (File file : files) { + try { +- String sourceFile = dir + File.separator + file.getName(); +- String destinationFile = dest + File.separator + file.getName(); +- bufferedCopy(new File(sourceFile), new File(destinationFile)); ++ File newFile = new File(dest.getAbsolutePath() + File.separator + ++ file.getName()); ++ if (file.isFile()) { ++ bufferedCopy(file, newFile); ++ } else { ++ copyFolder(file, newFile); ++ } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + ++ public static void copyFolder(String source, String dest) { ++ copyFolder(new File(source), new File(dest)); ++ } ++ + public static void unzip(String source, String destination) { + try (ZipInputStream inputStream = new ZipInputStream( + new BufferedInputStream(new FileInputStream(source)))) { +@@ -167,4 +175,23 @@ public class IOUtils { + fileOrDirectory.delete(); + } + ++ public static void setPermissions(File path, int permissions) { ++ FileUtils.setPermissions(path, permissions, -1, -1); ++ } ++ ++ public static void setPermissionsRecursive(File dir, int file, int folder) { ++ if (dir.isDirectory()) { ++ for (File child : dir.listFiles()) { ++ if (child.isDirectory()) { ++ setPermissionsRecursive(child, file, folder); ++ setPermissions(child, folder); ++ } else { ++ setPermissions(child, file); ++ } ++ } ++ setPermissions(dir, folder); ++ } else { ++ setPermissions(dir, file); ++ } ++ } + } +diff --git a/app/src/main/java/masquerade/substratum/utils/SoundUtils.java b/app/src/main/java/masquerade/substratum/utils/SoundUtils.java +index 72c6052..dda38eb 100644 +--- a/app/src/main/java/masquerade/substratum/utils/SoundUtils.java ++++ b/app/src/main/java/masquerade/substratum/utils/SoundUtils.java +@@ -27,7 +27,7 @@ public class SoundUtils { + private static final String MEDIA_CONTENT_URI = "content://media/internal/audio/media"; + + public static void updateGlobalSettings(ContentResolver resolver, String uri, String val) { +- Settings.Global.putStringForUser(resolver, uri, val, UserHandle.USER_ALL); ++ Settings.Global.putStringForUser(resolver, uri, val, UserHandle.USER_SYSTEM); + } + + public static boolean setUISounds(ContentResolver resolver, String sound_name, String location) { +-- +2.11.1 + diff --git a/patches/packages/apps/masquerade/0003-Release-23-Introduce-the-rootless-solution-for-Masqu.patch b/patches/packages/apps/masquerade/0003-Release-23-Introduce-the-rootless-solution-for-Masqu.patch new file mode 100644 index 0000000..7bdff15 --- /dev/null +++ b/patches/packages/apps/masquerade/0003-Release-23-Introduce-the-rootless-solution-for-Masqu.patch @@ -0,0 +1,2644 @@ +From 63b419e89e730b3186fce7cb8a4b95e5b56f81fe Mon Sep 17 00:00:00 2001 +From: Nicholas Chum +Date: Tue, 14 Feb 2017 00:56:09 -0500 +Subject: [PATCH 3/3] Release 23: Introduce the rootless solution for + Masquerade [3/3] + +Huge thanks to @bigrushdog, @iskandar1023 and @Surge1223 for all +the hard work put into this. + +Clean-up commit by @nicholaschum +- Introduce Java8 integration +- Remove all the receivers +- Remove all the unused imports, methods and permissions. +- Reformat and optimize all Java files, drawables and XML files. +- Make sure the project is Android Studio ready +- Ensure that all permissions are declared Protected if in AS. + +To build this in Android Studio (without platform key), you must copy +the "android.jar" built from your AOSP+OMS build environment to +%AndroidSDK%/platforms/android-25/android.jar (back up your original +copy). Then all you have to do is import masquerade as a gradle +project to Android Studio and you are set! + +Change-Id: Ie350497ac5cfaf39c062235b90e3832f8072c7a8 +--- + app/build.gradle | 32 +- + app/src/main/AndroidManifest.xml | 49 ++- + .../substratum/receivers/BootReceiver.java | 13 - + .../substratum/receivers/UninstallReceiver.java | 47 --- + .../masquerade/substratum/services/JobService.java | 462 +++++++++------------ + .../masquerade/substratum/services/MasqDemo.java | 137 ------ + .../java/masquerade/substratum/utils/IOUtils.java | 37 +- + .../masquerade/substratum/utils/SoundUtils.java | 72 ++-- + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 2240 bytes + .../main/res/mipmap-hdpi/substratum_masquerade.png | Bin 2246 -> 0 bytes + app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 1848 bytes + .../main/res/mipmap-mdpi/substratum_masquerade.png | Bin 2094 -> 0 bytes + app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 2733 bytes + .../res/mipmap-xhdpi/substratum_masquerade.png | Bin 2734 -> 0 bytes + app/src/main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 3874 bytes + .../res/mipmap-xxhdpi/substratum_masquerade.png | Bin 3894 -> 0 bytes + app/src/main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 4947 bytes + .../res/mipmap-xxxhdpi/substratum_masquerade.png | Bin 4966 -> 0 bytes + app/src/main/res/values/styles.xml | 1 - + gradlew | 0 + gradlew.bat | 180 ++++---- + 21 files changed, 408 insertions(+), 622 deletions(-) + delete mode 100644 app/src/main/java/masquerade/substratum/receivers/BootReceiver.java + delete mode 100644 app/src/main/java/masquerade/substratum/receivers/UninstallReceiver.java + delete mode 100644 app/src/main/java/masquerade/substratum/services/MasqDemo.java + create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png + delete mode 100755 app/src/main/res/mipmap-hdpi/substratum_masquerade.png + create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png + delete mode 100755 app/src/main/res/mipmap-mdpi/substratum_masquerade.png + create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png + delete mode 100755 app/src/main/res/mipmap-xhdpi/substratum_masquerade.png + create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png + delete mode 100755 app/src/main/res/mipmap-xxhdpi/substratum_masquerade.png + create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png + delete mode 100755 app/src/main/res/mipmap-xxxhdpi/substratum_masquerade.png + mode change 100755 => 100644 gradlew + +diff --git a/app/build.gradle b/app/build.gradle +index 265096a..a2694a8 100644 +--- a/app/build.gradle ++++ b/app/build.gradle +@@ -1,7 +1,7 @@ + apply plugin: 'com.android.application' + + android { +- compileSdkVersion 23 ++ compileSdkVersion 25 + buildToolsVersion "23.0.3" + + lintOptions { +@@ -12,25 +12,41 @@ android { + applicationVariants.all { variant -> + variant.outputs.each { output -> + output.outputFile = new File( +- output.outputFile.parent, "masquerade_beta_testers" + versionCode + ".apk") ++ output.outputFile.parent, "masquerade_" + versionCode + ".apk") + } + } + + defaultConfig { + applicationId "masquerade.substratum" +- minSdkVersion 21 +- targetSdkVersion 23 +- versionCode 20 +- versionName "twenty - procyon" ++ minSdkVersion 25 ++ targetSdkVersion 25 ++ versionCode 23 ++ versionName "twenty three" ++ } ++ ++ defaultConfig { ++ jackOptions { ++ enabled true ++ } ++ } ++ ++ compileOptions { ++ incremental true ++ sourceCompatibility JavaVersion.VERSION_1_8 ++ targetCompatibility JavaVersion.VERSION_1_8 ++ } ++ ++ dexOptions { ++ javaMaxHeapSize '2048m' + } + + buildTypes { + debug { +- minifyEnabled true ++ minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + release { +- minifyEnabled true ++ minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml +index 13db0f9..2554839 100644 +--- a/app/src/main/AndroidManifest.xml ++++ b/app/src/main/AndroidManifest.xml +@@ -1,40 +1,39 @@ ++ + ++ package="masquerade.substratum" ++ android:sharedUserId="android.uid.system" ++ android:versionCode="23" ++ android:versionName="twenty three" ++ tools:ignore="GradleOverrides"> + + + +- + +- +- +- +- ++ ++ ++ ++ + + + + +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ android:permission="android.permission.MODIFY_OVERLAYS"/> + + +diff --git a/app/src/main/java/masquerade/substratum/receivers/BootReceiver.java b/app/src/main/java/masquerade/substratum/receivers/BootReceiver.java +deleted file mode 100644 +index ebc0c8b..0000000 +--- a/app/src/main/java/masquerade/substratum/receivers/BootReceiver.java ++++ /dev/null +@@ -1,13 +0,0 @@ +-package masquerade.substratum.receivers; +- +-import android.content.BroadcastReceiver; +-import android.content.Context; +-import android.content.Intent; +- +- +-public class BootReceiver extends BroadcastReceiver { +- @Override +- public void onReceive(Context context, Intent intent) { +- // do something +- } +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/receivers/UninstallReceiver.java b/app/src/main/java/masquerade/substratum/receivers/UninstallReceiver.java +deleted file mode 100644 +index b377e27..0000000 +--- a/app/src/main/java/masquerade/substratum/receivers/UninstallReceiver.java ++++ /dev/null +@@ -1,47 +0,0 @@ +-package masquerade.substratum.receivers; +- +-import android.content.BroadcastReceiver; +-import android.content.Context; +-import android.content.Intent; +-import android.net.Uri; +-import android.os.AsyncTask; +-import android.os.Environment; +-import android.util.Log; +- +-import java.util.ArrayList; +-import java.util.List; +- +- +-public class UninstallReceiver extends BroadcastReceiver { +- @Override +- public void onReceive(Context context, Intent intent) { +- if ("android.intent.action.PACKAGE_REMOVED".equals(intent.getAction())) { +- Uri packageName = intent.getData(); +- if (packageName.toString().substring(8).equals("projekt.substratum")) { +-// new performUninstalls().execute(""); +- } +- } +- } +-/* +- public class performUninstalls extends AsyncTask { +- @Override +- protected String doInBackground(String... sUrl) { +- // Substratum was uninstalled, uninstall all remaining overlays +- Log.d("Masquerade", +- "Substratum was uninstalled, so all remaining overlays will be removed..."); +- String[] state4 = {Environment.getExternalStorageDirectory() +- .getAbsolutePath() + "/.substratum/current_overlays.xml", "4"}; +- String[] state5 = {Environment.getExternalStorageDirectory() +- .getAbsolutePath() + "/.substratum/current_overlays.xml", "5"}; +- List state5overlays = ReadOverlaysFile.main(state5); +- ArrayList all_overlays = new ArrayList<>(ReadOverlaysFile.main(state4)); +- all_overlays.addAll(state5overlays); +- for (int i = 0; i < all_overlays.size(); i++) { +- Log.d("Masquerade", "Uninstalling overlay: " + all_overlays.get(i)); +- Root.runCommand("pm uninstall " + all_overlays.get(i)); +- } +- return null; +- } +- } +- */ +-} +\ No newline at end of file +diff --git a/app/src/main/java/masquerade/substratum/services/JobService.java b/app/src/main/java/masquerade/substratum/services/JobService.java +index 20cf166..0ecd279 100644 +--- a/app/src/main/java/masquerade/substratum/services/JobService.java ++++ b/app/src/main/java/masquerade/substratum/services/JobService.java +@@ -1,3 +1,23 @@ ++/* ++ * Copyright (c) 2017 Project Substratum ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * Also add information on how to contact you by electronic and paper mail. ++ * ++ */ ++ + package masquerade.substratum.services; + + import android.app.ActivityManager; +@@ -7,24 +27,19 @@ import android.app.Service; + import android.content.BroadcastReceiver; + import android.content.ComponentName; + import android.content.Context; +-import android.content.IIntentReceiver; +-import android.content.IIntentSender; + import android.content.Intent; + import android.content.IntentFilter; +-import android.content.IntentSender; + import android.content.om.IOverlayManager; + import android.content.om.OverlayInfo; + import android.content.pm.IPackageDeleteObserver; + import android.content.pm.IPackageInstallObserver2; + import android.content.pm.IPackageManager; +-import android.content.pm.PackageInstaller; + import android.content.pm.PackageManager; + import android.content.pm.PackageManager.NameNotFoundException; + import android.content.res.AssetManager; + import android.content.res.Configuration; + import android.graphics.Typeface; + import android.media.RingtoneManager; +-import android.os.Binder; + import android.os.Bundle; + import android.os.Environment; + import android.os.FileUtils; +@@ -42,42 +57,21 @@ import android.provider.Settings; + import android.text.TextUtils; + import android.util.Log; + +-import java.io.BufferedInputStream; +-import java.io.BufferedOutputStream; + import java.io.File; +-import java.io.FileInputStream; +-import java.io.FileNotFoundException; + import java.io.FileOutputStream; +-import java.io.IOException; + import java.io.InputStream; + import java.io.OutputStream; + import java.lang.reflect.Method; + import java.util.ArrayList; + import java.util.List; + import java.util.Locale; +-import java.util.concurrent.SynchronousQueue; +-import java.util.concurrent.TimeUnit; +-import java.util.zip.ZipEntry; +-import java.util.zip.ZipInputStream; ++import java.util.stream.Collectors; + + import masquerade.substratum.utils.IOUtils; + import masquerade.substratum.utils.SoundUtils; + +-import com.android.internal.statusbar.IStatusBarService; +- + public class JobService extends Service { +- private static final String TAG = JobService.class.getSimpleName(); +- private static final boolean DEBUG = true; +- +- private static final String MASQUERADE_TOKEN = "masquerade_token"; +- private static final String SUBSTRATUM_PACKAGE = "projekt.substratum"; +- private static final String[] AUTHORIZED_CALLERS = new String[] { +- SUBSTRATUM_PACKAGE, +- "masquerade.substratum" +- }; +- + public static final String INTENT_STATUS_CHANGED = "masquerade.substratum.STATUS_CHANGED"; +- + public static final String PRIMARY_COMMAND_KEY = "primary_command_key"; + public static final String JOB_TIME_KEY = "job_time_key"; + public static final String INSTALL_LIST_KEY = "install_list"; +@@ -109,20 +103,47 @@ public class JobService extends Service { + public static final String COMMAND_VALUE_MOVE = "move"; + public static final String COMMAND_VALUE_DELETE = "delete"; + public static final String COMMAND_VALUE_PROFILE = "profile"; +- ++ private static final String TAG = JobService.class.getSimpleName(); ++ private static final boolean DEBUG = true; ++ private static final String MASQUERADE_TOKEN = "masquerade_token"; ++ private static final String MASQUERADE_PACKAGE = "masquerade.substratum"; ++ private static final String SUBSTRATUM_PACKAGE = "projekt.substratum"; ++ private static final String[] AUTHORIZED_CALLERS = new String[]{ ++ MASQUERADE_PACKAGE, ++ SUBSTRATUM_PACKAGE, ++ }; + private static IOverlayManager mOMS; + private static IPackageManager mPM; +- +- private HandlerThread mWorker; ++ private final List mJobQueue = new ArrayList<>(0); + private JobHandler mJobHandler; + private MainHandler mMainHandler; +- private final List mJobQueue = new ArrayList<>(0); + private long mLastJobTime; + private boolean mIsRunning; + ++ private static IOverlayManager getOMS() { ++ if (mOMS == null) { ++ mOMS = IOverlayManager.Stub.asInterface( ++ ServiceManager.getService("overlay")); ++ } ++ return mOMS; ++ } ++ ++ private static IPackageManager getPM() { ++ if (mPM == null) { ++ mPM = IPackageManager.Stub.asInterface( ++ ServiceManager.getService("package")); ++ } ++ return mPM; ++ } ++ ++ public static void log(String msg) { ++ if (DEBUG) Log.e(TAG, msg); ++ } ++ + @Override + public void onCreate() { +- mWorker = new HandlerThread("BackgroundWorker", Process.THREAD_PRIORITY_BACKGROUND); ++ HandlerThread mWorker = new HandlerThread("BackgroundWorker", Process ++ .THREAD_PRIORITY_BACKGROUND); + mWorker.start(); + mJobHandler = new JobHandler(mWorker.getLooper()); + mMainHandler = new MainHandler(Looper.getMainLooper()); +@@ -137,39 +158,33 @@ public class JobService extends Service { + } + + // Don't run job if there is another running job +- mIsRunning = false; +- if (isProcessing()) mIsRunning = true; ++ mIsRunning = isProcessing(); + +- // filter out duplicate intents ++ // Filter out duplicate intents + long jobTime = intent.getLongExtra(JOB_TIME_KEY, 1); + if (jobTime == 1 || jobTime == mLastJobTime) { +- log("got empty jobtime or duplicate job time, aborting"); ++ log("Received empty job time or duplicate job time, aborting"); + return START_NOT_STICKY; + } + mLastJobTime = jobTime; + +- // must have a primary command ++ // Must have a primary command + String command = intent.getStringExtra(PRIMARY_COMMAND_KEY); + if (TextUtils.isEmpty(command)) { +- log("Got empty primary command, aborting"); ++ log("Received empty primary command, aborting"); + return START_NOT_STICKY; + } + +- // queue up the job +- ++ // Queue up the job + List jobs_to_add = new ArrayList<>(0); + +- log("Starting job with primary command " + command + " With job time " + jobTime); ++ log("Starting job with primary command \'" + command + "\', with job time: " + jobTime); + if (TextUtils.equals(command, COMMAND_VALUE_INSTALL)) { + List paths = intent.getStringArrayListExtra(INSTALL_LIST_KEY); +- for (String path : paths) { +- jobs_to_add.add(new Installer(path)); +- } ++ jobs_to_add.addAll(paths.stream().map(Installer::new).collect(Collectors.toList())); + } else if (TextUtils.equals(command, COMMAND_VALUE_UNINSTALL)) { + List packages = intent.getStringArrayListExtra(UNINSTALL_LIST_KEY); +- for (String _package : packages) { +- jobs_to_add.add(new Remover(_package)); +- } ++ jobs_to_add.addAll(packages.stream().map(Remover::new).collect(Collectors.toList())); + if (shouldRestartUi(packages)) jobs_to_add.add(new UiResetJob()); + } else if (TextUtils.equals(command, COMMAND_VALUE_RESTART_UI)) { + jobs_to_add.add(new UiResetJob()); +@@ -194,15 +209,11 @@ public class JobService extends Service { + jobs_to_add.add(new UiResetJob()); + } else if (TextUtils.equals(command, COMMAND_VALUE_ENABLE)) { + List packages = intent.getStringArrayListExtra(ENABLE_LIST_KEY); +- for (String _package : packages) { +- jobs_to_add.add(new Enabler(_package)); +- } ++ jobs_to_add.addAll(packages.stream().map(Enabler::new).collect(Collectors.toList())); + if (shouldRestartUi(packages)) jobs_to_add.add(new UiResetJob()); + } else if (TextUtils.equals(command, COMMAND_VALUE_DISABLE)) { + List packages = intent.getStringArrayListExtra(DISABLE_LIST_KEY); +- for (String _package : packages) { +- jobs_to_add.add(new Disabler(_package)); +- } ++ jobs_to_add.addAll(packages.stream().map(Disabler::new).collect(Collectors.toList())); + if (shouldRestartUi(packages)) jobs_to_add.add(new UiResetJob()); + } else if (TextUtils.equals(command, COMMAND_VALUE_PRIORITY)) { + List packages = intent.getStringArrayListExtra(PRIORITY_LIST_KEY); +@@ -241,7 +252,6 @@ public class JobService extends Service { + mJobHandler.sendEmptyMessage(JobHandler.MESSAGE_CHECK_QUEUE); + } + } +- + return START_NOT_STICKY; + } + +@@ -252,35 +262,13 @@ public class JobService extends Service { + + @Override + public void onDestroy() { +- + } + + private boolean isProcessing() { + return mJobQueue.size() > 0; + } + +- private class LocalService extends Binder { +- public JobService getService() { +- return JobService.this; +- } +- } +- +- private static IOverlayManager getOMS() { +- if (mOMS == null) { +- mOMS = IOverlayManager.Stub.asInterface( +- ServiceManager.getService("overlay")); +- } +- return mOMS; +- } +- +- private static IPackageManager getPM() { +- if (mPM == null) { +- mPM = IPackageManager.Stub.asInterface( +- ServiceManager.getService("package")); +- } +- return mPM; +- } +- ++ @SuppressWarnings("deprecation") + private void install(String path, IPackageInstallObserver2 observer) { + try { + getPM().installPackageAsUser(path, observer, +@@ -292,6 +280,7 @@ public class JobService extends Service { + } + } + ++ @SuppressWarnings("deprecation") + private void uninstall(String packageName, IPackageDeleteObserver observer) { + try { + getPM().deletePackageAsUser(packageName, observer, 0, UserHandle.USER_SYSTEM); +@@ -315,7 +304,7 @@ public class JobService extends Service { + if (info != null) { + enabled = info.isEnabled(); + } else { +- log("info is null"); ++ log("OverlayInfo is null."); + } + } catch (RemoteException e) { + e.printStackTrace(); +@@ -331,24 +320,25 @@ public class JobService extends Service { + } + + private void copyFonts(String pid, String zipFileName) { +- // prepare local cache dir for font package assembly ++ // Prepare local cache dir for font package assembly + log("Copy Fonts - Package ID = " + pid + " filename = " + zipFileName); + File cacheDir = new File(getCacheDir(), "/FontCache/"); + if (cacheDir.exists()) { + IOUtils.deleteRecursive(cacheDir); + } +- cacheDir.mkdir(); ++ boolean created = cacheDir.mkdir(); ++ if (!created) log("Could not create cache directory..."); + +- // copy system fonts into our cache dir ++ // Copy system fonts into our cache dir + IOUtils.copyFolder("/system/fonts", cacheDir.getAbsolutePath()); + +- // append zip to filename since it is probably removed ++ // Append zip to filename since it is probably removed + // for list presentation + if (!zipFileName.endsWith(".zip")) { + zipFileName = zipFileName + ".zip"; + } + +- // copy target themed fonts zip to our cache dir ++ // Copy target themed fonts zip to our cache dir + Context themeContext = getAppContext(pid); + AssetManager am = themeContext.getAssets(); + try { +@@ -360,12 +350,13 @@ public class JobService extends Service { + e.printStackTrace(); + } + +- // unzip new fonts and delete zip file, overwriting any system fonts ++ // Unzip new fonts and delete zip file, overwriting any system fonts + File fontZip = new File(getCacheDir(), "/FontCache/" + zipFileName); + IOUtils.unzip(fontZip.getAbsolutePath(), cacheDir.getAbsolutePath()); +- fontZip.delete(); ++ boolean deleted = fontZip.delete(); ++ if (!deleted) log("Could not delete ZIP file..."); + +- // check if theme zip included a fonts.xml. If not, Substratum ++ // Check if theme zip included a fonts.xml. If not, Substratum + // is kind enough to provide one for us in it's assets + try { + File testConfig = new File(getCacheDir(), "/FontCache/" + "fonts.xml"); +@@ -380,12 +371,12 @@ public class JobService extends Service { + e.printStackTrace(); + } + +- // prepare system theme fonts folder and copy new fonts folder from our cache ++ // Prepare system theme fonts folder and copy new fonts folder from our cache + IOUtils.deleteThemedFonts(); + IOUtils.createFontDirIfNotExists(); + IOUtils.copyFolder(cacheDir.getAbsolutePath(), IOUtils.SYSTEM_THEME_FONT_PATH); + +- // let system know it's time for a font change ++ // Let system know it's time for a font change + refreshFonts(); + } + +@@ -395,7 +386,7 @@ public class JobService extends Service { + } + + private void refreshFonts() { +- // set permissions on font files and config xml ++ // Set permissions on font files and config xml + File themeFonts = new File(IOUtils.SYSTEM_THEME_FONT_PATH); + if (themeFonts.exists()) { + // Set permissions +@@ -404,7 +395,7 @@ public class JobService extends Service { + FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IROTH | FileUtils.S_IXOTH); + } + +- // let system know it's time for a font change ++ // Let system know it's time for a font change + SystemProperties.set("sys.refresh_theme", "1"); + Typeface.recreateDefaults(); + float fontSize = Float.valueOf(Settings.System.getString( +@@ -414,21 +405,23 @@ public class JobService extends Service { + } + + private void applyThemedSounds(String pid, String zipFileName) { +- // prepare local cache dir for font package assembly +- log("Copy sounds - Package ID = " + pid + " filename = " + zipFileName); ++ // Prepare local cache dir for font package assembly ++ log("CopySounds - Package ID = \'" + pid + "\'"); ++ log("CopySounds - File name = \'" + zipFileName + "\'"); + File cacheDir = new File(getCacheDir(), "/SoundsCache/"); + if (cacheDir.exists()) { + IOUtils.deleteRecursive(cacheDir); + } +- cacheDir.mkdir(); ++ boolean created = cacheDir.mkdir(); ++ if (!created) log("Could not create cache directory..."); + +- // append zip to filename since it is probably removed ++ // Append zip to filename since it is probably removed + // for list presentation + if (!zipFileName.endsWith(".zip")) { + zipFileName = zipFileName + ".zip"; + } + +- // copy target themed sounds zip to our cache dir ++ // Copy target themed sounds zip to our cache dir + Context themeContext = getAppContext(pid); + AssetManager am = themeContext.getAssets(); + try { +@@ -440,10 +433,11 @@ public class JobService extends Service { + e.printStackTrace(); + } + +- // unzip new sounds and delete zip file ++ // Unzip new sounds and delete zip file + File soundsZip = new File(getCacheDir(), "/SoundsCache/" + zipFileName); + IOUtils.unzip(soundsZip.getAbsolutePath(), cacheDir.getAbsolutePath()); +- soundsZip.delete(); ++ boolean deleted = soundsZip.delete(); ++ if (!deleted) log("Could not delete ZIP file..."); + + clearSounds(this); + IOUtils.createAudioDirIfNotExists(); +@@ -454,30 +448,38 @@ public class JobService extends Service { + File effect_tick_mp3 = new File(getCacheDir(), "/SoundsCache/ui/Effect_Tick.mp3"); + File effect_tick_ogg = new File(getCacheDir(), "/SoundsCache/ui/Effect_Tick.ogg"); + if (effect_tick_ogg.exists()) { +- IOUtils.bufferedCopy(effect_tick_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Effect_Tick.ogg")); ++ IOUtils.bufferedCopy(effect_tick_ogg, new File(IOUtils ++ .SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Effect_Tick.ogg")); + } else if (effect_tick_mp3.exists()) { +- IOUtils.bufferedCopy(effect_tick_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Effect_Tick.mp3")); ++ IOUtils.bufferedCopy(effect_tick_mp3, new File(IOUtils ++ .SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Effect_Tick.mp3")); + } + File new_lock_mp3 = new File(getCacheDir(), "/SoundsCache/ui/Lock.mp3"); + File new_lock_ogg = new File(getCacheDir(), "/SoundsCache/ui/Lock.ogg"); + if (new_lock_ogg.exists()) { +- IOUtils.bufferedCopy(new_lock_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Lock.ogg")); ++ IOUtils.bufferedCopy(new_lock_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + ++ File.separator + "Lock.ogg")); + } else if (new_lock_mp3.exists()) { +- IOUtils.bufferedCopy(new_lock_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Lock.mp3")); ++ IOUtils.bufferedCopy(new_lock_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + ++ File.separator + "Lock.mp3")); + } + File new_unlock_mp3 = new File(getCacheDir(), "/SoundsCache/ui/Unlock.mp3"); + File new_unlock_ogg = new File(getCacheDir(), "/SoundsCache/ui/Unlock.ogg"); + if (new_unlock_ogg.exists()) { +- IOUtils.bufferedCopy(new_unlock_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Unlock.ogg")); ++ IOUtils.bufferedCopy(new_unlock_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH ++ + File.separator + "Unlock.ogg")); + } else if (new_unlock_mp3.exists()) { +- IOUtils.bufferedCopy(new_unlock_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "Unlock.mp3")); ++ IOUtils.bufferedCopy(new_unlock_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH ++ + File.separator + "Unlock.mp3")); + } + File new_lowbattery_mp3 = new File(getCacheDir(), "/SoundsCache/ui/LowBattery.mp3"); + File new_lowbattery_ogg = new File(getCacheDir(), "/SoundsCache/ui/LowBattery.ogg"); + if (new_lowbattery_ogg.exists()) { +- IOUtils.bufferedCopy(new_lowbattery_ogg, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "LowBattery.ogg")); ++ IOUtils.bufferedCopy(new_lowbattery_ogg, new File(IOUtils ++ .SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "LowBattery.ogg")); + } else if (new_lowbattery_mp3.exists()) { +- IOUtils.bufferedCopy(new_lowbattery_mp3, new File(IOUtils.SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "LowBattery.mp3")); ++ IOUtils.bufferedCopy(new_lowbattery_mp3, new File(IOUtils ++ .SYSTEM_THEME_UI_SOUNDS_PATH + File.separator + "LowBattery.mp3")); + } + } + File alarmCache = new File(getCacheDir(), "/SoundsCache/alarms/"); +@@ -486,20 +488,26 @@ public class JobService extends Service { + File new_alarm_mp3 = new File(getCacheDir(), "/SoundsCache/alarms/alarm.mp3"); + File new_alarm_ogg = new File(getCacheDir(), "/SoundsCache/alarms/alarm.ogg"); + if (new_alarm_ogg.exists()) { +- IOUtils.bufferedCopy(new_alarm_ogg, new File(IOUtils.SYSTEM_THEME_ALARM_PATH + File.separator + "alarm.ogg")); ++ IOUtils.bufferedCopy(new_alarm_ogg, new File(IOUtils.SYSTEM_THEME_ALARM_PATH + ++ File.separator + "alarm.ogg")); + } else if (new_alarm_mp3.exists()) { +- IOUtils.bufferedCopy(new_alarm_mp3, new File(IOUtils.SYSTEM_THEME_ALARM_PATH + File.separator + "alarm.mp3")); ++ IOUtils.bufferedCopy(new_alarm_mp3, new File(IOUtils.SYSTEM_THEME_ALARM_PATH + ++ File.separator + "alarm.mp3")); + } + } + File notifCache = new File(getCacheDir(), "/SoundsCache/notifications/"); + if (notifCache.exists() && notifCache.isDirectory()) { + IOUtils.createNotificationDirIfNotExists(); +- File new_notif_mp3 = new File(getCacheDir(), "/SoundsCache/notifications/notification.mp3"); +- File new_notif_ogg = new File(getCacheDir(), "/SoundsCache/notifications/notification.ogg"); ++ File new_notif_mp3 = new File(getCacheDir(), "/SoundsCache/notifications/notification" + ++ ".mp3"); ++ File new_notif_ogg = new File(getCacheDir(), "/SoundsCache/notifications/notification" + ++ ".ogg"); + if (new_notif_ogg.exists()) { +- IOUtils.bufferedCopy(new_notif_ogg, new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH + File.separator + "notification.ogg")); ++ IOUtils.bufferedCopy(new_notif_ogg, new File(IOUtils ++ .SYSTEM_THEME_NOTIFICATION_PATH + File.separator + "notification.ogg")); + } else if (new_notif_mp3.exists()) { +- IOUtils.bufferedCopy(new_notif_mp3, new File(IOUtils.SYSTEM_THEME_NOTIFICATION_PATH + File.separator + "notification.mp3")); ++ IOUtils.bufferedCopy(new_notif_mp3, new File(IOUtils ++ .SYSTEM_THEME_NOTIFICATION_PATH + File.separator + "notification.mp3")); + } + } + File ringtoneCache = new File(getCacheDir(), "/SoundsCache/ringtones/"); +@@ -508,28 +516,30 @@ public class JobService extends Service { + File new_ring_mp3 = new File(getCacheDir(), "/SoundsCache/ringtones/ringtone.mp3"); + File new_ring_ogg = new File(getCacheDir(), "/SoundsCache/ringtones/ringtone.ogg"); + if (new_ring_ogg.exists()) { +- IOUtils.bufferedCopy(new_ring_ogg, new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH + File.separator + "ringtone.ogg")); ++ IOUtils.bufferedCopy(new_ring_ogg, new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH + ++ File.separator + "ringtone.ogg")); + } else if (new_ring_mp3.exists()) { +- IOUtils.bufferedCopy(new_ring_mp3, new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH + File.separator + "ringtone.mp3")); ++ IOUtils.bufferedCopy(new_ring_mp3, new File(IOUtils.SYSTEM_THEME_RINGTONE_PATH + ++ File.separator + "ringtone.mp3")); + } + } + +- // let system know it's time for a sound change ++ // Let system know it's time for a sound change + refreshSounds(); + } + + private void clearSounds(Context ctx) { + IOUtils.deleteThemedAudio(); +- SoundUtils.setDefaultAudible(JobService.this, RingtoneManager.TYPE_ALARM); +- SoundUtils.setDefaultAudible(JobService.this, RingtoneManager.TYPE_NOTIFICATION); +- SoundUtils.setDefaultAudible(JobService.this, RingtoneManager.TYPE_RINGTONE); ++ SoundUtils.setDefaultAudible(ctx, RingtoneManager.TYPE_ALARM); ++ SoundUtils.setDefaultAudible(ctx, RingtoneManager.TYPE_NOTIFICATION); ++ SoundUtils.setDefaultAudible(ctx, RingtoneManager.TYPE_RINGTONE); + SoundUtils.setDefaultUISounds(getContentResolver(), "lock_sound", "Lock.ogg"); + SoundUtils.setDefaultUISounds(getContentResolver(), "unlock_sound", "Unlock.ogg"); + SoundUtils.setDefaultUISounds(getContentResolver(), "low_battery_sound", + "LowBattery.ogg"); + } + +- private void refreshSounds () { ++ private void refreshSounds() { + File soundsDir = new File(IOUtils.SYSTEM_THEME_AUDIO_PATH); + if (soundsDir.exists()) { + // Set permissions +@@ -644,13 +654,15 @@ public class JobService extends Service { + } + } + } ++ + private void copyBootAnimation(String fileName) { + try { + clearBootAnimation(); + File source = new File(fileName); + File dest = new File(IOUtils.SYSTEM_THEME_BOOTANIMATION_PATH); + IOUtils.bufferedCopy(source, dest); +- source.delete(); ++ boolean deleted = source.delete(); ++ if (!deleted) log("Could not delete source file..."); + IOUtils.setPermissions(dest, + FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IROTH); + } catch (Exception e) { +@@ -662,21 +674,25 @@ public class JobService extends Service { + try { + File f = new File(IOUtils.SYSTEM_THEME_BOOTANIMATION_PATH); + if (f.exists()) { +- f.delete(); ++ boolean deleted = f.delete(); ++ if (!deleted) log("Could not delete themed boot animation..."); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + ++ @SuppressWarnings({"unchecked", "ConfusingArgumentToVarargsMethod"}) + private void restartUi() { + try { + ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE); + Class ActivityManagerNative = Class.forName("android.app.ActivityManagerNative"); + Method getDefault = ActivityManagerNative.getDeclaredMethod("getDefault", null); + Object amn = getDefault.invoke(null, null); +- Method killApplicationProcess = amn.getClass().getDeclaredMethod("killApplicationProcess", String.class, int.class); +- stopService(new Intent().setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService"))); ++ Method killApplicationProcess = amn.getClass().getDeclaredMethod ++ ("killApplicationProcess", String.class, int.class); ++ stopService(new Intent().setComponent(new ComponentName("com.android.systemui", "com" + ++ ".android.systemui.SystemUIService"))); + am.killBackgroundProcesses("com.android.systemui"); + for (ActivityManager.RunningAppProcessInfo app : am.getRunningAppProcesses()) { + if ("com.android.systemui".equals(app.processName)) { +@@ -689,15 +705,6 @@ public class JobService extends Service { + } + } + +- private void killPackage(String packageName) { +- try { +- ActivityManagerNative.getDefault().forceStopPackage(packageName, +- UserHandle.USER_SYSTEM); +- } catch (RemoteException e) { +- e.printStackTrace(); +- } +- } +- + private Context getSubsContext() { + return getAppContext(SUBSTRATUM_PACKAGE); + } +@@ -713,45 +720,38 @@ public class JobService extends Service { + return ctx; + } + +- public static void log(String msg) { +- if (DEBUG) { +- Log.e(TAG, msg); +- } +- } +- + private boolean isCallerAuthorized(Intent intent) { + PendingIntent token = null; + try { +- token = (PendingIntent) intent.getParcelableExtra(MASQUERADE_TOKEN); ++ token = intent.getParcelableExtra(MASQUERADE_TOKEN); + } catch (Exception e) { +- log("Attempt to start serivce without a token, unauthorized"); +- } +- if (token == null) { +- return false; ++ log("Attempting to start service without a token - unauthorized!"); + } +- // SECOND: we got a token, validate originating package +- // if not in our whitelist, return null ++ if (token == null) return false; ++ // SECOND: We got a token, validate originating package ++ // if not in our white list, return null + String callingPackage = token.getCreatorPackage(); + boolean isValidPackage = false; +- for (int i = 0; i < AUTHORIZED_CALLERS.length; i++) { +- if (TextUtils.equals(callingPackage, AUTHORIZED_CALLERS[i])) { +- log(callingPackage +- + " is an authorized calling package, next validate calling package perms"); ++ for (String AUTHORIZED_CALLER : AUTHORIZED_CALLERS) { ++ if (TextUtils.equals(callingPackage, AUTHORIZED_CALLER)) { ++ log("\'" + callingPackage ++ + "\' is an authorized calling package, validating calling package " + ++ "permissions..."); + isValidPackage = true; + break; + } + } + if (!isValidPackage) { +- log(callingPackage + " is not an authorized calling package"); ++ log("\'" + callingPackage + "\' is not an authorized calling package."); + return false; + } + return true; + } + + private class MainHandler extends Handler { +- public static final int MSG_JOB_QUEUE_EMPTY = 1; ++ static final int MSG_JOB_QUEUE_EMPTY = 1; + +- public MainHandler(Looper looper) { ++ MainHandler(Looper looper) { + super(looper); + } + +@@ -771,7 +771,7 @@ public class JobService extends Service { + private static final int MESSAGE_CHECK_QUEUE = 1; + private static final int MESSAGE_DEQUEUE = 2; + +- public JobHandler(Looper looper) { ++ JobHandler(Looper looper) { + super(looper); + } + +@@ -783,9 +783,7 @@ public class JobService extends Service { + synchronized (mJobQueue) { + job = mJobQueue.get(0); + } +- if (job != null && !mIsRunning) { +- job.run(); +- } ++ if (job != null && !mIsRunning) job.run(); + break; + case MESSAGE_DEQUEUE: + Runnable toRemove = (Runnable) msg.obj; +@@ -796,7 +794,7 @@ public class JobService extends Service { + this.sendEmptyMessage(MESSAGE_CHECK_QUEUE); + } else { + mIsRunning = false; +- log("Job queue empty! All done"); ++ log("Job queue is empty. All done!"); + mMainHandler.sendEmptyMessage(MainHandler.MSG_JOB_QUEUE_EMPTY); + } + } +@@ -808,23 +806,6 @@ public class JobService extends Service { + } + } + +- private class StopPackageJob implements Runnable { +- String mPackage; +- +- public void StopPackageJob(String _package) { +- mPackage = _package; +- } +- +- @Override +- public void run() { +- killPackage(mPackage); +- log("Killed package " + mPackage); +- Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, +- StopPackageJob.this); +- mJobHandler.sendMessage(message); +- } +- } +- + private class UiResetJob implements Runnable { + @Override + public void run() { +@@ -841,7 +822,7 @@ public class JobService extends Service { + String mPid; + String mFileName; + +- public FontsJob(String pid, String fileName) { ++ FontsJob(String pid, String fileName) { + if (pid == null) { + mClear = true; + } else { +@@ -853,10 +834,10 @@ public class JobService extends Service { + @Override + public void run() { + if (mClear) { +- log("Resetting system font"); ++ log("Restoring system font..."); + clearFonts(); + } else { +- log("Setting theme font"); ++ log("Configuring theme font..."); + copyFonts(mPid, mFileName); + } + Intent intent = new Intent(INTENT_STATUS_CHANGED); +@@ -873,7 +854,7 @@ public class JobService extends Service { + String mPid; + String mFileName; + +- public SoundsJob(String pid, String fileName) { ++ SoundsJob(String pid, String fileName) { + if (pid == null) { + mClear = true; + } else { +@@ -885,10 +866,10 @@ public class JobService extends Service { + @Override + public void run() { + if (mClear) { +- log("Resetting system sounds"); ++ log("Restoring system sounds..."); + clearSounds(JobService.this); + } else { +- log("Setting theme sounds"); ++ log("Configuring theme sounds..."); + applyThemedSounds(mPid, mFileName); + } + Intent intent = new Intent(INTENT_STATUS_CHANGED); +@@ -901,14 +882,14 @@ public class JobService extends Service { + } + + private class BootAnimationJob implements Runnable { +- String mFileName; + final boolean mClear; ++ String mFileName; + +- public BootAnimationJob(boolean clear) { +- mClear = true; ++ BootAnimationJob(boolean clear) { ++ mClear = clear; + } + +- public BootAnimationJob(String fileName) { ++ BootAnimationJob(String fileName) { + mFileName = fileName; + mClear = false; + } +@@ -916,10 +897,10 @@ public class JobService extends Service { + @Override + public void run() { + if (mClear) { +- log("Resetting system boot animation"); ++ log("Restoring system boot animation..."); + clearBootAnimation(); + } else { +- log("Setting themed boot animation"); ++ log("Configuring themed boot animation..."); + copyBootAnimation(mFileName); + } + Intent intent = new Intent(INTENT_STATUS_CHANGED); +@@ -934,13 +915,13 @@ public class JobService extends Service { + private class Installer implements Runnable { + String mPath; + +- public Installer(String path) { ++ Installer(String path) { + mPath = path; + } + + @Override + public void run() { +- log("Installer - installing " + mPath); ++ log("Installer - installing \'" + mPath + "\'..."); + PackageInstallObserver observer = new PackageInstallObserver(Installer.this); + install(mPath, observer); + } +@@ -949,7 +930,7 @@ public class JobService extends Service { + private class PackageInstallObserver extends IPackageInstallObserver2.Stub { + Object mObject; + +- public PackageInstallObserver(Object _object) { ++ PackageInstallObserver(Object _object) { + mObject = _object; + } + +@@ -957,8 +938,9 @@ public class JobService extends Service { + log("Installer - user action required callback"); + } + +- public void onPackageInstalled(String packageName, int returnCode, String msg, Bundle extras) { +- log("Installer - successfully installed " + packageName); ++ public void onPackageInstalled(String packageName, int returnCode, String msg, Bundle ++ extras) { ++ log("Installer - successfully installed \'" + packageName + "\'!"); + Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, mObject); + mJobHandler.sendMessage(message); + } +@@ -967,20 +949,19 @@ public class JobService extends Service { + private class Remover implements Runnable { + String mPackage; + +- public Remover(String _package) { ++ Remover(String _package) { + mPackage = _package; + } + + @Override + public void run() { +- + // TODO: Fix isOverlayEnabled function, for now it's causing NPE + if (isOverlayEnabled(mPackage)) { +- log("Remover - disabling overlay for " + mPackage); ++ log("Remover - disabling overlay for \'" + mPackage + "\'..."); + switchOverlay(mPackage, false); + } + +- log("Remover - uninstalling " + mPackage); ++ log("Remover - uninstalling \'" + mPackage + "\'..."); + PackageDeleteObserver observer = new PackageDeleteObserver(Remover.this); + uninstall(mPackage, observer); + } +@@ -989,12 +970,12 @@ public class JobService extends Service { + private class PackageDeleteObserver extends IPackageDeleteObserver.Stub { + Object mObject; + +- public PackageDeleteObserver(Object _object) { ++ PackageDeleteObserver(Object _object) { + mObject = _object; + } + + public void packageDeleted(String packageName, int returnCode) { +- log("Remover - successfully removed " + packageName); ++ log("Remover - successfully removed \'" + packageName + "\'"); + Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, mObject); + mJobHandler.sendMessage(message); + } +@@ -1003,13 +984,13 @@ public class JobService extends Service { + private class Enabler implements Runnable { + String mPackage; + +- public Enabler(String _package) { ++ Enabler(String _package) { + mPackage = _package; + } + + @Override + public void run() { +- log("Enabler - enabling overlay for " + mPackage); ++ log("Enabler - enabling overlay for \'" + mPackage + "\'..."); + switchOverlay(mPackage, true); + Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, + Enabler.this); +@@ -1020,13 +1001,13 @@ public class JobService extends Service { + private class Disabler implements Runnable { + String mPackage; + +- public Disabler(String _package) { ++ Disabler(String _package) { + mPackage = _package; + } + + @Override + public void run() { +- log("Disabler - disabling overlay for " + mPackage); ++ log("Disabler - disabling overlay for \'" + mPackage + "\'..."); + switchOverlay(mPackage, false); + Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, + Disabler.this); +@@ -1037,18 +1018,18 @@ public class JobService extends Service { + private class PriorityJob implements Runnable { + List mPackages; + +- public PriorityJob(List _packages) { ++ PriorityJob(List _packages) { + mPackages = _packages; + } + + @Override + public void run() { +- log("PriorityJob - processing priority changes"); ++ log("PriorityJob - processing priority changes..."); + try { + int size = mPackages.size(); +- for (int i = 0; i < size-1; i++) { ++ for (int i = 0; i < size - 1; i++) { + String parentName = mPackages.get(i); +- String packageName = mPackages.get(i+1); ++ String packageName = mPackages.get(i + 1); + getOMS().setPriority(packageName, parentName, UserHandle.USER_SYSTEM); + } + } catch (RemoteException e) { +@@ -1064,14 +1045,14 @@ public class JobService extends Service { + String mSource; + String mDestination; + +- public CopyJob(String _source, String _destination) { ++ CopyJob(String _source, String _destination) { + mSource = _source; + mDestination = _destination; + } + + @Override + public void run() { +- log("CopyJob - copying " + mSource + " to " + mDestination); ++ log("CopyJob - copying \'" + mSource + "\' to \'" + mDestination + "\'..."); + File sourceFile = new File(mSource); + if (sourceFile.exists()) { + if (sourceFile.isFile()) { +@@ -1080,7 +1061,7 @@ public class JobService extends Service { + IOUtils.copyFolder(mSource, mDestination); + } + } else { +- log("CopyJob - " + mSource + " is not exist! aborting..."); ++ log("CopyJob - \'" + mSource + "\' does not exist, aborting..."); + } + Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, + CopyJob.this); +@@ -1092,14 +1073,14 @@ public class JobService extends Service { + String mSource; + String mDestination; + +- public MoveJob(String _source, String _destination) { ++ MoveJob(String _source, String _destination) { + mSource = _source; + mDestination = _destination; + } + + @Override + public void run() { +- log("MoveJob - moving " + mSource + " to " + mDestination); ++ log("MoveJob - moving \'" + mSource + "\' to \'" + mDestination + "\'..."); + File sourceFile = new File(mSource); + if (sourceFile.exists()) { + if (sourceFile.isFile()) { +@@ -1109,7 +1090,7 @@ public class JobService extends Service { + } + IOUtils.deleteRecursive(sourceFile); + } else { +- log("MoveJob - " + mSource + " is not exist! aborting..."); ++ log("MoveJob - \'" + mSource + "\' does not exist, aborting..."); + } + Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, + MoveJob.this); +@@ -1120,18 +1101,18 @@ public class JobService extends Service { + private class DeleteJob implements Runnable { + String mFileOrDirectory; + +- public DeleteJob(String _directory) { ++ DeleteJob(String _directory) { + mFileOrDirectory = _directory; + } + + @Override + public void run() { +- log("DeleteJob - deleting " + mFileOrDirectory); ++ log("DeleteJob - deleting \'" + mFileOrDirectory + "\'..."); + File file = new File(mFileOrDirectory); + if (file.exists()) { + IOUtils.deleteRecursive(file); + } else { +- log("DeleteJob - " + mFileOrDirectory + " is already deleted!"); ++ log("DeleteJob - \'" + mFileOrDirectory + "\' is already deleted."); + } + Message message = mJobHandler.obtainMessage(JobHandler.MESSAGE_DEQUEUE, + DeleteJob.this); +@@ -1144,7 +1125,7 @@ public class JobService extends Service { + List mToBeDisabled; + List mToBeEnabled; + +- public ProfileJob(String _name, List _toBeDisabled, List _toBeEnabled) { ++ ProfileJob(String _name, List _toBeDisabled, List _toBeEnabled) { + mProfileName = _name; + mToBeDisabled = _toBeDisabled; + mToBeEnabled = _toBeEnabled; +@@ -1152,7 +1133,7 @@ public class JobService extends Service { + + @Override + public void run() { +- boolean restartUi = false; ++ boolean restartUi; + log("Applying profile..."); + + // Need to restart SystemUI? +@@ -1201,7 +1182,7 @@ public class JobService extends Service { + + // Restart SystemUI when needed + if (restartUi) { +- synchronized(mJobQueue) { ++ synchronized (mJobQueue) { + mJobQueue.add(new UiResetJob()); + } + } +@@ -1214,7 +1195,6 @@ public class JobService extends Service { + + private class LocaleChanger extends BroadcastReceiver implements Runnable { + private boolean mIsRegistered; +- private boolean mDoRestore; + private Context mContext; + private Handler mHandler; + private Locale mCurrentLocale; +@@ -1229,12 +1209,7 @@ public class JobService extends Service { + Intent i = new Intent(Intent.ACTION_MAIN); + i.addCategory(Intent.CATEGORY_HOME); + mContext.startActivity(i); +- mHandler.postDelayed(new Runnable() { +- @Override +- public void run() { +- spoofLocale(); +- } +- }, 500); ++ mHandler.postDelayed(this::spoofLocale, 500); + } + + private void register() { +@@ -1253,9 +1228,10 @@ public class JobService extends Service { + } + } + ++ @SuppressWarnings("deprecation") + private void spoofLocale() { + Configuration config; +- log("LocaleChanger - spoofing locale for configuation change shim"); ++ log("LocaleChanger - spoofing locale for configuration change shim..."); + try { + register(); + config = ActivityManagerNative.getDefault().getConfiguration(); +@@ -1269,13 +1245,12 @@ public class JobService extends Service { + ActivityManagerNative.getDefault().updateConfiguration(config); + } catch (RemoteException e) { + e.printStackTrace(); +- return; + } + } + + private void restoreLocale() { + Configuration config; +- log("LocaleChanger - restoring original locale for configuation change shim"); ++ log("LocaleChanger - restoring original locale for configuration change shim..."); + try { + unregister(); + config = ActivityManagerNative.getDefault().getConfiguration(); +@@ -1293,40 +1268,7 @@ public class JobService extends Service { + + @Override + public void onReceive(Context context, Intent intent) { +- mHandler.postDelayed(new Runnable() { +- @Override +- public void run() { +- restoreLocale(); +- } +- }, 500); +- } +- } +- +- private static class LocalIntentReceiver { +- private final SynchronousQueue mResult = new SynchronousQueue<>(); +- +- private IIntentSender.Stub mLocalSender = new IIntentSender.Stub() { +- @Override +- public void send(int code, Intent intent, String resolvedType, +- IIntentReceiver finishedReceiver, String requiredPermission, Bundle options) { +- try { +- mResult.offer(intent, 5, TimeUnit.SECONDS); +- } catch (InterruptedException e) { +- throw new RuntimeException(e); +- } +- } +- }; +- +- public IntentSender getIntentSender() { +- return new IntentSender((IIntentSender) mLocalSender); +- } +- +- public Intent getResult() { +- try { +- return mResult.take(); +- } catch (InterruptedException e) { +- throw new RuntimeException(e); +- } ++ mHandler.postDelayed(this::restoreLocale, 500); + } + } + } +diff --git a/app/src/main/java/masquerade/substratum/services/MasqDemo.java b/app/src/main/java/masquerade/substratum/services/MasqDemo.java +deleted file mode 100644 +index b00d6e0..0000000 +--- a/app/src/main/java/masquerade/substratum/services/MasqDemo.java ++++ /dev/null +@@ -1,137 +0,0 @@ +- +-package masquerade.substratum.services; +- +-import java.util.ArrayList; +-import java.util.List; +- +-import android.app.PendingIntent; +-import android.content.BroadcastReceiver; +-import android.content.Context; +-import android.content.Intent; +-import android.text.TextUtils; +- +-public class MasqDemo { +- public static final String MASQUERADE_TOKEN = "masquerade_token"; +- public static final String PRIMARY_COMMAND_KEY = "primary_command_key"; +- public static final String JOB_TIME_KEY = "job_time_key"; +- public static final String INSTALL_LIST_KEY = "install_list"; +- public static final String UNINSTALL_LIST_KEY = "uninstall_list"; +- public static final String WITH_RESTART_UI_KEY = "with_restart_ui"; +- public static final String BOOTANIMATION_PID_KEY = "bootanimation_pid"; +- public static final String BOOTANIMATION_FILE_NAME = "bootanimation_file_name"; +- public static final String FONTS_PID = "fonts_pid"; +- public static final String FONTS_FILENAME = "fonts_filename"; +- public static final String AUDIO_PID = "audio_pid"; +- public static final String AUDIO_FILENAME = "audio_filename"; +- public static final String COMMAND_VALUE_INSTALL = "install"; +- public static final String COMMAND_VALUE_UNINSTALL = "uninstall"; +- public static final String COMMAND_VALUE_RESTART_UI = "restart_ui"; +- public static final String COMMAND_VALUE_CONFIGURATION_SHIM = "configuration_shim"; +- public static final String COMMAND_VALUE_BOOTANIMATION = "bootanimation"; +- public static final String COMMAND_VALUE_FONTS = "fonts"; +- public static final String COMMAND_VALUE_AUDIO = "audio"; +- public static final String INTENT_STATUS_CHANGED = "masquerade.substratum.STATUS_CHANGED"; +- public static final String COMMAND_VALUE_JOB_COMPLETE = "job_complete"; +- +- class MasqReceiver extends BroadcastReceiver { +- @Override +- public void onReceive(Context context, Intent intent) { +- if (TextUtils.equals(intent.getAction(), INTENT_STATUS_CHANGED)) { +- String command = intent.getStringExtra(PRIMARY_COMMAND_KEY); +- if (TextUtils.equals(command, COMMAND_VALUE_FONTS)) { +- // update ui, dismiss progress dialog, etc +- } else if (TextUtils.equals(command, COMMAND_VALUE_BOOTANIMATION)) { +- +- } else if (TextUtils.equals(command, COMMAND_VALUE_AUDIO)) { +- +- } else if (TextUtils.equals(command, COMMAND_VALUE_JOB_COMPLETE)) { +- +- } +- } +- } +- } +- +- // demo code for building a base intent for JobService commands +- public static Intent getMasqIntent(Context ctx) { +- Intent intent = new Intent(); +- intent.setClassName("masquerade.substratum", "masquerade.substratum.services.JobService"); +- // Credit StackOverflow http://stackoverflow.com/a/28132098 +- // Use dummy PendingIntent for service to validate caller at onBind +- PendingIntent pending = PendingIntent.getActivity(ctx, 0, new Intent(), 0); +- intent.putExtra(MASQUERADE_TOKEN, pending); +- intent.putExtra(JOB_TIME_KEY, System.currentTimeMillis()); +- return intent; +- } +- +- public static void install(Context context, ArrayList overlay_apks) { +- // populate list however +- Intent masqIntent = getMasqIntent(context); +- masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_INSTALL); +- masqIntent.putExtra(INSTALL_LIST_KEY, overlay_apks); +- context.startService(masqIntent); +- } +- +- public static void uninstall(Context context, ArrayList packages_to_remove) { +- Intent masqIntent = getMasqIntent(context); +- masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_UNINSTALL); +- masqIntent.putExtra(UNINSTALL_LIST_KEY, packages_to_remove); +- // only need to set if true, will restart SystemUI when done processing packages +- masqIntent.putExtra(WITH_RESTART_UI_KEY, true); +- context.startService(masqIntent); +- } +- +- public static void restartSystemUI(Context context) { +- Intent masqIntent = getMasqIntent(context); +- masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_RESTART_UI); +- context.startService(masqIntent); +- } +- +- public static void configurationChangeShim(Context context) { +- Intent masqIntent = getMasqIntent(context); +- masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_CONFIGURATION_SHIM); +- context.startService(masqIntent); +- } +- +- public static void clearThemedBootAnimation(Context context) { +- applyThemedBootAnimation(context, null); +- } +- +- public static void applyThemedBootAnimation(Context context, String fileName) { +- Intent masqIntent = getMasqIntent(context); +- masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_BOOTANIMATION); +- if (fileName != null) { +- masqIntent.putExtra(BOOTANIMATION_FILE_NAME, fileName); +- } else { +- // nothing. to reset to stock, just don't add PID and FILE +- } +- context.startService(masqIntent); +- } +- +- public static void clearThemedFont(Context context) { +- applyThemedFont(context, null, null); +- } +- +- public static void applyThemedFont(Context context, String pid, String fileName) { +- Intent masqIntent = getMasqIntent(context); +- masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_FONTS); +- if (pid != null) { +- masqIntent.putExtra(FONTS_PID, pid); +- masqIntent.putExtra(FONTS_FILENAME, fileName); +- } +- context.startService(masqIntent); +- } +- +- public static void clearThemedSounds(Context context) { +- applyThemedSounds(context, null, null); +- } +- +- public static void applyThemedSounds(Context context, String pid, String fileName) { +- Intent masqIntent = getMasqIntent(context); +- masqIntent.putExtra(PRIMARY_COMMAND_KEY, COMMAND_VALUE_AUDIO); +- if (pid != null) { +- masqIntent.putExtra(AUDIO_PID, pid); +- masqIntent.putExtra(AUDIO_FILENAME, fileName); +- } +- context.startService(masqIntent); +- } +-} +diff --git a/app/src/main/java/masquerade/substratum/utils/IOUtils.java b/app/src/main/java/masquerade/substratum/utils/IOUtils.java +index 06b5260..2f697c6 100644 +--- a/app/src/main/java/masquerade/substratum/utils/IOUtils.java ++++ b/app/src/main/java/masquerade/substratum/utils/IOUtils.java +@@ -1,6 +1,28 @@ ++/* ++ * Copyright (c) 2017 Project Substratum ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * Also add information on how to contact you by electronic and paper mail. ++ * ++ */ + + package masquerade.substratum.utils; + ++import android.os.FileUtils; ++import android.util.Log; ++ + import java.io.BufferedInputStream; + import java.io.BufferedOutputStream; + import java.io.File; +@@ -12,8 +34,6 @@ import java.io.OutputStream; + import java.util.zip.ZipEntry; + import java.util.zip.ZipInputStream; + +-import android.os.FileUtils; +- + public class IOUtils { + public static final String SYSTEM_THEME_PATH = "/data/system/theme"; + public static final String SYSTEM_THEME_FONT_PATH = SYSTEM_THEME_PATH + File.separator +@@ -31,12 +51,12 @@ public class IOUtils { + public static final String SYSTEM_THEME_BOOTANIMATION_PATH = SYSTEM_THEME_PATH + File.separator + + "bootanimation.zip"; + +- public static boolean dirExists(String dirPath) { ++ private static boolean dirExists(String dirPath) { + final File dir = new File(dirPath); + return dir.exists() && dir.isDirectory(); + } + +- public static void createDirIfNotExists(String dirPath) { ++ private static void createDirIfNotExists(String dirPath) { + if (!dirExists(dirPath)) { + File dir = new File(dirPath); + if (dir.mkdir()) { +@@ -90,7 +110,10 @@ public class IOUtils { + } + + public static void copyFolder(File source, File dest) { +- if (!dest.exists()) dest.mkdirs(); ++ if (!dest.exists()) { ++ boolean created = dest.mkdirs(); ++ if (!created) Log.e("CopyFolder", "Could not create destination folder..."); ++ } + File[] files = source.listFiles(); + for (File file : files) { + try { +@@ -172,7 +195,9 @@ public class IOUtils { + for (File child : fileOrDirectory.listFiles()) + deleteRecursive(child); + +- fileOrDirectory.delete(); ++ boolean deleted = fileOrDirectory.delete(); ++ if (!deleted) Log.e("DeleteRecursive", "Could not delete file or directory - \'" + ++ fileOrDirectory.getName() + "\'"); + } + + public static void setPermissions(File path, int permissions) { +diff --git a/app/src/main/java/masquerade/substratum/utils/SoundUtils.java b/app/src/main/java/masquerade/substratum/utils/SoundUtils.java +index dda38eb..73999ce 100644 +--- a/app/src/main/java/masquerade/substratum/utils/SoundUtils.java ++++ b/app/src/main/java/masquerade/substratum/utils/SoundUtils.java +@@ -1,9 +1,25 @@ ++/* ++ * Copyright (c) 2017 Project Substratum ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * Also add information on how to contact you by electronic and paper mail. ++ * ++ */ + + package masquerade.substratum.utils; + +-import java.io.File; +-import java.util.Arrays; +- + import android.content.ContentResolver; + import android.content.ContentValues; + import android.content.Context; +@@ -13,8 +29,11 @@ import android.net.Uri; + import android.os.SystemProperties; + import android.os.UserHandle; + import android.provider.MediaStore; +-import android.util.Log; + import android.provider.Settings; ++import android.util.Log; ++ ++import java.io.File; ++import java.util.Arrays; + + public class SoundUtils { + private static final String SYSTEM_MEDIA_PATH = "/system/media/audio"; +@@ -26,11 +45,12 @@ public class SoundUtils { + SYSTEM_MEDIA_PATH + File.separator + "notifications"; + private static final String MEDIA_CONTENT_URI = "content://media/internal/audio/media"; + +- public static void updateGlobalSettings(ContentResolver resolver, String uri, String val) { ++ private static void updateGlobalSettings(ContentResolver resolver, String uri, String val) { + Settings.Global.putStringForUser(resolver, uri, val, UserHandle.USER_SYSTEM); + } + +- public static boolean setUISounds(ContentResolver resolver, String sound_name, String location) { ++ public static boolean setUISounds(ContentResolver resolver, String sound_name, String ++ location) { + if (allowedUISound(sound_name)) { + updateGlobalSettings(resolver, sound_name, location); + return true; +@@ -39,12 +59,12 @@ public class SoundUtils { + } + + public static void setDefaultUISounds(ContentResolver resolver, String sound_name, +- String sound_file) { ++ String sound_file) { + updateGlobalSettings(resolver, sound_name, "/system/media/audio/ui/" + sound_file); + } + + // This string array contains all the SystemUI acceptable sound files +- public static Boolean allowedUISound(String targetValue) { ++ private static Boolean allowedUISound(String targetValue) { + String[] allowed_themable = { + "lock_sound", + "unlock_sound", +@@ -53,7 +73,7 @@ public class SoundUtils { + return Arrays.asList(allowed_themable).contains(targetValue); + } + +- public static String getDefaultAudiblePath(int type) { ++ private static String getDefaultAudiblePath(int type) { + final String name; + final String path; + switch (type) { +@@ -76,25 +96,8 @@ public class SoundUtils { + return path; + } + +- public static void clearAudibles(Context context, String audiblePath) { +- final File audibleDir = new File(audiblePath); +- if (audibleDir.exists() && audibleDir.isDirectory()) { +- String[] files = audibleDir.list(); +- final ContentResolver resolver = context.getContentResolver(); +- for (String s : files) { +- final String filePath = audiblePath + File.separator + s; +- Uri uri = MediaStore.Audio.Media.getContentUriForPath(filePath); +- resolver.delete(uri, MediaStore.MediaColumns.DATA + "=\"" +- + filePath + "\"", null); +- boolean deleted = (new File(filePath)).delete(); +- if (deleted) +- Log.e("SoundsHandler", "Database cleared"); +- } +- } +- } +- + public static boolean setAudible(Context context, File ringtone, File ringtoneCache, int type, +- String name) { ++ String name) { + final String path = ringtone.getAbsolutePath(); + final String mimeType = name.endsWith(".ogg") ? "application/ogg" : "application/mp3"; + ContentValues values = new ContentValues(); +@@ -111,8 +114,8 @@ public class SoundUtils { + Uri uri = MediaStore.Audio.Media.getContentUriForPath(path); + Uri newUri = null; + Cursor c = context.getContentResolver().query(uri, +- new String[] { +- MediaStore.MediaColumns._ID ++ new String[]{ ++ MediaStore.MediaColumns._ID + }, + MediaStore.MediaColumns.DATA + "='" + path + "'", + null, null); +@@ -135,7 +138,7 @@ public class SoundUtils { + } + + public static boolean setUIAudible(Context context, File localized_ringtone, +- File ringtone_file, int type, String name) { ++ File ringtone_file, int type, String name) { + final String path = ringtone_file.getAbsolutePath(); + + final String path_clone = "/system/media/audio/ui/" + name + ".ogg"; +@@ -153,8 +156,8 @@ public class SoundUtils { + Uri uri = MediaStore.Audio.Media.getContentUriForPath(path); + Uri newUri = null; + Cursor c = context.getContentResolver().query(uri, +- new String[] { +- MediaStore.MediaColumns._ID ++ new String[]{ ++ MediaStore.MediaColumns._ID + }, + MediaStore.MediaColumns.DATA + "='" + path_clone + "'", + null, null); +@@ -187,8 +190,8 @@ public class SoundUtils { + if (audiblePath != null) { + Uri uri = MediaStore.Audio.Media.getContentUriForPath(audiblePath); + Cursor c = context.getContentResolver().query(uri, +- new String[] { +- MediaStore.MediaColumns._ID ++ new String[]{ ++ MediaStore.MediaColumns._ID + }, + MediaStore.MediaColumns.DATA + "='" + audiblePath + "'", + null, null); +@@ -206,5 +209,4 @@ public class SoundUtils { + } + return true; + } +- + } +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 0000000000000000000000000000000000000000..2588952b8172c791022bc815d725d1157d46d6f3 +GIT binary patch +literal 2240 +zcma)-`9BkmAIIk^_5DzN3WZ@~MhUs*nqwPnwp@{7Ic7FFH@McVcLG +zY-ou4Wti8&`O@6l+t~cEsq+4~jZ?Ui4=?so)3W{oUC%hiSUFT!J60f^ULu_d(`l46Bg_Af!Ghxfe|2s1dtBgmy5YUDdZ;&9@yw>`?dX +zfRZ{i$n9E`7KmR9n7~%?X%hiKctzf=J +z03S->t5fFHDSU`OUyaOHCC`INb70au$Ztm7|C<_l3hXxl@*4&EY^9+xh1X_7bGARb +zMo;sn(2I#m +z#6(2^$$t?Ja__&11OOy-F(_-7DBk#pSf2nV+p)4czeL>PvV!rsejW>}!}M2v!IZ$; +z9v-Y$tl%-at=(n=?u~voKC5vyKz)74ByGA;P>-m`&HWm=?Qr9L>dfROsaP<5nRBHb +z2&Xq}@%&h<`B7h}y&~2tZhO^zU`ruIDqC!F6`=ii8Sk?7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H!aEw+yTh-J>p-sg+s4{#~rCf%t@4t1|SdY +ztZUHbvitCNwS0NkL&K_xPX|6bm3P%pqh`i#%)HQ<1@=zTv-hj9!UuMO##=Lr(|5%t +z;&ZEAyNug3GAFKO61f$&cHA7ceLfB*mh + +literal 0 +HcmV?d00001 + +diff --git a/app/src/main/res/mipmap-hdpi/substratum_masquerade.png b/app/src/main/res/mipmap-hdpi/substratum_masquerade.png +deleted file mode 100755 +index aa94e2c00f99b9f2e2e1889c26955f85fa0932af..0000000000000000000000000000000000000000 +GIT binary patch +literal 0 +HcmV?d00001 + +literal 2246 +zcmV;%2s!tOP)Ip09?Csy0002r-`{g?v)S3%tx9#u%F3G{R<=!jqeOAdAzYgwSG>U2?Ck6+ +zH-``wH|px@G(w&=LzVyl030G!B`$I@L7j$%hCdS`X(2bCF;#1AbV5mWZf*&kx+CTZCpW9cGh>LqA9O04Q6XYECP>LX{_AY|-AeCh79br34sm>i>)E;5zB4+C>ZR|C3$sAtoKzhd=U+g+|L`bLJA!STNqU}O_vLRsMp2HttJxZEBOrJqet~^MTvn69aOP#VLVm?l- +z>L_YDMvSr}V#FX}!5?3;B4NHBUc((;!6jvlFM93m?Y1If#wKOCB4V{2Uc@0`N>8ig +zw7C1#@}X}BO<#U*6KA7I%dW<^hr<|b&_A!M?($VpeOmn(GD*4wckU&be9 +z+9hYIC2Zj$W!fib>L+R0B4u|rh~p$@!6IU_CS-s!gw1=OjFPlFN~)_SXIf06IYok7A$HpjU +zKu@m3V2rgaXp4%&z*2&2c)qZ<*rTY%#>(J=inx@^%X9z$07Z0CPE!DlgpCn03IYfN +z0feHWqLGo21)>a*jf5VNqG^$hgyEiq7-%ejM&~8-gf?m?lx8@Ql9r`&E|%tv7Fvks +zPBdJhZF*k>$Z+>+Z}>x-)aux2#W+f0D!gCm9TX52L^Q(u0P-!8v$pkMBm^v47n;*XMTouG1O* +z4hPbydhLP#Sh`as2c4i(Ime!JrO|lA5tp2y>cn)NEq5((F1|wr>90ET{cV(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5%XX|X0y0oV4>v|U1IOpe`}X*^kGbE~X|sSA_=;Ufn5Du2X+*0Ikna3Vqy=7; +z83U!jO9^OYJZQO6C?Jh^#p4^9DlG7f){HL1KwkWnB#^@MZMnO%zBfq!$tKU=#LGnm +zL!u92G6MOD+~Oq-Sa~Ids@!%hRa(&uvgxHu`sWFOm5XM_S7t8XU)S`Ik19<>|FESQ +z0%FN6r(hM!1OD+#7qTWREDw3S@((Y0oU7lPvcy)``e2IL|9;~({V=cPHOM3r{nvi` +z;H6Az>V}&Hk$lVINxp@jM?ClOf2VPqETQm!FD-*$pO$`*Gv)u#a;7l2+wQi%xBVr+ +Y0LvOWjfh)G4*&oF07*qoM6N<$g35*9H2?qr + +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 0000000000000000000000000000000000000000..c56d924e82226247414225514f6c666ec4002598 +GIT binary patch +literal 2733 +zcma)7i#HRF7vC)Ou=efen@VhBh)NVnHY1Pbu?#&t!ZsTlNnT%%U&Bbz_bcn+oyWAy +zBd^dTuW8;TN#0_Kd5g_A*2qu)!S9}P?>*;!&b{Z}^SSrj`}TGi@Lt8e0001NZDrxO +z;|afYH)zN9UyR=Yq}J`RS1hqUfjg1^M-~*jTM`NR9RFIy?GPQ@{H9dIO8+HRp+4 +zDBrreIzG!7A+#*9&wvf@!}nIAA))s*}UK>dCY7048uH;HYFn(lwlZY +zUY*KQ_Lx)kUb2juSEKNh@x!WKBkGi4IC)rwjK=28BPhcN?~!BF`C~pUaN>xXcdHty +z6+voM^=yF=T2zQFP{N`)4QX3~vdu?fOGY$(P&UtzHpNKWf~AX5^P0X$n<6wecSxBy +zdLg7-$-Nnh?}T0-R>e>JuK(QFHmhHmh_q#+tRB5O>eK@zB5htQqQchJ*1oD!7te+a +zs8e!Tjc;J?jZlwvCH#!4H_GPO7get*IJp<$|=a^Gco-p>Rtx3J61p9Mrd7e>D!L3PpMf= +zv*x#Z@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sdSj_2m{-ZH6~Xy1{c9?nzi +zdF~}t%kTTIjHg)bHp~94#Uzm^P#qs0j@8#RaEJm)y~Thi%2H*I4#8?nYG^;hc|}H= +z=tjcc`uiT)TWkKiTkLiC?$&3iemk=byEy +z9&be~Tz2E+@R!jr$+fwNZMH_dN=o-X!5?nSl!iYpQ01%jgd;1tz+~g;$s~B&J&>Pd +z)W|ore`sY#o12?1IlOgC#45xRl&CJ&(tK7#)-T@0>vL`$Ln8wNqw8D41-}wb%OoAB?A6>9SmW9cf008PHZciyes-c9`R@~J +MX=ZC$Z*ndEzb5@DPXGV_ + +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 0000000000000000000000000000000000000000..4448e0b97e8333ae8b1ac5915a22ea9b33303ce4 +GIT binary patch +literal 4947 +zcmaKwc{J4D|Ho%BQDkH-VkTp<TDe<~?>HqZMVBT~ZP;W`-8Bru0d|Oeurx3Z=|g +zvV_oNC;Q%5!;IN}KIixU_nv!S_uTt>oO562p6BzNd+uXbT@iKvd(}&kZpV0OXjxzw{~~_X9NGwEa>OYpZ^a81O%j~zo@o}YHDg~HuO_D +zc|A(m_%x99)dsJwm$baRTyn-m2lFV)B=D_Sa7jr?o|co{mDCTH6INDM78VwEBbiJ- +zV?s7HHJzWIS5R~RV;0>Y>)fp3t#AFlQO;#R!L#wO>mb5&LD73r#oxfXs8QZ^QQ2=u +z#di?lwV>$3Fvl+{`3@=j4(-Y9!(1FMmBGoRedT|t{dBzG$D4EZwzhT +z4XN#(TTpSt-Q;{J!vbHf;98DwE0cFMv@J5QE-Xj7S15TJohz#JT3ICYK8`>5&BHRqm{;O|IF+7`LXqB#Sk&L#@L0e~hM+X|7B^y{iF|bGq +z!%-R)+*?tO1&7anMqK`aaJiq<+@;|0M=y+`99WC+{EqUPn3!slcbio9OFtQ*ZIWwo +zxqRk`_neAfkFqyW`@wIN&(f)odwTKX$m_jGuTLn?9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x +zOv_2q&PkGZ7uI366i@4(+of8k=)M~cfcx@>|H9f0TFx`pdj*Wv3oNP&E76Y?-c2EO +z>I}#e55^c#T$^qoI_Gc8Iudq*e2Fe +zweh*HTPVD-t!0F+$H9cD2zpb!ogaglngxp$6Y2Q6H?Flc;Xw^l;^Oe@(c39mM2V2+ +z=)LcxDsq)>A)=|S_;-+(By+M7eD*gx`33EJf-=!fpr`JZ?1wBJ9xR9F1iPKX*{o(V +z41zVqle`H$b-OshZ>Uv~eoOYPJC_vRs3q)n#eNy{te3j+r)LiQ_px=>+|I1T#69-^ +E0A=T)LjV8( + +literal 0 +HcmV?d00001 + +diff --git a/app/src/main/res/mipmap-xxxhdpi/substratum_masquerade.png b/app/src/main/res/mipmap-xxxhdpi/substratum_masquerade.png +deleted file mode 100755 +index 53658674bdc6209cf4ada657cfa150bc21338d60..0000000000000000000000000000000000000000 +GIT binary patch +literal 0 +HcmV?d00001 + +literal 4966 +zcmaJ_c{J4B|DOeemeFDhGo(-{DqCS@kQ8b}8)Xm4GK!G&nMp+@OY($Lqoj#EmTX1L +z*vrmXBFoq^#x`SO#;m`2&hP*4J@>xvx$paWujh5{ANPsVS-UOryW~M2(3aDuPB=?; +z%7051Dv^GWY-11z!f|puZ|fL%Q=<8w1N=X4L4AFF{|~rv<3@UVMwP?erlzJAi|aav +zuHD^hbr_vp>j3DRJzHL0E;4pE!Ng}<2YomZT2xf@@u=(Biz($7p02E{%+JqDWKK?w +zv2~7(jSZbnN9cJip19Yr>uQUR-*NlTjcV?{5I&9S9>YkV`Q3gDoj`N@!bS}b#@_2A +zIswB--}&ACOSS-GPr%6DfME$hJ78Gr+OX!eMh(yAz1J|xOX?ins1JT%`W^G?fhur4fKIRUE*3QLETHZ|vFH46HExP_?I@he6ikgs;<9iE- +zyb(P~-25+EUe@P|mrequ2#->vXNiV~g=3+)eL<VUmD&Pj-&?Ft0n60mJaVM>_4C!b5M>%ONY0`>Q^o8U!k%8nx9Ie +zAUw?Nk}d7C&266^v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++++ b/app/src/main/res/values/styles.xml +@@ -1,4 +1,3 @@ + +- +