From 6e4f31a8199832c9fa179e829a520323083aecbd Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 18 Aug 2014 07:49:34 +0200 Subject: [PATCH] Show only updating whhen reboot is required XPrivacy can be used during updatig Refs #1887 --- src/biz/bokhorst/xprivacy/ActivityApp.java | 2 +- src/biz/bokhorst/xprivacy/ActivityBase.java | 15 ++++++++------- src/biz/bokhorst/xprivacy/ActivityMain.java | 2 +- src/biz/bokhorst/xprivacy/ActivityShare.java | 2 +- src/biz/bokhorst/xprivacy/ActivityUsage.java | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/biz/bokhorst/xprivacy/ActivityApp.java b/src/biz/bokhorst/xprivacy/ActivityApp.java index ef23986b1..577b4dfc8 100644 --- a/src/biz/bokhorst/xprivacy/ActivityApp.java +++ b/src/biz/bokhorst/xprivacy/ActivityApp.java @@ -124,7 +124,7 @@ public void onCreate(Bundle savedInstanceState) { final int userId = Util.getUserId(Process.myUid()); // Check privacy service client - if (!PrivacyService.checkClient() || isUpdating()) + if (!PrivacyService.checkClient()) return; // Set layout diff --git a/src/biz/bokhorst/xprivacy/ActivityBase.java b/src/biz/bokhorst/xprivacy/ActivityBase.java index 7451a14be..56ad9ce16 100644 --- a/src/biz/bokhorst/xprivacy/ActivityBase.java +++ b/src/biz/bokhorst/xprivacy/ActivityBase.java @@ -27,9 +27,8 @@ public class ActivityBase extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Check if update service running - boolean updating = isUpdating(); - if (PrivacyService.checkClient() && !updating) { + // Check if Privacy client available + if (PrivacyService.checkClient()) { // Set theme int userId = Util.getUserId(Process.myUid()); String themeName = PrivacyManager.getSetting(userId, PrivacyManager.cSettingTheme, ""); @@ -48,19 +47,21 @@ protected void onCreate(Bundle savedInstanceState) { } // Show reason - if (updating) - ((TextView) findViewById(R.id.tvServiceUpdating)).setVisibility(View.VISIBLE); - else if (PrivacyService.getClient() == null) { + if (PrivacyService.getClient() == null) { ((TextView) findViewById(R.id.tvRebootClient)).setVisibility(View.VISIBLE); Requirements.checkCompatibility(this); } else { ((TextView) findViewById(R.id.tvRebootVersion)).setVisibility(View.VISIBLE); Requirements.check(this); } + + // Show if updating + if (isUpdating()) + ((TextView) findViewById(R.id.tvServiceUpdating)).setVisibility(View.VISIBLE); } } - protected boolean isUpdating() { + private boolean isUpdating() { ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) if (UpdateService.class.getName().equals(service.service.getClassName())) diff --git a/src/biz/bokhorst/xprivacy/ActivityMain.java b/src/biz/bokhorst/xprivacy/ActivityMain.java index 017d076d2..4b244509e 100644 --- a/src/biz/bokhorst/xprivacy/ActivityMain.java +++ b/src/biz/bokhorst/xprivacy/ActivityMain.java @@ -165,7 +165,7 @@ protected void onCreate(Bundle savedInstanceState) { final int userId = Util.getUserId(Process.myUid()); // Check privacy service client - if (!PrivacyService.checkClient() || isUpdating()) + if (!PrivacyService.checkClient()) return; // Import license file diff --git a/src/biz/bokhorst/xprivacy/ActivityShare.java b/src/biz/bokhorst/xprivacy/ActivityShare.java index e76e33b2c..80bcdc6ad 100644 --- a/src/biz/bokhorst/xprivacy/ActivityShare.java +++ b/src/biz/bokhorst/xprivacy/ActivityShare.java @@ -147,7 +147,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check privacy service client - if (!PrivacyService.checkClient() || isUpdating()) + if (!PrivacyService.checkClient()) return; // Get data diff --git a/src/biz/bokhorst/xprivacy/ActivityUsage.java b/src/biz/bokhorst/xprivacy/ActivityUsage.java index e9dc5a05e..23fe9d47f 100644 --- a/src/biz/bokhorst/xprivacy/ActivityUsage.java +++ b/src/biz/bokhorst/xprivacy/ActivityUsage.java @@ -62,7 +62,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check privacy service client - if (!PrivacyService.checkClient() || isUpdating()) + if (!PrivacyService.checkClient()) return; // Set layout