From 525b8dad547639e4f42c8756ae32c387c3dcdf97 Mon Sep 17 00:00:00 2001 From: Rahul Kumar Date: Mon, 6 Apr 2020 00:40:29 +0530 Subject: [PATCH] Remove Wakelocks Info and remove several dependencies --- README.md | 3 - app/build.gradle | 4 - app/src/main/AndroidManifest.xml | 4 +- .../android/common/CommonLogSettings.java | 28 - .../asksven/android/common/NonRootShell.java | 83 - .../com/asksven/android/common/RootShell.java | 102 - .../asksven/android/common/dto/AlarmDto.java | 50 - .../android/common/dto/AlarmItemDto.java | 33 - .../asksven/android/common/dto/MiscDto.java | 42 - .../common/dto/NativeKernelWakelockDto.java | 57 - .../android/common/dto/NetworkUsageDto.java | 42 - .../android/common/dto/ProcessDto.java | 47 - .../android/common/dto/SensorUsageDto.java | 44 - .../common/dto/SensorUsageItemDto.java | 36 - .../asksven/android/common/dto/StateDto.java | 41 - .../android/common/dto/UidInfoDto.java | 34 - .../android/common/dto/WakelockDto.java | 45 - .../common/kernelutils/AlarmsDumpsys.java | 746 ---- .../android/common/kernelutils/CpuStates.java | 92 - .../kernelutils/NativeKernelWakelock.java | 435 -- .../android/common/kernelutils/Netstats.java | 209 - .../common/kernelutils/OtherStatsDumpsys.java | 217 - .../kernelutils/ProcessStatsDumpsys.java | 280 -- .../android/common/kernelutils/State.java | 213 - .../android/common/kernelutils/Wakelocks.java | 278 -- .../common/kernelutils/WakeupSources.java | 244 -- .../common/kernelutils/WakeupSourcesLg.java | 178 - .../android/common/location/GeoUtils.java | 97 - .../android/common/nameutils/UidInfo.java | 130 - .../common/nameutils/UidNameResolver.java | 223 - .../common/networkutils/DataNetwork.java | 63 - .../common/privateapiproxies/Alarm.java | 463 --- .../common/privateapiproxies/AlarmItem.java | 136 - .../BatteryInfoUnavailableException.java | 27 - .../privateapiproxies/BatteryStatsProxy.java | 3587 ----------------- .../privateapiproxies/BatteryStatsTypes.java | 176 - .../BatteryStatsTypesLolipop.java | 40 - .../common/privateapiproxies/HistoryItem.java | 478 --- .../privateapiproxies/HistoryItemIcs.java | 164 - .../HistoryItemJellyBean.java | 176 - .../privateapiproxies/HistoryItemKitKat.java | 233 -- .../privateapiproxies/HistoryItemLolipop.java | 176 - .../privateapiproxies/KernelWakelock.java | 197 - .../common/privateapiproxies/Misc.java | 234 -- .../NativeKernelWakelock.java | 433 -- .../privateapiproxies/NetworkQueryProxy.java | 151 - .../privateapiproxies/NetworkUsage.java | 365 -- .../privateapiproxies/Notification.java | 181 - .../privateapiproxies/PackageElement.java | 335 -- .../common/privateapiproxies/Process.java | 277 -- .../common/privateapiproxies/SensorUsage.java | 360 -- .../privateapiproxies/SensorUsageItem.java | 150 - .../common/privateapiproxies/StatElement.java | 269 -- .../SystemPropertiesProxy.java | 297 -- .../common/privateapiproxies/Wakelock.java | 283 -- .../android/common/settings/GpsSettings.java | 60 - .../android/common/shellutils/Exec.java | 225 -- .../android/common/shellutils/ExecResult.java | 54 - .../android/common/utils/ChargerUtil.java | 42 - .../android/common/utils/DataStorage.java | 168 - .../android/common/utils/DateUtils.java | 392 -- .../android/common/utils/GenericLogger.java | 59 - .../android/common/utils/MathUtils.java | 88 - .../common/utils/SharedPreferencesUtils.java | 119 - .../android/common/utils/StringUtils.java | 223 - .../android/common/utils/SysUtils.java | 81 - .../common/utils/SystemAppInstaller.java | 384 -- .../android/common/wifi/WifiManagerProxy.java | 82 - .../com/asksven/android/contrib/Debug.java | 245 -- .../com/asksven/android/contrib/Shell.java | 1734 -------- .../contrib/ShellNotClosedException.java | 16 - .../contrib/ShellOnMainThreadException.java | 18 - .../android/contrib/StreamGobbler.java | 123 - .../com/asksven/android/contrib/Util.java | 140 - .../android/system/AndroidVersion.java | 80 - .../com/asksven/android/system/Devices.java | 33 - .../asksven/android/system/Installation.java | 70 - .../app/ui/adapters/AlarmTriggerAdapter.java | 156 +- .../app/ui/adapters/CpuWakelocksAdapter.java | 160 +- .../ui/adapters/KernelWakelockAdapter.java | 142 +- .../app/ui/fragments/SettingsFragment.java | 22 - .../app/ui/fragments/WakeLocksFragment.java | 294 +- .../app/utils/BatteryStatsUtils.java | 266 +- .../app/utils/SystemAppUtilities.java | 40 - .../alarm_trigger_custom_list_item1.xml | 16 +- app/src/main/res/layout/cpu_wakelock_row.xml | 16 +- .../main/res/layout/kernel_wakelock_row.xml | 18 +- app/src/main/res/xml/settings_preferences.xml | 5 - 88 files changed, 535 insertions(+), 18324 deletions(-) delete mode 100644 app/src/main/java/com/asksven/android/common/CommonLogSettings.java delete mode 100644 app/src/main/java/com/asksven/android/common/NonRootShell.java delete mode 100644 app/src/main/java/com/asksven/android/common/RootShell.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/AlarmDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/AlarmItemDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/MiscDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/NativeKernelWakelockDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/NetworkUsageDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/ProcessDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/SensorUsageDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/SensorUsageItemDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/StateDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/UidInfoDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/dto/WakelockDto.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/AlarmsDumpsys.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/CpuStates.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/NativeKernelWakelock.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/Netstats.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/OtherStatsDumpsys.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/ProcessStatsDumpsys.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/State.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/Wakelocks.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/WakeupSources.java delete mode 100644 app/src/main/java/com/asksven/android/common/kernelutils/WakeupSourcesLg.java delete mode 100644 app/src/main/java/com/asksven/android/common/location/GeoUtils.java delete mode 100644 app/src/main/java/com/asksven/android/common/nameutils/UidInfo.java delete mode 100644 app/src/main/java/com/asksven/android/common/nameutils/UidNameResolver.java delete mode 100644 app/src/main/java/com/asksven/android/common/networkutils/DataNetwork.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/Alarm.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/AlarmItem.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/BatteryInfoUnavailableException.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/BatteryStatsProxy.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/BatteryStatsTypes.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/BatteryStatsTypesLolipop.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/HistoryItem.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/HistoryItemIcs.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/HistoryItemJellyBean.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/HistoryItemKitKat.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/HistoryItemLolipop.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/KernelWakelock.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/Misc.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/NativeKernelWakelock.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/NetworkQueryProxy.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/NetworkUsage.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/Notification.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/PackageElement.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/Process.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/SensorUsage.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/SensorUsageItem.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/StatElement.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/SystemPropertiesProxy.java delete mode 100644 app/src/main/java/com/asksven/android/common/privateapiproxies/Wakelock.java delete mode 100644 app/src/main/java/com/asksven/android/common/settings/GpsSettings.java delete mode 100644 app/src/main/java/com/asksven/android/common/shellutils/Exec.java delete mode 100644 app/src/main/java/com/asksven/android/common/shellutils/ExecResult.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/ChargerUtil.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/DataStorage.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/DateUtils.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/GenericLogger.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/MathUtils.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/SharedPreferencesUtils.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/StringUtils.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/SysUtils.java delete mode 100644 app/src/main/java/com/asksven/android/common/utils/SystemAppInstaller.java delete mode 100644 app/src/main/java/com/asksven/android/common/wifi/WifiManagerProxy.java delete mode 100644 app/src/main/java/com/asksven/android/contrib/Debug.java delete mode 100644 app/src/main/java/com/asksven/android/contrib/Shell.java delete mode 100644 app/src/main/java/com/asksven/android/contrib/ShellNotClosedException.java delete mode 100644 app/src/main/java/com/asksven/android/contrib/ShellOnMainThreadException.java delete mode 100644 app/src/main/java/com/asksven/android/contrib/StreamGobbler.java delete mode 100644 app/src/main/java/com/asksven/android/contrib/Util.java delete mode 100644 app/src/main/java/com/asksven/android/system/AndroidVersion.java delete mode 100644 app/src/main/java/com/asksven/android/system/Devices.java delete mode 100644 app/src/main/java/com/asksven/android/system/Installation.java diff --git a/README.md b/README.md index 6ff05e3..84925ca 100755 --- a/README.md +++ b/README.md @@ -11,9 +11,6 @@ Performance-Tweaker is a simple app for tweaking: * Virtual Memory * Build prop Editor -It also can monitor: - * Battery or Wakelocks Stats i.e Spot rogue applications or sources which are causing battery drain - ## Contribution diff --git a/app/build.gradle b/app/build.gradle index 3b8c772..a54a12c 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -60,11 +60,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'com.github.lzyzsd:circleprogress:1.2.1' - implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13' - implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13' implementation 'com.facebook.android:audience-network-sdk:5.8.0' - implementation 'com.google.code.gson:gson:2.8.0' implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') { transitive = true; } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cb4a4f9..808808d 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,11 +5,9 @@ - - - + diff --git a/app/src/main/java/com/asksven/android/common/CommonLogSettings.java b/app/src/main/java/com/asksven/android/common/CommonLogSettings.java deleted file mode 100644 index 2f227dd..0000000 --- a/app/src/main/java/com/asksven/android/common/CommonLogSettings.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2011 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.asksven.android.common; - -/** - * @author sven - * - */ -public class CommonLogSettings -{ - public static final String LOGGING_TAG = "AndoidCommon"; - public static boolean DEBUG = false; - public static boolean TRACE = false; - -} diff --git a/app/src/main/java/com/asksven/android/common/NonRootShell.java b/app/src/main/java/com/asksven/android/common/NonRootShell.java deleted file mode 100644 index 5e763df..0000000 --- a/app/src/main/java/com/asksven/android/common/NonRootShell.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * - */ -package com.asksven.android.common; - -import com.stericson.RootTools.RootTools; -import com.stericson.RootTools.execution.CommandCapture; -import com.stericson.RootTools.execution.Shell; - -import java.util.ArrayList; -import java.util.List; - -//import com.asksven.android.contrib.Shell; - -/** - * @author sven - * Sigleton performing su operations - * - */ -public class NonRootShell -{ - static NonRootShell m_instance = null; - static Shell m_shell = null; - private NonRootShell() - { - } - - public static NonRootShell getInstance() - { - if (m_instance == null) - { - m_instance = new NonRootShell(); - try - { - m_shell = RootTools.getShell(false); - } - catch (Exception e) - { - m_shell = null; - } - } - - return m_instance; - } - - public synchronized List run(String command) - { - final List res = new ArrayList(); - - if (m_shell == null) - { - // reopen if for whatever reason the shell got closed - NonRootShell.getInstance(); - } - - CommandCapture shellCommand = new CommandCapture(0, command) - { - @Override - public void output(int id, String line) - { - res.add(line); - } - }; - try - { - m_shell.add(shellCommand); - - // we need to make this synchronous - while (!shellCommand.isFinished()) - { - Thread.sleep(100); - } - } - catch (Exception e) - { - - } - - return res; - - } - -} diff --git a/app/src/main/java/com/asksven/android/common/RootShell.java b/app/src/main/java/com/asksven/android/common/RootShell.java deleted file mode 100644 index 0e8e493..0000000 --- a/app/src/main/java/com/asksven/android/common/RootShell.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * - */ -package com.asksven.android.common; - -import com.stericson.RootTools.RootTools; -import com.stericson.RootTools.execution.CommandCapture; -import com.stericson.RootTools.execution.Shell; - -import java.util.ArrayList; -import java.util.List; - -//import com.asksven.android.contrib.Shell; - -/** - * @author sven - * Sigleton performing su operations - * - */ -public class RootShell -{ - static RootShell m_instance = null; - static Shell m_shell = null; - private RootShell() - { - } - - public static RootShell getInstance() - { - if (m_instance == null) - { - m_instance = new RootShell(); - try - { - m_shell = RootTools.getShell(true); - } - catch (Exception e) - { - m_shell = null; - } - } - - return m_instance; - } - -// public List run1(String command) -// { -// return Shell.SU.run(command); -// } - - public synchronized List run(String command) - { - final List res = new ArrayList(); - - if (!RootTools.isRootAvailable()) - { - return res; - } - - if (m_shell == null) - { - // reopen if for whatever reason the shell got closed - RootShell.getInstance(); - } - - CommandCapture shellCommand = new CommandCapture(0, command) - { - @Override - public void output(int id, String line) - { - res.add(line); - } - }; - try - { - RootTools.getShell(true).add(shellCommand); - - // we need to make this synchronous - while (!shellCommand.isFinished()) - { - Thread.sleep(100); - } - } - catch (Exception e) - { - - } - - return res; - - } - - public boolean phoneRooted() - { - return RootTools.isRootAvailable(); - } - - public boolean hasRootPermissions() - { - return ((m_shell != null) && (RootTools.isRootAvailable())); - } -} diff --git a/app/src/main/java/com/asksven/android/common/dto/AlarmDto.java b/app/src/main/java/com/asksven/android/common/dto/AlarmDto.java deleted file mode 100644 index abcc451..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/AlarmDto.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2014 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; -import java.util.ArrayList; - -/** - * A DTO class for Alarms - * @author sven - * - */ -public class AlarmDto implements Serializable -{ - - // from StatElement - @JsonProperty("uid") public int m_uid = -1; - - @JsonProperty("total") public long m_total; - - // from Alarm - @JsonProperty("package_name") public String m_strPackageName; - - // from Alarm - @JsonProperty("details") public String m_details; - - @JsonProperty("wakeups") public long m_nWakeups; - - @JsonProperty("total_count") public long m_nTotalCount; - - @JsonProperty("time_running_ms") public long m_timeRunning; - - @JsonProperty("items") public ArrayList m_items; -} diff --git a/app/src/main/java/com/asksven/android/common/dto/AlarmItemDto.java b/app/src/main/java/com/asksven/android/common/dto/AlarmItemDto.java deleted file mode 100644 index 801c83e..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/AlarmItemDto.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2014 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * A DTO for AlarmItems - * @author sven - * - */ -public class AlarmItemDto implements Serializable -{ - @JsonProperty("number") public long m_nNumber; - - @JsonProperty("intent") public String m_strIntent; -} diff --git a/app/src/main/java/com/asksven/android/common/dto/MiscDto.java b/app/src/main/java/com/asksven/android/common/dto/MiscDto.java deleted file mode 100644 index f00f432..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/MiscDto.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2014 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * A FTO for Misc - * @author sven - * - */ -public class MiscDto implements Serializable -{ - - // from StatElement - @JsonProperty("uid") public int m_uid = -1; - - @JsonProperty("total") public long m_total; - - // from Misc - @JsonProperty("name") public String m_name; - - @JsonProperty("time_on_ms") public long m_timeOn; - - @JsonProperty("time_running_ms") public long m_timeRunning; -} diff --git a/app/src/main/java/com/asksven/android/common/dto/NativeKernelWakelockDto.java b/app/src/main/java/com/asksven/android/common/dto/NativeKernelWakelockDto.java deleted file mode 100644 index f401fdc..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/NativeKernelWakelockDto.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2014 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * A DTO for NativeKernelWakelock - * @author sven - * - */ -public class NativeKernelWakelockDto implements Serializable -{ - - // from StatElement - @JsonProperty("uid") public int m_uid = -1; - - @JsonProperty("total") public long m_total; - - // from NativeKernelWakelock - @JsonProperty("name") public String m_name; - - @JsonProperty("details") public String m_details; - - @JsonProperty("count") public int m_count; - - @JsonProperty("expire_count") public int m_expireCount; - - @JsonProperty("wake_count") public int m_wakeCount; - - @JsonProperty("active_since") public long m_activeSince; - - @JsonProperty("total_time") public long m_ttlTime; - - @JsonProperty("sleep_time") public long m_sleepTime; - - @JsonProperty("max_time") public long m_maxTime; - - @JsonProperty("last_change") public long m_lastChange; - -} diff --git a/app/src/main/java/com/asksven/android/common/dto/NetworkUsageDto.java b/app/src/main/java/com/asksven/android/common/dto/NetworkUsageDto.java deleted file mode 100644 index 88a47a5..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/NetworkUsageDto.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2014 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * A DTO for NetworkUsage - * @author sven - * - */ -public class NetworkUsageDto implements Serializable -{ - - // from StatElement - @JsonProperty("uid") public int m_uid = -1; - - @JsonProperty("total") public long m_total; - - // from NetworkUsage - @JsonProperty("bytes_received") public long m_bytesReceived=0; - - @JsonProperty("bytes_sent") public long m_bytesSent=0; - - @JsonProperty("iface") public String m_iface = ""; -} diff --git a/app/src/main/java/com/asksven/android/common/dto/ProcessDto.java b/app/src/main/java/com/asksven/android/common/dto/ProcessDto.java deleted file mode 100644 index c42c458..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/ProcessDto.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2014 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import com.google.gson.annotations.SerializedName; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * A DTO for Process - * @author sven - * - */ -public class ProcessDto implements Serializable -{ - - // from StatElement - @JsonProperty("uid") public int m_uid = -1; - - @JsonProperty("total") public long m_total; - - // from Process - @JsonProperty("name") public String m_name; - - @JsonProperty("system_time") public long m_systemTime; - - @SerializedName("user_time") public long m_userTime; - - @JsonProperty("starts") public int m_starts; - -} diff --git a/app/src/main/java/com/asksven/android/common/dto/SensorUsageDto.java b/app/src/main/java/com/asksven/android/common/dto/SensorUsageDto.java deleted file mode 100644 index 785732e..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/SensorUsageDto.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2016 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; -import java.util.ArrayList; - -/** - * A DTO class for Alarms - * @author sven - * - */ -public class SensorUsageDto implements Serializable -{ - - // from StatElement - @JsonProperty("uid") public int m_uid = -1; - - // from Sensor - @JsonProperty("package_name") public String m_strPackageName; - - // from Alarm - @JsonProperty("details") public String m_details; - - @JsonProperty("total") public long m_totalTime; - - @JsonProperty("items") public ArrayList m_items; -} diff --git a/app/src/main/java/com/asksven/android/common/dto/SensorUsageItemDto.java b/app/src/main/java/com/asksven/android/common/dto/SensorUsageItemDto.java deleted file mode 100644 index 9e0992b..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/SensorUsageItemDto.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * A DTO for SensorItems - * @author sven - * - */ -public class SensorUsageItemDto implements Serializable -{ - @JsonProperty("time") public long m_nTime; - @JsonProperty("handle") public int m_nHandle; - - @JsonProperty("sensor") public String m_strSensor; - - -} diff --git a/app/src/main/java/com/asksven/android/common/dto/StateDto.java b/app/src/main/java/com/asksven/android/common/dto/StateDto.java deleted file mode 100644 index 4587ccf..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/StateDto.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2014 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * A DTO for State - * @author sven - * - */ -public class StateDto implements Serializable -{ - - // from StatElement - @JsonProperty("uid") public int m_uid = -1; - - @JsonProperty("total") public long m_total; - - // from State - @JsonProperty("freq") public int m_freq = 0; - - @JsonProperty("duration_ms") public long m_duration = 0; - -} diff --git a/app/src/main/java/com/asksven/android/common/dto/UidInfoDto.java b/app/src/main/java/com/asksven/android/common/dto/UidInfoDto.java deleted file mode 100644 index 6e08a1b..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/UidInfoDto.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2011 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * @author sven - * - */ -public class UidInfoDto implements Serializable -{ - @JsonProperty("uid") public int m_uid; - @JsonProperty("name") public String m_uidName = ""; - @JsonProperty("package")public String m_uidNamePackage = ""; - @JsonProperty("unique") public boolean m_uidUniqueName = false; - -} diff --git a/app/src/main/java/com/asksven/android/common/dto/WakelockDto.java b/app/src/main/java/com/asksven/android/common/dto/WakelockDto.java deleted file mode 100644 index c151215..0000000 --- a/app/src/main/java/com/asksven/android/common/dto/WakelockDto.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2014 asksven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.asksven.android.common.dto; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -/** - * A DTO for Wakelock - * @author sven - * - */ -public class WakelockDto implements Serializable -{ - - // from StatElement - @JsonProperty("uid") public int m_uid; - - @JsonProperty("total") public long m_total; - - // from Wakelock - @JsonProperty("wake_type") public int m_wakeType; - - @JsonProperty("name") public String m_name; - - @JsonProperty("duration_ms") public long m_duration; - - @JsonProperty("count") public int m_count; - -} diff --git a/app/src/main/java/com/asksven/android/common/kernelutils/AlarmsDumpsys.java b/app/src/main/java/com/asksven/android/common/kernelutils/AlarmsDumpsys.java deleted file mode 100644 index 8c636fa..0000000 --- a/app/src/main/java/com/asksven/android/common/kernelutils/AlarmsDumpsys.java +++ /dev/null @@ -1,746 +0,0 @@ -/** - * - */ -package com.asksven.android.common.kernelutils; - -import android.os.Build; -import android.util.Log; - -import com.asksven.android.common.NonRootShell; -import com.asksven.android.common.RootShell; -import com.asksven.android.common.privateapiproxies.Alarm; -import com.asksven.android.common.privateapiproxies.StatElement; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -//import com.asksven.android.contrib.Shell; - -/** - * Parses the content of 'dumpsys alarm' - * processes the result of 'dumpsys alarm' as explained in KB article - * https://github.com/asksven/BetterBatteryStats-Knowledge-Base/wiki/AlarmManager - * @author sven - */ -public class AlarmsDumpsys -{ - static final String TAG = "AlarmsDumpsys"; - static final String PERMISSION_DENIED = "su rights required to access alarms are not available / were not granted"; - static final String SERVICE_NOT_ACCESSIBLE = "Can't find service: alarm"; - - public static ArrayList getAlarms(boolean useRoot) - { - String release = Build.VERSION.RELEASE; - int sdk = Build.VERSION.SDK_INT; - Log.i(TAG, "getAlarms: SDK=" + sdk + ", RELEASE=" + release); - - List res = null; - if (true) //(useRoot) // dumpsys seems to always require root, even if perm is available - { - res = RootShell.getInstance().run("dumpsys alarm"); - } - else - { - res = NonRootShell.getInstance().run("dumpsys alarm"); - } - - if (sdk < 17) // Build.VERSION_CODES.JELLY_BEAN_MR1) - { - return getAlarmsPriorTo_4_2_2(res); - } - else if (sdk == Build.VERSION_CODES.JELLY_BEAN_MR1) - { - if (release.equals("4.2.2")) - { - return getAlarmsFrom_4_2_2(res); - } - else - { - return getAlarmsPriorTo_4_2_2(res); - } - } - - else if (sdk <= 19) - { - return getAlarmsFrom_4_3(res); - } - else if (sdk < 23 ) - { - return getAlarmsFrom_5(res); - } - else - { - return getAlarmsFrom_6(res); - } - } - /** - * Returns a list of alarm value objects - * @return - * @throws Exception - */ - protected static ArrayList getAlarmsPriorTo_4_2_2(List res) - { - ArrayList myAlarms = null; - long nTotalCount = 0; - -// if (res.getSuccess()) - if ((res != null) && (res.size() != 0)) - - { -// String strRes = res.getResultLine(); - if (!res.contains("Permission Denial")) - { - Pattern begin = Pattern.compile("Alarm Stats"); - boolean bParsing = false; -// ArrayList myRes = res.getResult(); // getTestData(); - - // we are looking for multiline entries in the format - // ' - // '