├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── compiler.xml
├── encodings.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
├── modules.xml
├── render.experimental.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── libs
│ ├── RootShell-1.6.aar
│ └── RootTools-5.0.aar
├── proguard-rules.pro
├── sa-google-play.json-cipher
└── src
│ ├── androidTest
│ ├── AndroidManifest.xml
│ └── java
│ │ └── com
│ │ └── asksven
│ │ ├── android
│ │ └── common
│ │ │ └── privateapiproxies
│ │ │ ├── BatteryStatsComm.java
│ │ │ ├── BatteryStatsProxyTest.java
│ │ │ ├── PackageIconTest.java
│ │ │ └── PrivateApiTest.java
│ │ ├── betterbatterystats
│ │ ├── ClickThroughTest.java
│ │ ├── ShareActivityTestAll.java
│ │ ├── ShareActivityTestCancel.java
│ │ └── data
│ │ │ └── StatsProviderTest.java
│ │ └── com
│ │ └── asksven
│ │ └── android
│ │ └── common
│ │ ├── NonRootShellTest.java
│ │ ├── RootShellTest.java
│ │ └── WakeupSourcesTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── asksven
│ │ │ ├── android
│ │ │ ├── common
│ │ │ │ ├── AppRater.java
│ │ │ │ ├── CommonLogSettings.java
│ │ │ │ ├── NonRootShell.java
│ │ │ │ ├── RootShell.java
│ │ │ │ ├── dto
│ │ │ │ │ ├── AlarmDto.java
│ │ │ │ │ ├── AlarmItemDto.java
│ │ │ │ │ ├── MiscDto.java
│ │ │ │ │ ├── NativeKernelWakelockDto.java
│ │ │ │ │ ├── NetworkUsageDto.java
│ │ │ │ │ ├── ProcessDto.java
│ │ │ │ │ ├── SensorUsageDto.java
│ │ │ │ │ ├── SensorUsageItemDto.java
│ │ │ │ │ ├── StateDto.java
│ │ │ │ │ ├── UidInfoDto.java
│ │ │ │ │ └── WakelockDto.java
│ │ │ │ ├── kernelutils
│ │ │ │ │ ├── AlarmsDumpsys.java
│ │ │ │ │ ├── CpuStates.java
│ │ │ │ │ ├── NativeKernelWakelock.java
│ │ │ │ │ ├── OtherStatsDumpsys.java
│ │ │ │ │ ├── ProcessStatsDumpsys.java
│ │ │ │ │ ├── State.java
│ │ │ │ │ ├── Wakelocks.java
│ │ │ │ │ ├── WakeupSources.java
│ │ │ │ │ └── WakeupSourcesLg.java
│ │ │ │ ├── location
│ │ │ │ │ └── GeoUtils.java
│ │ │ │ ├── nameutils
│ │ │ │ │ ├── UidInfo.java
│ │ │ │ │ └── UidNameResolver.java
│ │ │ │ ├── networkutils
│ │ │ │ │ └── DataNetwork.java
│ │ │ │ ├── privateapiproxies
│ │ │ │ │ ├── Alarm.java
│ │ │ │ │ ├── AlarmItem.java
│ │ │ │ │ ├── BatteryInfoUnavailableException.java
│ │ │ │ │ ├── BatteryStatsProxy.java
│ │ │ │ │ ├── BatteryStatsTypes.java
│ │ │ │ │ ├── BatteryStatsTypesLolipop.java
│ │ │ │ │ ├── HistoryItem.java
│ │ │ │ │ ├── HistoryItemAndroid11.java
│ │ │ │ │ ├── HistoryItemAndroid12.java
│ │ │ │ │ ├── HistoryItemAndroid13.java
│ │ │ │ │ ├── HistoryItemIcs.java
│ │ │ │ │ ├── HistoryItemJellyBean.java
│ │ │ │ │ ├── HistoryItemKitKat.java
│ │ │ │ │ ├── HistoryItemLolipop.java
│ │ │ │ │ ├── HistoryItemMarshmallow.java
│ │ │ │ │ ├── HistoryItemNougat.java
│ │ │ │ │ ├── HistoryItemOreo.java
│ │ │ │ │ ├── KernelWakelock.java
│ │ │ │ │ ├── Misc.java
│ │ │ │ │ ├── NativeKernelWakelock.java
│ │ │ │ │ ├── NetworkQueryProxy.java
│ │ │ │ │ ├── NetworkUsage.java
│ │ │ │ │ ├── Notification.java
│ │ │ │ │ ├── PackageElement.java
│ │ │ │ │ ├── Process.java
│ │ │ │ │ ├── SensorUsage.java
│ │ │ │ │ ├── SensorUsageItem.java
│ │ │ │ │ ├── StatElement.java
│ │ │ │ │ ├── SystemPropertiesProxy.java
│ │ │ │ │ └── Wakelock.java
│ │ │ │ ├── settings
│ │ │ │ │ └── GpsSettings.java
│ │ │ │ ├── shellutils
│ │ │ │ │ ├── Exec.java
│ │ │ │ │ └── ExecResult.java
│ │ │ │ ├── utils
│ │ │ │ │ ├── ChargerUtil.java
│ │ │ │ │ ├── DataStorage.java
│ │ │ │ │ ├── DateUtils.java
│ │ │ │ │ ├── GenericLogger.java
│ │ │ │ │ ├── MathUtils.java
│ │ │ │ │ ├── SharedPreferencesUtils.java
│ │ │ │ │ ├── StringUtils.java
│ │ │ │ │ └── SysUtils.java
│ │ │ │ └── wifi
│ │ │ │ │ └── WifiManagerProxy.java
│ │ │ ├── contrib
│ │ │ │ ├── Debug.java
│ │ │ │ ├── Shell.java
│ │ │ │ ├── ShellNotClosedException.java
│ │ │ │ ├── ShellOnMainThreadException.java
│ │ │ │ ├── StreamGobbler.java
│ │ │ │ └── Util.java
│ │ │ └── system
│ │ │ │ ├── AndroidVersion.java
│ │ │ │ ├── Devices.java
│ │ │ │ └── Installation.java
│ │ │ └── betterbatterystats
│ │ │ ├── AboutActivity.java
│ │ │ ├── ActionBarListActivity.java
│ │ │ ├── ActiveMonAlarmReceiver.java
│ │ │ ├── BaseActivity.java
│ │ │ ├── BbsApplication.java
│ │ │ ├── ChangeLogActivity.java
│ │ │ ├── CreditsActivity.java
│ │ │ ├── DashClockSettingsActivity.java
│ │ │ ├── DiagnosticsActivity.java
│ │ │ ├── GraphActivity.java
│ │ │ ├── ImportExportPreferencesActivity.java
│ │ │ ├── LogSettings.java
│ │ │ ├── PackageFragmentActivity.java
│ │ │ ├── PackageInfoActivity.java
│ │ │ ├── PackageInfoTabsFragment.java
│ │ │ ├── PermissionsFragmentActivity.java
│ │ │ ├── PreferencesFragmentActivity.java
│ │ │ ├── RawStatsActivity.java
│ │ │ ├── ReceiversFragmentActivity.java
│ │ │ ├── ServicesFragmentActivity.java
│ │ │ ├── StatsActivity.java
│ │ │ ├── SystemAppActivity.java
│ │ │ ├── Wakelock.java
│ │ │ ├── adapters
│ │ │ ├── ChangeLogAdapter.java
│ │ │ ├── CreditsAdapter.java
│ │ │ ├── GraphsAdapter.java
│ │ │ ├── PermissionsAdapter.java
│ │ │ ├── ReferencesAdapter.java
│ │ │ ├── ServicesAdapter.java
│ │ │ └── StatsAdapter.java
│ │ │ ├── contrib
│ │ │ ├── ObservableScrollView.java
│ │ │ ├── SeekBarPreference.java
│ │ │ ├── SlidingTabLayout.java
│ │ │ └── SlidingTabStrip.java
│ │ │ ├── data
│ │ │ ├── Datapoint.java
│ │ │ ├── GraphSerie.java
│ │ │ ├── GraphSeriesFactory.java
│ │ │ ├── Permission.java
│ │ │ ├── Reading.java
│ │ │ ├── Reference.java
│ │ │ ├── ReferenceDBHelper.java
│ │ │ ├── ReferenceDto.java
│ │ │ ├── ReferenceStore.java
│ │ │ └── StatsProvider.java
│ │ │ ├── features
│ │ │ └── FeatureFlags.java
│ │ │ ├── fragment_tabs_pager.xml
│ │ │ ├── handlers
│ │ │ ├── OnBootHandler.java
│ │ │ ├── OnUnplugHandler.java
│ │ │ └── ScreenEventHandler.java
│ │ │ ├── localeplugin
│ │ │ ├── Constants.java
│ │ │ ├── PluginApplication.java
│ │ │ ├── bundle
│ │ │ │ ├── BundleScrubber.java
│ │ │ │ └── PluginBundleManager.java
│ │ │ ├── receiver
│ │ │ │ └── FireReceiver.java
│ │ │ └── ui
│ │ │ │ └── EditActivity.java
│ │ │ ├── services
│ │ │ ├── AppWidgetJobService.java
│ │ │ ├── BbsDashClockExtension.java
│ │ │ ├── EventWatcherService.java
│ │ │ ├── UpdateTextWidgetService.java
│ │ │ ├── UpdateWidgetService.java
│ │ │ ├── WatchdogProcessingService.java
│ │ │ ├── WriteBootReferenceService.java
│ │ │ ├── WriteBootReferenceServicePre21.java
│ │ │ ├── WriteCurrentReferenceService.java
│ │ │ ├── WriteCustomReferenceService.java
│ │ │ ├── WriteDumpfileService.java
│ │ │ ├── WriteScreenOffReferenceService.java
│ │ │ ├── WriteScreenOnReferenceService.java
│ │ │ ├── WriteTimeSeriesService.java
│ │ │ ├── WriteTimerReferenceService.java
│ │ │ └── WriteUnpluggedReferenceService.java
│ │ │ ├── widgetproviders
│ │ │ ├── AppWidget.java
│ │ │ └── TextAppWidget.java
│ │ │ └── widgets
│ │ │ ├── GraphableBars.java
│ │ │ ├── GraphableBarsPlot.java
│ │ │ ├── GraphableBarsTimeline.java
│ │ │ ├── GraphableButton.java
│ │ │ ├── GraphablePie.java
│ │ │ ├── WidgetBars.java
│ │ │ ├── WidgetBattery.java
│ │ │ └── WidgetSummary.java
│ ├── play
│ │ └── release-notes
│ │ │ └── en-US
│ │ │ └── beta.txt
│ └── res
│ │ ├── drawable-hdpi-v11
│ │ └── ic_stat_notification.png
│ │ ├── drawable-hdpi
│ │ ├── ic_action_overflow.png
│ │ ├── ic_action_refresh.png
│ │ ├── ic_action_settings.png
│ │ ├── ic_action_share.png
│ │ ├── ic_info_black_18dp.png
│ │ ├── ic_info_black_48dp.png
│ │ ├── ic_info_outline_black_48dp.png
│ │ ├── ic_refresh_black_48dp.png
│ │ ├── ic_refresh_grey600_48dp.png
│ │ ├── ic_refresh_white_48dp.png
│ │ ├── ic_settings_black_48dp.png
│ │ ├── ic_settings_grey600_48dp.png
│ │ ├── ic_settings_white_48dp.png
│ │ ├── ic_share_black_48dp.png
│ │ ├── ic_share_grey600_48dp.png
│ │ ├── ic_share_white_48dp.png
│ │ └── ic_stat_notification.png
│ │ ├── drawable-mdpi-v11
│ │ └── ic_stat_notification.png
│ │ ├── drawable-mdpi
│ │ ├── ic_action_overflow.png
│ │ ├── ic_action_refresh.png
│ │ ├── ic_action_settings.png
│ │ ├── ic_action_share.png
│ │ ├── ic_info_black_18dp.png
│ │ ├── ic_info_black_48dp.png
│ │ ├── ic_info_outline_black_48dp.png
│ │ ├── ic_refresh_black_48dp.png
│ │ ├── ic_refresh_grey600_48dp.png
│ │ ├── ic_refresh_white_48dp.png
│ │ ├── ic_settings_black_48dp.png
│ │ ├── ic_settings_grey600_48dp.png
│ │ ├── ic_settings_white_48dp.png
│ │ ├── ic_share_black_48dp.png
│ │ ├── ic_share_grey600_48dp.png
│ │ ├── ic_share_white_48dp.png
│ │ └── ic_stat_notification.png
│ │ ├── drawable-xhdpi-v11
│ │ └── ic_stat_notification.png
│ │ ├── drawable-xhdpi
│ │ ├── ic_action_overflow.png
│ │ ├── ic_action_refresh.png
│ │ ├── ic_action_settings.png
│ │ ├── ic_action_share.png
│ │ ├── ic_info_black_48dp.png
│ │ ├── ic_info_outline_black_48dp.png
│ │ ├── ic_refresh_black_48dp.png
│ │ ├── ic_refresh_grey600_48dp.png
│ │ ├── ic_refresh_white_48dp.png
│ │ ├── ic_settings_black_48dp.png
│ │ ├── ic_settings_grey600_48dp.png
│ │ ├── ic_settings_white_48dp.png
│ │ ├── ic_share_black_48dp.png
│ │ ├── ic_share_grey600_48dp.png
│ │ ├── ic_share_white_48dp.png
│ │ └── ic_stat_notification.png
│ │ ├── drawable-xxhdpi-v11
│ │ └── ic_stat_notification.png
│ │ ├── drawable-xxhdpi
│ │ ├── ic_action_overflow.png
│ │ ├── ic_action_refresh.png
│ │ ├── ic_action_settings.png
│ │ ├── ic_action_share.png
│ │ ├── ic_info_black_48dp.png
│ │ ├── ic_info_outline_black_48dp.png
│ │ ├── ic_refresh_black_48dp.png
│ │ ├── ic_refresh_grey600_48dp.png
│ │ ├── ic_refresh_white_48dp.png
│ │ ├── ic_settings_black_48dp.png
│ │ ├── ic_settings_grey600_48dp.png
│ │ ├── ic_settings_white_48dp.png
│ │ ├── ic_share_black_48dp.png
│ │ ├── ic_share_grey600_48dp.png
│ │ ├── ic_share_white_48dp.png
│ │ ├── ic_stat_notification.png
│ │ └── icon_notext.png
│ │ ├── drawable-xxxhdpi-v11
│ │ └── ic_stat_notification.png
│ │ ├── drawable-xxxhdpi
│ │ ├── ic_dashclock.png
│ │ ├── ic_info_black_48dp.png
│ │ ├── ic_info_outline_black_48dp.png
│ │ ├── ic_refresh_black_48dp.png
│ │ ├── ic_refresh_grey600_48dp.png
│ │ ├── ic_refresh_white_48dp.png
│ │ ├── ic_settings_black_48dp.png
│ │ ├── ic_settings_grey600_48dp.png
│ │ ├── ic_settings_white_48dp.png
│ │ ├── ic_share_black_48dp.png
│ │ ├── ic_share_grey600_48dp.png
│ │ ├── ic_share_white_48dp.png
│ │ ├── ic_stat_notification.png
│ │ └── icon_notext.png
│ │ ├── drawable
│ │ ├── card_background.xml
│ │ ├── clickable.xml
│ │ ├── ic_info_black_24dp.xml
│ │ ├── ic_notifications_black_24dp.xml
│ │ ├── ic_sync_black_24dp.xml
│ │ ├── icon_kb.png
│ │ ├── icon_transparent.png
│ │ ├── widget_frame.9.png
│ │ └── widget_shape.xml
│ │ ├── layout-v21
│ │ └── stat_row.xml
│ │ ├── layout
│ │ ├── about.xml
│ │ ├── activity_diagnosticsapp.xml
│ │ ├── activity_systemapp.xml
│ │ ├── bbs_spinner_dropdown_item.xml
│ │ ├── bbs_spinner_layout.xml
│ │ ├── changelog.xml
│ │ ├── changelog_row.xml
│ │ ├── credits.xml
│ │ ├── credits_row.xml
│ │ ├── details_dialog.xml
│ │ ├── dialog_rate.xml
│ │ ├── graph_row.xml
│ │ ├── graphs.xml
│ │ ├── helpwebview.xml
│ │ ├── import_export_prefs.xml
│ │ ├── locale_plugin_main.xml
│ │ ├── package_info.xml
│ │ ├── package_info_row.xml
│ │ ├── package_info_tabs.xml
│ │ ├── packageinfo.xml
│ │ ├── pager_item.xml
│ │ ├── preferences_fragment.xml
│ │ ├── raw_stats.xml
│ │ ├── seek_bar_preference.xml
│ │ ├── stat_row.xml
│ │ ├── stats.xml
│ │ ├── text_widget_horz.xml
│ │ ├── text_widget_legend.xml
│ │ ├── toolbar_icon.xml
│ │ ├── widget.xml
│ │ ├── widget_horz.xml
│ │ ├── widget_legend.xml
│ │ └── widget_vert.xml
│ │ ├── menu
│ │ ├── alarms_menu.xml
│ │ ├── kernelwakelocks_menu.xml
│ │ ├── locale_menu.xml
│ │ ├── mainmenu.xml
│ │ ├── permissions_menu.xml
│ │ └── serie_menu.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_notification.png
│ │ ├── values-ar
│ │ └── experimental_strings.xml
│ │ ├── values-cs
│ │ └── strings.xml
│ │ ├── values-de
│ │ └── strings.xml
│ │ ├── values-es
│ │ ├── arrays.xml
│ │ └── strings.xml
│ │ ├── values-fr
│ │ └── strings.xml
│ │ ├── values-hr
│ │ └── strings.xml
│ │ ├── values-it
│ │ └── strings.xml
│ │ ├── values-nl
│ │ └── strings.xml
│ │ ├── values-pt-rBR
│ │ ├── arrays.xml
│ │ └── strings.xml
│ │ ├── values-ru
│ │ └── strings.xml
│ │ ├── values-small
│ │ └── dimens.xml
│ │ ├── values-sw600dp-land
│ │ └── dimens.xml
│ │ ├── values-sw600dp
│ │ └── dimens.xml
│ │ ├── values-sw720dp-land
│ │ └── dimens.xml
│ │ ├── values-sw720dp
│ │ └── dimens.xml
│ │ ├── values-v14
│ │ └── dimens.xml
│ │ ├── values-zh-rCN
│ │ └── strings.xml
│ │ ├── values
│ │ ├── arrays.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── theme.xml
│ │ └── xml
│ │ ├── backup_rules.xml
│ │ ├── changelog_master.xml
│ │ ├── pref_dashboard.xml
│ │ ├── preferences.xml
│ │ ├── provider_paths.xml
│ │ ├── text_widget_provider.xml
│ │ └── widget_provider.xml
│ └── test
│ └── java
│ └── com
│ └── asksven
│ └── betterbatterystats
│ └── data
│ ├── DatapointTest.java
│ ├── GraphSerieTest.java
│ └── ReferenceDtoTest.java
├── asksven.keystore-cipher
├── asksven_debug.keystore-cipher
├── build.gradle
├── circle.yml
├── circleciscripts
├── decrypt-tokens.sh
├── decrypt_env_vars.sh
├── deployAppCenter.sh
├── download_keystore.sh
├── download_pubprofile.sh
└── renameapks.sh
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── secret-env-cipher
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | .idea/misc.xml
6 | /.idea/caches/
7 | /.idea/libraries
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 | /app/google-services.json
13 | /app/src/gplay/google-services.json
14 | /app/src/xdaedition/google-services.json
15 |
16 | secret-env-plain
17 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/render.experimental.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /sa-google-play.json
3 |
--------------------------------------------------------------------------------
/app/libs/RootShell-1.6.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/libs/RootShell-1.6.aar
--------------------------------------------------------------------------------
/app/libs/RootTools-5.0.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/libs/RootTools-5.0.aar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/android/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/sa-google-play.json-cipher:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/sa-google-play.json-cipher
--------------------------------------------------------------------------------
/app/src/androidTest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/asksven/android/common/privateapiproxies/PackageIconTest.java:
--------------------------------------------------------------------------------
1 | package com.asksven.android.common.privateapiproxies;
2 |
3 | import static org.junit.Assert.assertNotNull;
4 | import static org.junit.Assert.assertTrue;
5 |
6 | import android.content.Context;
7 | import android.content.pm.ApplicationInfo;
8 | import android.content.pm.PackageManager;
9 | import android.graphics.drawable.Drawable;
10 | import android.graphics.drawable.Icon;
11 | import android.os.IBinder;
12 | import android.os.MemoryFile;
13 | import android.os.Parcel;
14 | import android.os.ParcelFileDescriptor;
15 | import android.util.Log;
16 |
17 | import androidx.test.core.app.ApplicationProvider;
18 |
19 | import com.asksven.android.common.nameutils.UidNameResolver;
20 | import com.asksven.betterbatterystats.BbsApplication;
21 |
22 | import org.junit.Test;
23 |
24 | import java.io.FileDescriptor;
25 | import java.io.FileInputStream;
26 | import java.io.IOException;
27 | import java.lang.reflect.Constructor;
28 | import java.lang.reflect.Method;
29 | import java.util.ArrayList;
30 |
31 | /**
32 | * Created by sven on 01/05/2017.
33 | */
34 |
35 | public class PackageIconTest {
36 |
37 | private BatteryStatsProxy mStats = null;
38 |
39 | static final String TAG = "PackageIconTest";
40 |
41 |
42 |
43 |
44 | @Test
45 | public void test_getPackages() throws Exception
46 | {
47 | try
48 | {
49 | Context ctx = ApplicationProvider.getApplicationContext();
50 | assertNotNull(ctx);
51 | mStats = BatteryStatsProxy.getInstance(ctx);
52 |
53 | ArrayList elements = mStats.getWakeupStatsPost6(ctx, 2);
54 | for (int i=0; i < elements.size(); i++)
55 | {
56 | StatElement elem = elements.get(i);
57 | if (1==1 | elem.getPackageName().equals("me.bluemail.mail"))
58 | {
59 | Log.i(TAG, "Found package " + elem.getPackageName());
60 | //Drawable ic = elem.getIcon(UidNameResolver.getInstance());
61 | //ApplicationInfo app = ctx.getPackageManager().getApplicationInfo(elem.getPackageName(), 0);
62 | //Drawable ic = ctx.getPackageManager().getApplicationIcon(elem.getPackageName());
63 | Drawable ic =ctx.getPackageManager().getDefaultActivityIcon();
64 | if (ic != null)
65 | {
66 | Log.i(TAG, "Found");
67 | }
68 |
69 | }
70 |
71 | }
72 |
73 | }
74 | catch( Exception e )
75 | {
76 | Log.e(TAG, "An exception occured in PackageIconTest(). Message: " + e.getCause());
77 | assertTrue(false);
78 | }
79 | }
80 |
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/asksven/android/common/privateapiproxies/PrivateApiTest.java:
--------------------------------------------------------------------------------
1 | package com.asksven.android.common.privateapiproxies;
2 |
3 | import static org.junit.Assert.assertFalse;
4 | import static org.junit.Assert.assertNotNull;
5 | import static org.junit.Assert.assertTrue;
6 |
7 | import android.content.Context;
8 | import android.os.Build;
9 | import android.os.SystemClock;
10 | import android.util.Log;
11 |
12 | import androidx.test.core.app.ApplicationProvider;
13 |
14 | import org.junit.Before;
15 | import org.junit.Test;
16 |
17 | /**
18 | * Created by sven on 01/05/2017.
19 | */
20 |
21 | public class PrivateApiTest {
22 |
23 | static final String TAG = "PrivateApiTest";
24 |
25 |
26 | @Test
27 | public void getPrivateApiAccessible() throws Exception
28 | {
29 | try
30 | {
31 | Class.forName("android.app.ActivityThread").getDeclaredField("mResourcesManager");
32 | }
33 | catch (Exception e)
34 | {
35 | Log.d("An error occured: ", e.getMessage());
36 | assertTrue(false);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/asksven/betterbatterystats/ShareActivityTestCancel.java:
--------------------------------------------------------------------------------
1 | package com.asksven.betterbatterystats;
2 |
3 |
4 | import androidx.test.espresso.ViewInteraction;
5 | import androidx.test.rule.ActivityTestRule;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 | //import android.support.test.filters.LargeTest;
8 | import android.view.WindowManager;
9 |
10 | import org.junit.Before;
11 | import org.junit.Rule;
12 | import org.junit.Test;
13 | import org.junit.runner.RunWith;
14 |
15 | import static androidx.test.espresso.Espresso.onView;
16 | import static androidx.test.espresso.action.ViewActions.*;
17 | import static androidx.test.espresso.assertion.ViewAssertions.*;
18 | import static androidx.test.espresso.matcher.ViewMatchers.*;
19 | import static org.hamcrest.Matchers.allOf;
20 |
21 |
22 | @RunWith(AndroidJUnit4.class)
23 | public class ShareActivityTestCancel
24 | {
25 |
26 | @Rule
27 | public ActivityTestRule mActivityTestRule = new ActivityTestRule<>(StatsActivity.class);
28 |
29 | @Before
30 | public void setUp() {
31 | final StatsActivity activity = mActivityTestRule.getActivity();
32 | Runnable wakeUpDevice = new Runnable() {
33 | public void run() {
34 | activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
35 | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
36 | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
37 | }
38 | };
39 | activity.runOnUiThread(wakeUpDevice);
40 | }
41 |
42 | @Test
43 | public void shareActivityTest()
44 | {
45 | // Added a sleep statement to match the app's execution delay.
46 | // The recommended way to handle such scenarios is to use Espresso idling resources:
47 | // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
48 | try
49 | {
50 | Thread.sleep(2000);
51 | } catch (InterruptedException e)
52 | {
53 | e.printStackTrace();
54 | }
55 |
56 | ViewInteraction actionMenuItemView = onView(
57 | allOf(withId(R.id.share), withContentDescription("Share"), isDisplayed()));
58 | actionMenuItemView.perform(click());
59 |
60 | // Added a sleep statement to match the app's execution delay.
61 | // The recommended way to handle such scenarios is to use Espresso idling resources:
62 | // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
63 | try
64 | {
65 | Thread.sleep(2000);
66 | } catch (InterruptedException e)
67 | {
68 | e.printStackTrace();
69 | }
70 |
71 | ViewInteraction appCompatButton2 = onView(withText("Cancel"));
72 | appCompatButton2.perform(click());
73 |
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/asksven/com/asksven/android/common/NonRootShellTest.java:
--------------------------------------------------------------------------------
1 | package com.asksven.android.common;
2 |
3 | import org.junit.Before;
4 | import org.junit.Test;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | import static org.junit.Assert.assertFalse;
10 | import static org.junit.Assert.assertNotNull;
11 | import static org.junit.Assert.assertTrue;
12 |
13 | /**
14 | * Created by sven on 01/05/2017.
15 | */
16 |
17 | public class NonRootShellTest
18 | {
19 |
20 | private NonRootShell shell = null;
21 | static final String TAG = "NonRootShellTest";
22 |
23 | @Before
24 | public void createInstance() throws Exception
25 | {
26 | shell = NonRootShell.getInstance();
27 | assertNotNull(shell);
28 |
29 | }
30 |
31 | @Test
32 | public void test_run() throws Exception
33 | {
34 | List res = new ArrayList();
35 | String command = "ls -l /";
36 | res = shell.run(command);
37 |
38 | assertFalse(res.isEmpty());
39 |
40 | assertTrue(!res.get(0).equals(command));
41 | }
42 |
43 | @Test
44 | public void test_dumpsys_alam() throws Exception
45 | {
46 | List res = new ArrayList();
47 | String command = "dumpsys alarm";
48 | res = shell.run(command);
49 |
50 | assertTrue(res != null);
51 |
52 | }
53 |
54 |
55 | @Test
56 | public void test_dumpsys() throws Exception
57 | {
58 | List res = new ArrayList();
59 | String command = "dumpsys";
60 | res = shell.run(command);
61 |
62 | assertTrue(res != null);
63 |
64 | }
65 |
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/asksven/com/asksven/android/common/RootShellTest.java:
--------------------------------------------------------------------------------
1 | package com.asksven.android.common;
2 |
3 | import org.junit.Before;
4 | import org.junit.Test;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | import static org.junit.Assert.assertFalse;
10 | import static org.junit.Assert.assertNotNull;
11 | import static org.junit.Assert.assertTrue;
12 |
13 | /**
14 | * Created by sven on 01/05/2017.
15 | */
16 |
17 | public class RootShellTest
18 | {
19 |
20 | private RootShell shell = null;
21 | static final String TAG = "rootShellTest";
22 |
23 | @Before
24 | public void createInstance() throws Exception
25 | {
26 | shell = RootShell.getInstance();
27 | assertNotNull(shell);
28 |
29 | }
30 |
31 | @Test
32 | public void test_run() throws Exception
33 | {
34 | List res = new ArrayList();
35 | String command = "ls -l /";
36 | res = shell.run(command);
37 |
38 | assertFalse(res.isEmpty());
39 |
40 | // if rooted the result should be different from the command, if not then it should be equal
41 | if (shell.phoneRooted())
42 | {
43 | assertTrue(!res.get(0).equals(command));
44 | assertTrue(res.size() > 1);
45 | }
46 | else
47 | {
48 | assertTrue(res.get(0).equals(command));
49 | }
50 |
51 | }
52 |
53 | @Test
54 | public void test_dumpsys() throws Exception
55 | {
56 | List res = new ArrayList();
57 | String command = "dumpsys alarm";
58 | res = shell.run(command);
59 |
60 | assertTrue(res != null);
61 |
62 | }
63 |
64 |
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/asksven/com/asksven/android/common/WakeupSourcesTest.java:
--------------------------------------------------------------------------------
1 | package com.asksven.com.asksven.android.common;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.core.app.ApplicationProvider;
6 | import androidx.test.platform.app.InstrumentationRegistry;
7 | import android.util.Log;
8 |
9 | import com.asksven.android.common.kernelutils.WakeupSources;
10 | import com.asksven.android.common.privateapiproxies.StatElement;
11 |
12 | import org.junit.Before;
13 | import org.junit.Test;
14 |
15 | import java.io.FileInputStream;
16 | import java.io.FileReader;
17 | import java.io.IOException;
18 | import java.util.ArrayList;
19 |
20 | import static org.junit.Assert.assertFalse;
21 | import static org.junit.Assert.assertNotNull;
22 | import static org.junit.Assert.assertTrue;
23 |
24 | public class WakeupSourcesTest
25 | {
26 |
27 | private Context ctx = null;
28 | private static String FILE_PATH = "/d/wakeup_sources";
29 |
30 |
31 | @Before
32 | public void createInstance() throws Exception
33 | {
34 | Context ctx = ApplicationProvider.getApplicationContext();
35 | assertNotNull(ctx);
36 | }
37 |
38 | @Test
39 | public void test_accessFile() throws Exception
40 | {
41 | boolean exists = false;
42 | FileReader fr = null;
43 | try
44 | {
45 | fr = new FileReader(FILE_PATH);
46 | exists = true;
47 | }
48 | catch (Exception e)
49 | {
50 | exists = false;
51 | }
52 | finally
53 | {
54 | if (exists)
55 | {
56 | try
57 | {
58 | fr.close();
59 | }
60 | catch (IOException e)
61 | {
62 | // do nothing
63 | }
64 | }
65 | }
66 |
67 | assertTrue(exists);
68 | }
69 |
70 | @Test
71 | public void test_accessFile2() throws Exception
72 | {
73 | boolean exists = false;
74 | byte[] buffer = new byte[32*1024];
75 | int len;
76 |
77 | try
78 | {
79 | FileInputStream is;
80 | is = new FileInputStream(FILE_PATH);
81 | len = is.read(buffer);
82 | is.close();
83 |
84 | }
85 | catch (Exception e)
86 | {
87 | Log.e("Test", "Test:" + e.getMessage());
88 | assertTrue(false);
89 | }
90 |
91 |
92 | }
93 |
94 | @Test
95 | public void test_parseWakeupSources() throws Exception
96 | {
97 | ArrayList result = WakeupSources.parseWakeupSources(ctx);
98 | assertNotNull(result);
99 | assertTrue(!result.isEmpty());
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/CommonLogSettings.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.common;
17 |
18 | /**
19 | * @author sven
20 | *
21 | */
22 | public class CommonLogSettings
23 | {
24 | public static final String LOGGING_TAG = "AndoidCommon";
25 | public static boolean DEBUG = false;
26 | public static boolean TRACE = false;
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/AlarmDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 | import java.util.ArrayList;
21 |
22 | import org.codehaus.jackson.annotate.JsonProperty;
23 |
24 | import com.asksven.android.common.nameutils.UidInfo;
25 |
26 | /**
27 | * A DTO class for Alarms
28 | * @author sven
29 | *
30 | */
31 | public class AlarmDto implements Serializable
32 | {
33 |
34 | // from StatElement
35 | @JsonProperty("uid") public int m_uid = -1;
36 |
37 | @JsonProperty("total") public long m_total;
38 |
39 | // from Alarm
40 | @JsonProperty("package_name") public String m_strPackageName;
41 |
42 | // from Alarm
43 | @JsonProperty("details") public String m_details;
44 |
45 | @JsonProperty("wakeups") public long m_nWakeups;
46 |
47 | @JsonProperty("total_count") public long m_nTotalCount;
48 |
49 | @JsonProperty("time_running_ms") public long m_timeRunning;
50 |
51 | @JsonProperty("items") public ArrayList m_items;
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/AlarmItemDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | /**
24 | * A DTO for AlarmItems
25 | * @author sven
26 | *
27 | */
28 | public class AlarmItemDto implements Serializable
29 | {
30 | @JsonProperty("number") public long m_nNumber;
31 |
32 | @JsonProperty("intent") public String m_strIntent;
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/MiscDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | import com.asksven.android.common.nameutils.UidInfo;
24 |
25 | /**
26 | * A FTO for Misc
27 | * @author sven
28 | *
29 | */
30 | public class MiscDto implements Serializable
31 | {
32 |
33 | // from StatElement
34 | @JsonProperty("uid") public int m_uid = -1;
35 |
36 | @JsonProperty("total") public long m_total;
37 |
38 | // from Misc
39 | @JsonProperty("name") public String m_name;
40 |
41 | @JsonProperty("time_on_ms") public long m_timeOn;
42 |
43 | @JsonProperty("time_running_ms") public long m_timeRunning;
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/NativeKernelWakelockDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | import com.asksven.android.common.nameutils.UidInfo;
24 |
25 | /**
26 | * A DTO for NativeKernelWakelock
27 | * @author sven
28 | *
29 | */
30 | public class NativeKernelWakelockDto implements Serializable
31 | {
32 |
33 | // from StatElement
34 | @JsonProperty("uid") public int m_uid = -1;
35 |
36 | @JsonProperty("total") public long m_total;
37 |
38 | // from NativeKernelWakelock
39 | @JsonProperty("name") public String m_name;
40 |
41 | @JsonProperty("details") public String m_details;
42 |
43 | @JsonProperty("count") public int m_count;
44 |
45 | @JsonProperty("expire_count") public int m_expireCount;
46 |
47 | @JsonProperty("wake_count") public int m_wakeCount;
48 |
49 | @JsonProperty("active_since") public long m_activeSince;
50 |
51 | @JsonProperty("total_time") public long m_ttlTime;
52 |
53 | @JsonProperty("sleep_time") public long m_sleepTime;
54 |
55 | @JsonProperty("max_time") public long m_maxTime;
56 |
57 | @JsonProperty("last_change") public long m_lastChange;
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/NetworkUsageDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | import com.asksven.android.common.nameutils.UidInfo;
24 |
25 | /**
26 | * A DTO for NetworkUsage
27 | * @author sven
28 | *
29 | */
30 | public class NetworkUsageDto implements Serializable
31 | {
32 |
33 | // from StatElement
34 | @JsonProperty("uid") public int m_uid = -1;
35 |
36 | @JsonProperty("total") public long m_total;
37 |
38 | // from NetworkUsage
39 | @JsonProperty("bytes_received") public long m_bytesReceived=0;
40 |
41 | @JsonProperty("bytes_sent") public long m_bytesSent=0;
42 |
43 | @JsonProperty("iface") public String m_iface = "";
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/ProcessDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | import com.asksven.android.common.nameutils.UidInfo;
24 | import com.google.gson.annotations.SerializedName;
25 |
26 | /**
27 | * A DTO for Process
28 | * @author sven
29 | *
30 | */
31 | public class ProcessDto implements Serializable
32 | {
33 |
34 | // from StatElement
35 | @JsonProperty("uid") public int m_uid = -1;
36 |
37 | @JsonProperty("total") public long m_total;
38 |
39 | // from Process
40 | @JsonProperty("name") public String m_name;
41 |
42 | @JsonProperty("system_time") public long m_systemTime;
43 |
44 | @SerializedName("user_time") public long m_userTime;
45 |
46 | @JsonProperty("starts") public int m_starts;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/SensorUsageDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 | import java.util.ArrayList;
21 |
22 | import org.codehaus.jackson.annotate.JsonProperty;
23 |
24 | import com.asksven.android.common.nameutils.UidInfo;
25 |
26 | /**
27 | * A DTO class for Alarms
28 | * @author sven
29 | *
30 | */
31 | public class SensorUsageDto implements Serializable
32 | {
33 |
34 | // from StatElement
35 | @JsonProperty("uid") public int m_uid = -1;
36 |
37 | // from Sensor
38 | @JsonProperty("package_name") public String m_strPackageName;
39 |
40 | // from Alarm
41 | @JsonProperty("details") public String m_details;
42 |
43 | @JsonProperty("total") public long m_totalTime;
44 |
45 | @JsonProperty("items") public ArrayList m_items;
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/SensorUsageItemDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | /**
24 | * A DTO for SensorItems
25 | * @author sven
26 | *
27 | */
28 | public class SensorUsageItemDto implements Serializable
29 | {
30 | @JsonProperty("time") public long m_nTime;
31 | @JsonProperty("handle") public int m_nHandle;
32 |
33 | @JsonProperty("sensor") public String m_strSensor;
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/StateDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | import com.asksven.android.common.nameutils.UidInfo;
24 | import com.google.gson.annotations.SerializedName;
25 |
26 | /**
27 | * A DTO for State
28 | * @author sven
29 | *
30 | */
31 | public class StateDto implements Serializable
32 | {
33 |
34 | // from StatElement
35 | @JsonProperty("uid") public int m_uid = -1;
36 |
37 | @JsonProperty("total") public long m_total;
38 |
39 | // from State
40 | @JsonProperty("freq") public int m_freq = 0;
41 |
42 | @JsonProperty("duration_ms") public long m_duration = 0;
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/UidInfoDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | /**
24 | * @author sven
25 | *
26 | */
27 | public class UidInfoDto implements Serializable
28 | {
29 | @JsonProperty("uid") public int m_uid;
30 | @JsonProperty("name") public String m_uidName = "";
31 | @JsonProperty("package")public String m_uidNamePackage = "";
32 | @JsonProperty("unique") public boolean m_uidUniqueName = false;
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/dto/WakelockDto.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.dto;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.codehaus.jackson.annotate.JsonProperty;
22 |
23 | import com.asksven.android.common.nameutils.UidInfo;
24 |
25 | /**
26 | * A DTO for Wakelock
27 | * @author sven
28 | *
29 | */
30 | public class WakelockDto implements Serializable
31 | {
32 |
33 | // from StatElement
34 | @JsonProperty("uid") public int m_uid;
35 |
36 | @JsonProperty("total") public long m_total;
37 |
38 | // from Wakelock
39 | @JsonProperty("wake_type") public int m_wakeType;
40 |
41 | @JsonProperty("name") public String m_name;
42 |
43 | @JsonProperty("duration_ms") public long m_duration;
44 |
45 | @JsonProperty("count") public int m_count;
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/location/GeoUtils.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package com.asksven.android.common.location;
5 |
6 | import java.util.List;
7 |
8 | import com.asksven.android.common.networkutils.DataNetwork;
9 |
10 | import android.content.Context;
11 | import android.location.Address;
12 | import android.location.Geocoder;
13 | import android.location.Location;
14 | import android.util.Log;
15 |
16 | /**
17 | * Helper class for retrieing geo data for a given location
18 | * As geo data requires data connection the call is only made
19 | * if proper data connectivity exists
20 | * @author sven
21 | *
22 | */
23 | public class GeoUtils
24 | {
25 | private static final String TAG = "GeoUtils";
26 |
27 | public static String getNearestAddress(Context ctx, Location loc)
28 | {
29 | if (!DataNetwork.hasDataConnection(ctx))
30 | {
31 | return "";
32 | }
33 |
34 | Address address = getGeoData(ctx, loc);
35 | String strRet = "";
36 | if (address != null)
37 | {
38 | String addr0 = address.getAddressLine(0);
39 | String addr1 = address.getAddressLine(1);
40 | if (!addr0.equals(""))
41 | {
42 | strRet = addr0;
43 | }
44 | if (!addr1.equals(""))
45 | {
46 | if (!strRet.equals(""))
47 | {
48 | strRet = strRet + ", ";
49 | }
50 | strRet = strRet + addr1;
51 | }
52 | }
53 | return strRet;
54 |
55 | }
56 | public static String getNearestCity(Context ctx, Location loc)
57 | {
58 | if (!DataNetwork.hasDataConnection(ctx))
59 | {
60 | return "";
61 | }
62 |
63 | Address address = getGeoData(ctx, loc);
64 | String strRet = "";
65 | if (address != null)
66 | {
67 | strRet = address.getLocality();
68 | }
69 | return strRet;
70 | }
71 |
72 | public static Address getGeoData(Context ctx, Location loc)
73 | {
74 | if (!DataNetwork.hasDataConnection(ctx))
75 | {
76 | return null;
77 | }
78 |
79 | Geocoder myGeocoder = new Geocoder(ctx);
80 | Address address = null;
81 | try
82 | {
83 | List list = myGeocoder.getFromLocation(
84 | loc.getLatitude(),
85 | loc.getLongitude(), 1);
86 | if (list != null & list.size() > 0)
87 | {
88 | address = list.get(0);
89 | }
90 | }
91 | catch (Exception e)
92 | {
93 | Log.e(TAG, "Failed while retrieving nearest city");
94 | }
95 | return address;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/networkutils/DataNetwork.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-12 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.networkutils;
18 |
19 | import android.content.Context;
20 | import android.net.ConnectivityManager;
21 |
22 | /**
23 | * Helper class for data connectivity
24 | * @author sven
25 | *
26 | */
27 | public class DataNetwork
28 | {
29 | public static boolean hasDataConnection(Context ctx)
30 | {
31 | boolean ret = true;
32 | ConnectivityManager myConnectivity =
33 | (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
34 |
35 | // if no network connection is available buffer the update
36 | // @see android.net.NetworkInfo
37 | if ( (myConnectivity == null)
38 | || (myConnectivity.getActiveNetworkInfo() == null)
39 | || (!myConnectivity.getActiveNetworkInfo().isAvailable()) )
40 | {
41 |
42 | ret = false;
43 | }
44 |
45 | return ret;
46 | }
47 |
48 | public static boolean hasWifiConnection(Context ctx)
49 | {
50 | boolean ret = false;
51 | ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
52 | if( cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting() )
53 | {
54 | ret = true;
55 | }
56 | else
57 | {
58 | ret = false;
59 | }
60 |
61 | return ret;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/privateapiproxies/BatteryInfoUnavailableException.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package com.asksven.android.common.privateapiproxies;
5 |
6 | /**
7 | * @author sven
8 | *
9 | */
10 | public class BatteryInfoUnavailableException extends Exception
11 | {
12 |
13 | /**
14 | *
15 | */
16 | private static final long serialVersionUID = 1L;
17 |
18 | public BatteryInfoUnavailableException()
19 | {
20 |
21 | }
22 |
23 | public BatteryInfoUnavailableException(String msg)
24 | {
25 | super(msg);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/privateapiproxies/BatteryStatsTypesLolipop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.common.privateapiproxies;
17 |
18 |
19 |
20 |
21 | /**
22 | * This class holds the required constants from BatteryStats
23 | * Copyright (C) 2008 The Android Open Source Project applies
24 | * @see android.os.BatteryStats
25 | * @author sven
26 | *
27 | */
28 | public class BatteryStatsTypesLolipop extends BatteryStatsTypes
29 | {
30 |
31 | /** Include all of the data in the stats, including previously saved data */
32 | public static final int STATS_SINCE_CHARGED = 0;
33 |
34 | /** Include only the current run in the stats */
35 | public static final int STATS_CURRENT = 1;
36 |
37 | /** Include only the run since the last time the device was unplugged in the stats */
38 | public static final int STATS_SINCE_UNPLUGGED = 2;
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/settings/GpsSettings.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.common.settings;
17 |
18 | import android.annotation.TargetApi;
19 | import android.content.Context;
20 | import android.content.Intent;
21 | import android.net.Uri;
22 | import android.provider.Settings;
23 |
24 | /**
25 | * Manages the GPS settings (
26 | * @author sven
27 | *
28 | */
29 | @TargetApi(8)
30 | public class GpsSettings
31 | {
32 | @TargetApi(8)
33 | public static void turnGPSOn(Context context)
34 | {
35 | String provider = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
36 | Settings.Secure.setLocationProviderEnabled(context.getContentResolver(), "gps", true);
37 | if(!provider.contains("gps"))
38 | {
39 | final Intent poke = new Intent();
40 | poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
41 | poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
42 | poke.setData(Uri.parse("3"));
43 | context.sendBroadcast(poke);
44 | }
45 | }
46 |
47 | public static void turnGPSOff(Context context)
48 | {
49 | String provider = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
50 |
51 | if(provider.contains("gps"))
52 | {
53 | final Intent poke = new Intent();
54 | poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
55 | poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
56 | poke.setData(Uri.parse("3"));
57 | context.sendBroadcast(poke);
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/shellutils/ExecResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.android.common.shellutils;
18 |
19 | import java.util.ArrayList;
20 |
21 | public class ExecResult
22 | {
23 | protected boolean m_bSuccess;
24 | protected ArrayList m_oResult;
25 | protected ArrayList m_oError;
26 |
27 | public ExecResult()
28 | {
29 | m_oResult = new ArrayList();
30 | m_oError = new ArrayList();
31 |
32 | }
33 |
34 | public boolean getSuccess()
35 | {
36 | return m_bSuccess;
37 | }
38 |
39 | public ArrayList getResult()
40 | {
41 | return m_oResult;
42 | }
43 |
44 | public String getResultLine()
45 | {
46 | String strRes = "";
47 | if (!m_oResult.isEmpty())
48 | {
49 | strRes = m_oResult.get(0);
50 | }
51 |
52 | return strRes;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/utils/ChargerUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.common.utils;
17 |
18 | import android.content.Context;
19 | import android.content.Intent;
20 | import android.content.IntentFilter;
21 | import android.os.BatteryManager;
22 |
23 | /**
24 | * Helper to detect if charger is plugged
25 | * @author sven
26 | *
27 | */
28 | public class ChargerUtil
29 | {
30 | /**
31 | * Returns true if the charger is currently connected
32 | * @param context
33 | * @return true if the charger is connected
34 | */
35 | public static boolean isConnected(Context context)
36 | {
37 | // make a synchronous call
38 | Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
39 | int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
40 | return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/utils/GenericLogger.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package com.asksven.android.common.utils;
5 |
6 | import android.util.Log;
7 |
8 | import com.asksven.android.common.utils.DataStorage;
9 |
10 | /**
11 | * @author sven
12 | *
13 | */
14 | public abstract class GenericLogger
15 | {
16 |
17 |
18 |
19 | public static void d(String strLogfile, String strTag, String strMessage)
20 | {
21 | Log.d(strTag, strMessage);
22 | DataStorage.LogToFile(strLogfile, strMessage);
23 | }
24 |
25 | public static void e(String strLogfile, String strTag, String strMessage)
26 | {
27 | Log.e(strTag, strMessage);
28 | DataStorage.LogToFile(strLogfile, strMessage);
29 | }
30 |
31 | public static void i(String strLogFile, String strTag, String strMessage)
32 | {
33 | Log.i(strTag, strMessage);
34 | DataStorage.LogToFile(strLogFile, strMessage);
35 | }
36 |
37 | public static void e(String strLogFile, String strTag, StackTraceElement[] stack)
38 | {
39 | Log.e(strTag, "An Exception occured. Stacktrace:");
40 | for (int i=0; i < stack.length; i++)
41 | {
42 | Log.e(strTag, stack[i].toString());
43 | }
44 | DataStorage.LogToFile(strLogFile, stack);
45 | }
46 |
47 | public static void stackTrace(String strTag, StackTraceElement[] stack)
48 | {
49 | Log.e(strTag, "An Exception occured. Stacktrace:");
50 | for (int i=0; i < stack.length; i++)
51 | {
52 | Log.e(strTag, ">>> " + stack[i].toString());
53 | }
54 | }
55 |
56 | private static void writeLog(String strLogFile, String strTag, String strMessage)
57 | {
58 | DataStorage.LogToFile(strLogFile, strMessage);
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/utils/MathUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2013 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.common.utils;
17 |
18 | import java.util.Formatter;
19 |
20 | import android.location.Location;
21 |
22 | /**
23 | * A collection of math functions
24 | * @author sven
25 | *
26 | */
27 | public class MathUtils
28 | {
29 | /**
30 | * calculate great circle distance in meters
31 | * @param pos1 a Location object
32 | * @param pos2 a Location object
33 | * @return the distance between the two locations in meters
34 | */
35 | public static double getDistanceGreatCircle(Location pos1, Location pos2)
36 | {
37 | double lat1 = pos1.getLatitude();
38 | double long1 = pos1.getLongitude();
39 | double lat2 = pos2.getLatitude();
40 | double long2 = pos2.getLongitude();
41 |
42 | double earthRadius = 3958.75;
43 | double dLat = Math.toRadians(lat2-lat1);
44 | double dLng = Math.toRadians(long2-long1);
45 | double a = Math.sin(dLat/2) * Math.sin(dLat/2) +
46 | Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
47 | Math.sin(dLng/2) * Math.sin(dLng/2);
48 | double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
49 | double dist = earthRadius * c;
50 |
51 | int meterConversion = 1609;
52 |
53 | return dist * meterConversion;
54 | }
55 |
56 | public static String formatRatio(long num, long den)
57 | {
58 | StringBuilder mFormatBuilder = new StringBuilder(8);
59 | if (den == 0L)
60 | {
61 | return "---%";
62 | }
63 |
64 | Formatter mFormatter = new Formatter(mFormatBuilder);
65 | float perc = ((float)num) / ((float)den) * 100;
66 | mFormatBuilder.setLength(0);
67 | mFormatter.format("%.1f%%", perc);
68 | mFormatter.close();
69 | return mFormatBuilder.toString();
70 | }
71 |
72 | public static String formatRatio(double num, double den)
73 | {
74 | StringBuilder mFormatBuilder = new StringBuilder(8);
75 | if (den == 0L)
76 | {
77 | return "---%";
78 | }
79 |
80 | Formatter mFormatter = new Formatter(mFormatBuilder);
81 | float perc = ((float)num) / ((float)den) * 100;
82 | mFormatBuilder.setLength(0);
83 | mFormatter.format("%.1f%%", perc);
84 | mFormatter.close();
85 | return mFormatBuilder.toString();
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/common/wifi/WifiManagerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.common.wifi;
17 |
18 | import java.lang.reflect.Field;
19 | import java.lang.reflect.InvocationTargetException;
20 | import java.lang.reflect.Method;
21 |
22 | import android.content.Context;
23 | import android.net.wifi.WifiManager;
24 | import android.os.IBinder;
25 | import android.os.Parcel;
26 | import android.os.Parcelable;
27 | import android.util.Log;
28 |
29 | /**
30 | * A proxy for accessing WifiManager's private API
31 | * @author sven
32 | *
33 | */
34 | public class WifiManagerProxy
35 | {
36 |
37 | private static final String TAG = "WifiManagerProxy";
38 | private static WifiManager m_manager = null;
39 |
40 | private WifiManagerProxy(Context ctx)
41 | {
42 |
43 | }
44 |
45 | private static void init(Context ctx)
46 | {
47 | if (m_manager == null)
48 | {
49 | m_manager = (WifiManager) ctx.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
50 | }
51 | }
52 | public static boolean hasWifiLock(Context ctx)
53 | {
54 | init(ctx);
55 | return (getWifiLocks(ctx) > 0);
56 | }
57 |
58 |
59 | /**
60 | * returns the number of help WifiLocks
61 | * @return
62 | */
63 | public static int getWifiLocks(Context ctx)
64 | {
65 | init(ctx);
66 |
67 | int ret = 0;
68 | try
69 | {
70 | Field privateStringField = WifiManager.class.getDeclaredField("mActiveLockCount");
71 |
72 | privateStringField.setAccessible(true);
73 |
74 | Integer fieldValue = (Integer) privateStringField.get(m_manager);
75 | Log.d(TAG, "mActiveLockCount is " + fieldValue);
76 | ret = fieldValue;
77 | }
78 | catch (Exception e)
79 | {
80 | Log.e(TAG, "An exception occured in getWifiLocks(): " + e.getMessage());
81 | ret = -1;
82 | }
83 |
84 | Log.d(TAG, ret + " Wifilocks detected");
85 | return ret;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/contrib/ShellNotClosedException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contrib by Chainfire (see https://raw.github.com/Chainfire/libsuperuser/master/libsuperuser/src/eu/chainfire/libsuperuser/Shell.java)
3 | */
4 | package com.asksven.android.contrib;
5 |
6 | /**
7 | * Exception class used to notify developer that a shell was not close()d
8 | */
9 | @SuppressWarnings("serial")
10 | public class ShellNotClosedException extends RuntimeException {
11 | public static final String EXCEPTION_NOT_CLOSED = "Application did not close() interactive shell";
12 |
13 | public ShellNotClosedException() {
14 | super(EXCEPTION_NOT_CLOSED);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/contrib/ShellOnMainThreadException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contrib by Chainfire (see https://raw.github.com/Chainfire/libsuperuser/master/libsuperuser/src/eu/chainfire/libsuperuser/Shell.java)
3 | */
4 | package com.asksven.android.contrib;
5 | /**
6 | * Exception class used to crash application when shell commands are executed
7 | * from the main thread, and we are in debug mode.
8 | */
9 | @SuppressWarnings("serial")
10 | public class ShellOnMainThreadException extends RuntimeException {
11 | public static final String EXCEPTION_COMMAND = "Application attempted to run a shell command from the main thread";
12 | public static final String EXCEPTION_NOT_IDLE = "Application attempted to wait for a non-idle shell to close on the main thread";
13 | public static final String EXCEPTION_WAIT_IDLE = "Application attempted to wait for a shell to become idle on the main thread";
14 |
15 | public ShellOnMainThreadException(String message) {
16 | super(message);
17 | }
18 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/system/AndroidVersion.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.system;
17 |
18 | import android.os.Build;
19 | /**
20 | * Handles android version detection
21 | * @author sven
22 | *
23 | */
24 | public class AndroidVersion
25 | {
26 | public static boolean isFroyo()
27 | {
28 | boolean bRet = false;
29 | if (Build.VERSION.SDK_INT == Build.VERSION_CODES.FROYO)
30 | {
31 | bRet = true;
32 | }
33 |
34 | return bRet;
35 | }
36 |
37 | public static boolean isGingerbread()
38 | {
39 | boolean bRet = false;
40 | if (Build.VERSION.SDK_INT == Build.VERSION_CODES.GINGERBREAD)
41 | {
42 | bRet = true;
43 | }
44 |
45 | return bRet;
46 | }
47 |
48 | public static boolean isIcs()
49 | {
50 | boolean bRet = false;
51 | if (Build.VERSION.SDK_INT == Build.VERSION_CODES.ICE_CREAM_SANDWICH)
52 | {
53 | bRet = true;
54 | }
55 |
56 | return bRet;
57 | }
58 |
59 | public static boolean isKitKat()
60 | {
61 | boolean bRet = false;
62 | if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT)
63 | {
64 | bRet = true;
65 | }
66 |
67 | return bRet;
68 | }
69 |
70 | public static boolean isLolipop()
71 | {
72 | boolean bRet = false;
73 | if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP)
74 | {
75 | bRet = true;
76 | }
77 |
78 | return bRet;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/system/Devices.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.system;
17 |
18 | import android.content.Context;
19 | import android.content.res.Configuration;
20 |
21 | /**
22 | * @author sven
23 | *
24 | */
25 | public class Devices
26 | {
27 | public static boolean isTablet(Context context)
28 | {
29 | return (context.getResources().getConfiguration().screenLayout
30 | & Configuration.SCREENLAYOUT_SIZE_MASK)
31 | >= Configuration.SCREENLAYOUT_SIZE_LARGE;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/android/system/Installation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.android.system;
17 |
18 | import android.content.Context;
19 | import android.content.pm.ApplicationInfo;
20 | import android.content.pm.PackageInfo;
21 | import android.content.pm.PackageManager;
22 | import android.content.pm.PackageManager.NameNotFoundException;
23 | import android.os.Build.VERSION;
24 |
25 | /**
26 | * @author sven
27 | *
28 | */
29 | public class Installation
30 | {
31 | public static boolean isInstalledOnSdCard(Context context)
32 | {
33 |
34 | PackageManager pm = context.getPackageManager();
35 | try
36 | {
37 | PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
38 | ApplicationInfo ai = pi.applicationInfo;
39 | return (ai.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == ApplicationInfo.FLAG_EXTERNAL_STORAGE;
40 | }
41 | catch (NameNotFoundException e)
42 | {
43 | // ignore
44 | }
45 |
46 | return false;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/ActionBarListActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2018 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats;
17 |
18 | import android.view.View;
19 | import android.widget.HeaderViewListAdapter;
20 | import android.widget.ListAdapter;
21 | import android.widget.ListView;
22 |
23 | public abstract class ActionBarListActivity extends BaseActivity
24 | {
25 |
26 | private ListView mListView;
27 |
28 | protected ListView getListView()
29 | {
30 | if (mListView == null)
31 | {
32 | mListView = (ListView) findViewById(android.R.id.list);
33 | }
34 | return mListView;
35 | }
36 |
37 | protected void setListAdapter(ListAdapter adapter)
38 | {
39 | getListView().setAdapter(adapter);
40 | }
41 |
42 | protected ListAdapter getListAdapter()
43 | {
44 | ListAdapter adapter = getListView().getAdapter();
45 | if (adapter instanceof HeaderViewListAdapter)
46 | {
47 | return ((HeaderViewListAdapter) adapter).getWrappedAdapter();
48 | } else
49 | {
50 | return adapter;
51 | }
52 | }
53 |
54 | protected void onListItemClick(ListView lv, View v, int position, long id)
55 | {
56 | getListView().getOnItemClickListener().onItemClick(lv, v, position, id);
57 | }
58 |
59 | @Override
60 | protected void onResume()
61 | {
62 | super.onResume();
63 | }
64 |
65 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/ActiveMonAlarmReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | * Copyright (C) 2012 asksven
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.asksven.betterbatterystats;
19 |
20 | import android.content.BroadcastReceiver;
21 | import android.content.Context;
22 | import android.content.Intent;
23 | import android.content.SharedPreferences;
24 | import android.preference.PreferenceManager;
25 | import android.util.Log;
26 |
27 | import com.asksven.betterbatterystats.data.StatsProvider;
28 | import com.asksven.betterbatterystats.services.WriteTimerReferenceService;
29 |
30 | /**
31 | * Handles alarms to turn off Wifi is a connection could not be established
32 | * @author sven
33 | *
34 | */
35 | public class ActiveMonAlarmReceiver extends BroadcastReceiver
36 | {
37 | private static String TAG = "ActiveMonAlarmReceiver";
38 | public static int ACTIVE_MON_ALARM = 323;
39 |
40 | @Override
41 | public void onReceive(Context context, Intent intent)
42 | {
43 | Log.d(TAG, "Alarm received: processing");
44 |
45 |
46 | try
47 | {
48 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
49 |
50 | // if enabled write the ref and schedule the next alarm
51 | if (prefs.getBoolean("active_mon_enabled", false))
52 | {
53 | // reschedule next timer
54 | StatsProvider.scheduleActiveMonAlarm(context);
55 |
56 | // write the reference
57 | Intent serviceIntent = new Intent(context, WriteTimerReferenceService.class);
58 | context.startService(serviceIntent);
59 | }
60 | else
61 | {
62 | StatsProvider.cancelActiveMonAlarm(context);
63 | return;
64 | }
65 | }
66 | catch (Exception e)
67 | {
68 | Log.e(TAG, "An error occured receiving the alarm" + e.getMessage());
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/BaseActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2018 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats;
17 |
18 | import android.content.Context;
19 | import android.content.SharedPreferences;
20 | import android.os.Bundle;
21 | import android.preference.PreferenceManager;
22 | import androidx.appcompat.app.AppCompatActivity;
23 | import androidx.appcompat.app.AppCompatDelegate;
24 |
25 | public class BaseActivity extends AppCompatActivity
26 | {
27 | @Override
28 | protected void onResume()
29 | {
30 |
31 | this.setTheme(BaseActivity.getTheme(this));
32 | super.onResume();
33 |
34 | }
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState)
37 | {
38 | // Obtain the shared Tracker instance.
39 | BbsApplication application = (BbsApplication) getApplication();
40 |
41 | SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
42 | String theme = sharedPrefs.getString("theme", "2");
43 | super.onCreate(savedInstanceState);
44 | }
45 |
46 | public final static int getTheme(Context ctx)
47 | {
48 | SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(ctx);
49 | String theme = sharedPrefs.getString("theme", "2");
50 |
51 | if (theme.equals("0"))
52 | {
53 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
54 | return R.style.Theme_Bbs_Light;
55 | } else if (theme.equals("1"))
56 | {
57 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
58 | return R.style.Theme_Bbs_Dark;
59 | } else {
60 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
61 | return R.style.Theme_Bbs_Auto;
62 | }
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/BbsApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats;
17 |
18 | import java.util.Locale;
19 |
20 | import android.app.Application;
21 | import android.content.Context;
22 | import android.content.SharedPreferences;
23 | import android.content.res.Configuration;
24 | import android.preference.PreferenceManager;
25 |
26 | import androidx.multidex.MultiDexApplication;
27 |
28 |
29 | /**
30 | * @author android
31 | */
32 | public class BbsApplication extends MultiDexApplication
33 | {
34 |
35 | private Locale localeEN = Locale.ENGLISH;
36 | private static String TAG = "BbsApplication";
37 | private static Context context;
38 |
39 |
40 |
41 | @Override
42 | public void onConfigurationChanged(Configuration newConfig)
43 | {
44 | super.onConfigurationChanged(newConfig);
45 |
46 | SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
47 | boolean forceEN = settings.getBoolean("force_en", false);
48 |
49 | Configuration config = getBaseContext().getResources().getConfiguration();
50 |
51 | Locale appLocale = null;
52 | if (forceEN)
53 | {
54 | appLocale = localeEN;
55 | } else
56 | {
57 | appLocale = getResources().getConfiguration().locale;
58 | }
59 | Locale.setDefault(appLocale);
60 | config.locale = appLocale;
61 | getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
62 | }
63 |
64 | @Override
65 | public void onCreate()
66 | {
67 | super.onCreate();
68 |
69 | BbsApplication.context = getApplicationContext();
70 |
71 | SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
72 | boolean forceEN = settings.getBoolean("force_en", false);
73 |
74 | Configuration config = getBaseContext().getResources().getConfiguration();
75 |
76 | Locale appLocale = null;
77 | if (forceEN)
78 | {
79 | appLocale = localeEN;
80 | } else
81 | {
82 | appLocale = getResources().getConfiguration().locale;
83 | }
84 | Locale.setDefault(appLocale);
85 | config.locale = appLocale;
86 | getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
87 |
88 | // set a few analytics user properties
89 | }
90 |
91 | public static Context getAppContext()
92 | {
93 | return BbsApplication.context;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/ChangeLogActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2015 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats;
17 |
18 | import android.os.Bundle;
19 | import androidx.appcompat.widget.Toolbar;
20 |
21 | import com.asksven.betterbatterystats.adapters.ChangeLogAdapter;
22 |
23 | public class ChangeLogActivity extends ActionBarListActivity
24 | {
25 |
26 | private static final String TAG = "ChangeLogActivity";
27 |
28 |
29 | /** Called when the activity is first created. */
30 | @Override
31 | public void onCreate(Bundle savedInstanceState)
32 | {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.changelog);
35 |
36 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
37 | toolbar.setTitle(getString(R.string.label_changelog));
38 |
39 |
40 | setSupportActionBar(toolbar);
41 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
42 | getSupportActionBar().setDisplayUseLogoEnabled(false);
43 |
44 | ChangeLogAdapter adapter = new ChangeLogAdapter(this);
45 | setListAdapter(adapter);
46 |
47 | if (adapter.getReleaseName().equals(""))
48 | {
49 | toolbar.setTitle(getString(R.string.label_changelog));
50 | }
51 | else
52 | {
53 | toolbar.setTitle(getString(R.string.label_changelog) + " (" + adapter.getReleaseName() + ")");
54 | }
55 |
56 |
57 |
58 | }
59 |
60 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/CreditsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2015 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats;
17 |
18 | import android.os.Bundle;
19 | import androidx.appcompat.widget.Toolbar;
20 |
21 | import com.asksven.betterbatterystats.adapters.CreditsAdapter;
22 |
23 | public class CreditsActivity extends ActionBarListActivity
24 | {
25 |
26 | private static final String TAG = "CreditsActivity";
27 |
28 |
29 | /** Called when the activity is first created. */
30 | @Override
31 | public void onCreate(Bundle savedInstanceState)
32 | {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.credits);
35 |
36 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
37 | toolbar.setTitle(getString(R.string.label_credits));
38 |
39 | setSupportActionBar(toolbar);
40 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
41 | getSupportActionBar().setDisplayUseLogoEnabled(false);
42 |
43 | CreditsAdapter adapter = new CreditsAdapter(this);
44 | setListAdapter(adapter);
45 |
46 |
47 |
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/DashClockSettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2013 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.betterbatterystats;
18 |
19 | import android.annotation.SuppressLint;
20 | import android.os.Bundle;
21 | import android.preference.PreferenceActivity;
22 | import android.view.MenuItem;
23 | import com.asksven.betterbatterystats.R;
24 |
25 | public class DashClockSettingsActivity extends PreferenceActivity
26 | {
27 | @SuppressLint("NewApi")
28 | public void onCreate(Bundle savedInstanceState)
29 | {
30 | super.onCreate(savedInstanceState);
31 | //getActionBar().setIcon(R.drawable.icon_notext);
32 | //getActionBar().setDisplayHomeAsUpEnabled(true);
33 | }
34 |
35 | @Override
36 | protected void onPostCreate(Bundle savedInstanceState)
37 | {
38 | super.onPostCreate(savedInstanceState);
39 | addPreferencesFromResource(R.xml.pref_dashboard);
40 | }
41 |
42 | @Override
43 | public boolean onOptionsItemSelected(MenuItem item)
44 | {
45 | if (item.getItemId() == android.R.id.home)
46 | {
47 | // TODO: if the previous activity on the stack isn't a
48 | // ConfigurationActivity,
49 | // launch it.
50 | finish();
51 | return true;
52 | }
53 |
54 | return super.onOptionsItemSelected(item);
55 | }
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/LogSettings.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats;
17 |
18 |
19 | /**
20 | * @author sven
21 | *
22 | */
23 | public class LogSettings
24 | {
25 | // public static final String LOGGING_TAG = "BetterBatteryStats";
26 | public static boolean DEBUG = false;
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/PackageInfoActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012-2015 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.betterbatterystats;
18 |
19 | import android.os.Bundle;
20 | import androidx.fragment.app.FragmentTransaction;
21 | import androidx.appcompat.widget.Toolbar;
22 |
23 | /**
24 | * Demonstrates combining a TabHost with a ViewPager to implement a tab UI that
25 | * switches between tabs and also allows the user to perform horizontal flicks
26 | * to move between the tabs.
27 | */
28 | public class PackageInfoActivity extends BaseActivity
29 | {
30 |
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState)
34 | {
35 | // setTheme(SampleList.THEME); //Used for theme switching in samples
36 | super.onCreate(savedInstanceState);
37 |
38 | setContentView(R.layout.package_info);
39 |
40 | if (savedInstanceState == null) {
41 | FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
42 | PackageInfoTabsFragment fragment = new PackageInfoTabsFragment();
43 | transaction.replace(R.id.sample_content_fragment, fragment);
44 | transaction.commit();
45 | }
46 |
47 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
48 | toolbar.setTitle(getString(R.string.label_packageinfo));
49 |
50 | setSupportActionBar(toolbar);
51 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
52 | getSupportActionBar().setDisplayUseLogoEnabled(false);
53 |
54 |
55 | }
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/Wakelock.java:
--------------------------------------------------------------------------------
1 | package com.asksven.betterbatterystats;
2 |
3 | /*
4 | * Copyright (C) 2012 asksven
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 |
20 | import android.content.Context;
21 | import android.os.Build;
22 | import android.os.PowerManager;
23 | import android.os.PowerManager.WakeLock;
24 | import android.util.Log;
25 |
26 | /**
27 | * An implementation of a global store of static vars
28 | * @author sven
29 | *
30 | */
31 | public class Wakelock
32 | {
33 | private static WakeLock m_saveWakelock;
34 | static final String WAKELOCK = "bbs:wakelock_while_saving_ref"; //BBS_WAKELOCK_WHILE_SAVING_REF";
35 | static final String TAG = "Wakelock";
36 | static final long TIMEOUT = 120 * 1000; // we should not hold a wakelock for longer that 30s
37 |
38 | public static synchronized void aquireWakelock(Context ctx)
39 | {
40 | PowerManager powerManager = (PowerManager) ctx.getApplicationContext().getSystemService(Context.POWER_SERVICE);
41 | releaseWakelock();
42 | m_saveWakelock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK);
43 |
44 | // and android 2.3.x there seems to be a bug where the wakelock references are not kept / released
45 | // in a thread safe way. See here for details: https://code.google.com/p/android/issues/detail?id=11622
46 | // This is a hack for those versions, avoiding the reference counter to make sure that the under-locking
47 | // exception is not getting thrown
48 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
49 | {
50 | m_saveWakelock.setReferenceCounted(false);
51 | }
52 |
53 | m_saveWakelock.acquire(TIMEOUT);
54 | Log.d(TAG, "Wakelock " + WAKELOCK + " aquired");
55 | }
56 |
57 | public static synchronized void releaseWakelock()
58 | {
59 | try
60 | {
61 | if ((m_saveWakelock != null) && (m_saveWakelock.isHeld()))
62 | {
63 |
64 | m_saveWakelock.release();
65 | Log.d(TAG, "Wakelock " + WAKELOCK + " released");
66 |
67 | }
68 | }
69 | catch (Exception e)
70 | {
71 | Log.e(TAG, "An error occured releasing wakelock:" + e.getMessage());
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/adapters/ChangeLogAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats.adapters;
17 |
18 | import android.content.Context;
19 | import android.util.Log;
20 | import android.view.LayoutInflater;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 | import android.widget.ArrayAdapter;
24 | import android.widget.TextView;
25 |
26 | import com.asksven.betterbatterystats.R;
27 |
28 | import java.util.ArrayList;
29 | import java.util.List;
30 |
31 | import de.cketti.library.changelog.ChangeLog;
32 |
33 | public class ChangeLogAdapter extends ArrayAdapter
34 | {
35 | private final Context m_context;
36 |
37 | private List changeLog = null;
38 |
39 | private String releaseName = "";
40 |
41 | public ChangeLogAdapter(Context context)
42 | {
43 | super(context, R.layout.changelog_row);
44 | this.m_context = context;
45 |
46 | changeLog = new ArrayList();
47 | ChangeLog cl = new ChangeLog(context);
48 | List releases = cl.getChangeLog(true);
49 | if (releases.size() > 0)
50 | {
51 | releaseName = releases.get(0).versionName;
52 | List changes = releases.get(0).changes;
53 |
54 | for (int j=0; j < changes.size(); j++)
55 | {
56 | changeLog.add(changes.get(j));
57 | }
58 | }
59 | else
60 | {
61 | changeLog.add("n/a");
62 | }
63 | }
64 |
65 | @Override
66 | public View getView(int position, View convertView, ViewGroup parent)
67 | {
68 | LayoutInflater inflater = (LayoutInflater) m_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
69 | View rowView = inflater.inflate(R.layout.changelog_row, parent, false);
70 | TextView textViewChange = (TextView) rowView.findViewById(R.id.textViewChange);
71 |
72 | textViewChange.setText(changeLog.get(position));
73 |
74 | return rowView;
75 | }
76 |
77 | public int getCount()
78 | {
79 | if (changeLog != null)
80 | {
81 | return changeLog.size();
82 | }
83 | else
84 | {
85 | return 0;
86 | }
87 | }
88 |
89 | public String getItem(int position)
90 | {
91 | return changeLog.get(position);
92 | }
93 |
94 | public String getReleaseName()
95 | {
96 | return releaseName;
97 | }
98 |
99 | public long getItemId(int position)
100 | {
101 | return position;
102 | }
103 |
104 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/adapters/ServicesAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2012 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats.adapters;
17 |
18 | import java.util.List;
19 | import android.content.Context;
20 | import android.view.LayoutInflater;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 | import android.widget.BaseAdapter;
24 | import android.widget.LinearLayout;
25 | import android.widget.TextView;
26 | import com.asksven.betterbatterystats.R;
27 |
28 | public class ServicesAdapter extends BaseAdapter
29 | {
30 | private Context m_context;
31 |
32 | private List m_listData;
33 | private static final String TAG = "ServicesAdapter";
34 | int m_selectedPosition = 0;
35 | boolean m_expanded = false;
36 |
37 |
38 | public ServicesAdapter(Context context, List listData)
39 | {
40 | this.m_context = context;
41 | this.m_listData = listData;
42 |
43 | }
44 |
45 | public void setSelectedPosition(int position)
46 | {
47 | m_selectedPosition = position;
48 | notifyDataSetChanged();
49 | }
50 |
51 | public void toggleExpand()
52 | {
53 | m_expanded = !m_expanded;
54 | notifyDataSetChanged();
55 | }
56 |
57 | public int getCount()
58 | {
59 | return m_listData.size();
60 | }
61 |
62 | public Object getItem(int position)
63 | {
64 | return m_listData.get(position);
65 | }
66 |
67 | public long getItemId(int position)
68 | {
69 | return position;
70 | }
71 |
72 | public View getView(int position, View convertView, ViewGroup viewGroup)
73 | {
74 | String entry = m_listData.get(position);
75 | if (convertView == null)
76 | {
77 | LayoutInflater inflater = (LayoutInflater) m_context
78 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
79 | convertView = inflater.inflate(R.layout.package_info_row, null);
80 | }
81 | TextView tvName = (TextView) convertView.findViewById(R.id.TextViewName);
82 | tvName.setText(entry);
83 | LinearLayout descriptionLayout = (LinearLayout) convertView.findViewById(R.id.LayoutDescription);
84 |
85 | descriptionLayout.setVisibility(View.GONE);
86 | return convertView;
87 | }
88 | }
89 |
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/contrib/ObservableScrollView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.betterbatterystats.contrib;
18 |
19 | import android.content.Context;
20 | import android.util.AttributeSet;
21 | import android.view.MotionEvent;
22 | import android.widget.ScrollView;
23 |
24 | /**
25 | * A custom ScrollView that can accept a scroll listener.
26 | */
27 | public class ObservableScrollView extends ScrollView {
28 | private Callbacks mCallbacks;
29 |
30 | public ObservableScrollView(Context context, AttributeSet attrs) {
31 | super(context, attrs);
32 | }
33 |
34 | @Override
35 | protected void onScrollChanged(int l, int t, int oldl, int oldt) {
36 | super.onScrollChanged(l, t, oldl, oldt);
37 | if (mCallbacks != null) {
38 | mCallbacks.onScrollChanged(t);
39 | }
40 | }
41 |
42 | @Override
43 | public boolean onTouchEvent(MotionEvent ev) {
44 | if (mCallbacks != null) {
45 | switch (ev.getActionMasked()) {
46 | case MotionEvent.ACTION_DOWN:
47 | mCallbacks.onDownMotionEvent();
48 | break;
49 | case MotionEvent.ACTION_UP:
50 | case MotionEvent.ACTION_CANCEL:
51 | mCallbacks.onUpOrCancelMotionEvent();
52 | break;
53 | }
54 | }
55 | return super.onTouchEvent(ev);
56 | }
57 |
58 | @Override
59 | public int computeVerticalScrollRange() {
60 | return super.computeVerticalScrollRange();
61 | }
62 |
63 | public void setCallbacks(Callbacks listener) {
64 | mCallbacks = listener;
65 | }
66 |
67 | public static interface Callbacks {
68 | public void onScrollChanged(int scrollY);
69 | public void onDownMotionEvent();
70 | public void onUpOrCancelMotionEvent();
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/data/Datapoint.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats.data;
17 |
18 | /**
19 | * @author sven
20 | *
21 | */
22 | public class Datapoint
23 | {
24 | public long mX;
25 | public long mY;
26 |
27 | public Datapoint()
28 | {
29 |
30 | }
31 |
32 | public Datapoint(long x, long y)
33 | {
34 | mX = x;
35 | mY = y;
36 | }
37 |
38 | public String toString()
39 | {
40 | return "X=" + mX + ", Y=" + mY;
41 | }
42 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/data/GraphSerie.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats.data;
17 |
18 | import android.util.Log;
19 |
20 | import java.util.ArrayList;
21 |
22 | /**
23 | * The data source for all series to plot
24 | *
25 | * @author sven
26 | */
27 | public class GraphSerie
28 | {
29 |
30 | private String m_title;
31 | private ArrayList m_serie;
32 |
33 | static final String TAG = "GraphSerie";
34 |
35 | public GraphSerie(String title, ArrayList serie)
36 | {
37 | if (serie != null)
38 | {
39 | m_serie = serie;
40 | } else
41 | {
42 | m_serie = new ArrayList();
43 | }
44 |
45 | m_title = title;
46 |
47 | if (m_serie != null)
48 | {
49 | Log.i(TAG, "Added Serie " + m_title + " with " + m_serie.size() + " entries");
50 | } else
51 | {
52 | Log.i(TAG, "Added Serie was null");
53 | }
54 | }
55 |
56 | public String getTitle()
57 | {
58 | return m_title;
59 | }
60 |
61 | public int size()
62 | {
63 | return m_serie.size();
64 | }
65 |
66 |
67 | public ArrayList getValues()
68 | {
69 | return m_serie;
70 | }
71 |
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/data/Permission.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats.data;
17 |
18 | /**
19 | * @author sven
20 | *
21 | */
22 | public class Permission
23 | {
24 | public String name;
25 | public String description;
26 | public int level;
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/features/FeatureFlags.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2018 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.betterbatterystats.features;
18 |
19 |
20 | import android.content.Context;
21 | import android.content.SharedPreferences;
22 | import android.preference.PreferenceManager;
23 |
24 | //import net.hockeyapp.android.metrics.MetricsManager;
25 |
26 | /**
27 | * Singleton provider for all the statistics
28 | *
29 | *
30 | * @author sven
31 | *
32 | */
33 | public class FeatureFlags
34 | {
35 | private static String TAG = "FeatureFlags";
36 | private static FeatureFlags singleton = null;
37 | private static SharedPreferences prefs;
38 |
39 | private FeatureFlags() {}
40 |
41 | public static FeatureFlags getInstance(Context ctx)
42 | {
43 | prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
44 |
45 | if (singleton == null)
46 | {
47 | singleton = new FeatureFlags();
48 | }
49 |
50 | return singleton;
51 | }
52 |
53 | public boolean isTimeSeriesEnabled()
54 | {
55 | boolean enabled = prefs.getBoolean("flag_time_series", false);
56 | return enabled;
57 | }
58 |
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/fragment_tabs_pager.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
26 |
27 |
31 |
32 |
38 |
39 |
44 |
45 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/handlers/OnUnplugHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.asksven.betterbatterystats.handlers;
18 |
19 |
20 | import com.asksven.betterbatterystats.services.WriteUnpluggedReferenceService;
21 |
22 | import android.content.BroadcastReceiver;
23 | import android.content.Context;
24 | import android.content.Intent;
25 | import android.os.Build;
26 | import android.util.Log;
27 |
28 |
29 | /**
30 | * General broadcast handler: handles event as registered on Manifest
31 | * @author sven
32 | *
33 | */
34 | public class OnUnplugHandler extends BroadcastReceiver
35 | {
36 | private static final String TAG = "OnUnplugHandler";
37 |
38 | /* (non-Javadoc)
39 | * @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent)
40 | */
41 | @Override
42 | public void onReceive(Context context, Intent intent)
43 | {
44 | Log.i(TAG, "Received Broadcast " + intent.getAction() + ", serializing 'since unplugged'");
45 |
46 | // start service to persist reference
47 | Intent serviceIntent = new Intent(context, WriteUnpluggedReferenceService.class);
48 | context.startService(serviceIntent);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/localeplugin/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012-2018 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * This file was contributed by two forty four a.m. LLC
17 | * unter the terms of the Apache License, Version 2.0
18 | */
19 |
20 | package com.asksven.betterbatterystats.localeplugin;
21 |
22 | import android.content.Context;
23 |
24 | /**
25 | * Class of constants used by this Locale plug-in.
26 | */
27 | public final class Constants
28 | {
29 | /**
30 | * Private constructor prevents instantiation
31 | *
32 | * @throws UnsupportedOperationException because this class cannot be instantiated.
33 | */
34 | private Constants()
35 | {
36 | throw new UnsupportedOperationException("This class is non-instantiable"); //$NON-NLS-1$
37 | }
38 |
39 | /**
40 | * Log tag for logcat messages
41 | */
42 | public static final String LOG_TAG = "BBSLocalePlugin"; //$NON-NLS-1$
43 |
44 | /**
45 | * Flag to enable logcat messages.
46 | */
47 | public static final boolean IS_LOGGABLE = true;
48 |
49 | /**
50 | * Flag to enable runtime checking of method parameters
51 | */
52 | public static final boolean IS_PARAMETER_CHECKING_ENABLED = false;
53 |
54 | /**
55 | * Flag to enable runtime checking of whether a method is called on the correct thread
56 | */
57 | public static final boolean IS_CORRECT_THREAD_CHECKING_ENABLED = false;
58 |
59 | /**
60 | * Determines the "versionCode" in the {@code AndroidManifest}.
61 | *
62 | * @param context to read the versionCode. Cannot be null.
63 | * @return versionCode of the app.
64 | * @throws IllegalArgumentException if {@code context} is null.
65 | */
66 | public static int getVersionCode(final Context context)
67 | {
68 | if (Constants.IS_PARAMETER_CHECKING_ENABLED)
69 | {
70 | if (null == context)
71 | {
72 | throw new IllegalArgumentException("context cannot be null"); //$NON-NLS-1$
73 | }
74 | }
75 |
76 | try
77 | {
78 | return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
79 | }
80 | catch (final UnsupportedOperationException e)
81 | {
82 | /*
83 | * This exception is thrown by test contexts
84 | */
85 | return 1;
86 | }
87 | catch (final Exception e)
88 | {
89 | throw new RuntimeException(e);
90 | }
91 | }
92 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/services/WriteCurrentReferenceService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-14 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats.services;
17 |
18 | import android.app.IntentService;
19 | import android.content.Intent;
20 | import android.os.IBinder;
21 | import android.util.Log;
22 |
23 | import com.asksven.android.common.utils.DateUtils;
24 | import com.asksven.android.common.utils.SysUtils;
25 | import com.asksven.betterbatterystats.Wakelock;
26 | import com.asksven.betterbatterystats.data.Reference;
27 | import com.asksven.betterbatterystats.data.ReferenceStore;
28 | import com.asksven.betterbatterystats.data.StatsProvider;
29 | import com.asksven.betterbatterystats.widgetproviders.AppWidget;
30 |
31 | /**
32 | * @author sven
33 | *
34 | */
35 | public class WriteCurrentReferenceService extends IntentService
36 | {
37 | private static final String TAG = "WriteCurrentRefService";
38 |
39 | public WriteCurrentReferenceService()
40 | {
41 | super("WriteCurrentReferenceService");
42 | }
43 |
44 | @Override
45 | public void onHandleIntent(Intent intent)
46 | {
47 | Log.i(TAG, "Called at " + DateUtils.now());
48 | try
49 | {
50 | Wakelock.aquireWakelock(this);
51 | // Store the "custom
52 | StatsProvider.getInstance().setCurrentReference(0);
53 | // Build the intent to update the widget
54 | Intent intentRefreshWidgets = new Intent(AppWidget.WIDGET_UPDATE);
55 | this.sendBroadcast(intentRefreshWidgets);
56 |
57 | Intent i = new Intent(ReferenceStore.REF_UPDATED).putExtra(Reference.EXTRA_REF_NAME, Reference.CURRENT_REF_FILENAME);
58 | i.setPackage(SysUtils.getPackageName(this));
59 | this.sendBroadcast(i);
60 |
61 | }
62 | catch (Exception e)
63 | {
64 | Log.e(TAG, "An error occurred: " + e.getMessage());
65 | }
66 | finally
67 | {
68 | Wakelock.releaseWakelock();
69 | }
70 | }
71 |
72 | @Override
73 | public IBinder onBind(Intent intent)
74 | {
75 | return null;
76 | }
77 |
78 | @Override
79 | public void onDestroy()
80 | {
81 | Log.i(TAG, "Destroyed at " + DateUtils.now());
82 | Wakelock.releaseWakelock();
83 | }
84 |
85 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/services/WriteCustomReferenceService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-14 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats.services;
17 |
18 | import android.app.IntentService;
19 | import android.content.Intent;
20 | import android.os.IBinder;
21 | import android.util.Log;
22 |
23 | import com.asksven.android.common.utils.DateUtils;
24 | import com.asksven.android.common.utils.SysUtils;
25 | import com.asksven.betterbatterystats.Wakelock;
26 | import com.asksven.betterbatterystats.data.Reference;
27 | import com.asksven.betterbatterystats.data.ReferenceStore;
28 | import com.asksven.betterbatterystats.data.StatsProvider;
29 | import com.asksven.betterbatterystats.widgetproviders.AppWidget;
30 |
31 | /**
32 | * @author sven
33 | *
34 | */
35 | public class WriteCustomReferenceService extends IntentService
36 | {
37 | private static final String TAG = "WriteCustomRefService";
38 |
39 | public WriteCustomReferenceService()
40 | {
41 | super("WriteCustomReferenceService");
42 | }
43 |
44 | @Override
45 | public void onHandleIntent(Intent intent)
46 | {
47 | Log.i(TAG, "Called at " + DateUtils.now());
48 | try
49 | {
50 | Wakelock.aquireWakelock(this);
51 | // Store the "custom
52 | StatsProvider.getInstance().setCustomReference(0);
53 | Intent i = new Intent(ReferenceStore.REF_UPDATED).putExtra(Reference.EXTRA_REF_NAME, Reference.CUSTOM_REF_FILENAME);
54 | i.setPackage(SysUtils.getPackageName(this));
55 | this.sendBroadcast(i);
56 |
57 | // StatsProvider.getInstance(this).setCurrentReference(0);
58 | // i = new Intent(ReferenceStore.REF_UPDATED).putExtra(Reference.EXTRA_REF_NAME, Reference.CURRENT_REF_FILENAME);
59 | // this.sendBroadcast(i);
60 |
61 | // Build the intent to update the widget
62 | Intent intentRefreshWidgets = new Intent(AppWidget.WIDGET_UPDATE);
63 | this.sendBroadcast(intentRefreshWidgets);
64 |
65 |
66 | }
67 | catch (Exception e)
68 | {
69 | Log.e(TAG, "An error occured: " + e.getMessage());
70 | }
71 | finally
72 | {
73 | Wakelock.releaseWakelock();
74 | }
75 | }
76 |
77 | @Override
78 | public IBinder onBind(Intent intent)
79 | {
80 | return null;
81 | }
82 |
83 | @Override
84 | public void onDestroy()
85 | {
86 | Log.i(TAG, "Destroyed at" + DateUtils.now());
87 | Wakelock.releaseWakelock();
88 | }
89 |
90 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/asksven/betterbatterystats/services/WriteTimerReferenceService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-14 asksven
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.asksven.betterbatterystats.services;
17 |
18 | import android.app.IntentService;
19 | import android.content.Intent;
20 | import android.os.IBinder;
21 | import android.util.Log;
22 |
23 | import com.asksven.android.common.utils.DateUtils;
24 | import com.asksven.android.common.utils.SysUtils;
25 | import com.asksven.betterbatterystats.Wakelock;
26 | import com.asksven.betterbatterystats.data.Reference;
27 | import com.asksven.betterbatterystats.data.ReferenceStore;
28 | import com.asksven.betterbatterystats.data.StatsProvider;
29 |
30 | /**
31 | * @author sven
32 | *
33 | */
34 | public class WriteTimerReferenceService extends IntentService
35 | {
36 | private static final String TAG = "WriteTimerRefService";
37 |
38 | public WriteTimerReferenceService()
39 | {
40 | super("WriteTimerReferenceService");
41 | }
42 |
43 | @Override
44 | public void onHandleIntent(Intent intent)
45 | {
46 | Log.i(TAG, "Called at " + DateUtils.now());
47 | try
48 | {
49 | Wakelock.aquireWakelock(this);
50 | // Store the "custom
51 | String refName = StatsProvider.getInstance().setTimedReference(0);
52 |
53 | Intent i = new Intent(ReferenceStore.REF_UPDATED).putExtra(Reference.EXTRA_REF_NAME, refName);
54 | i.setPackage(SysUtils.getPackageName(this));
55 | this.sendBroadcast(i);
56 |
57 | }
58 | catch (Exception e)
59 | {
60 | Log.e(TAG, "An error occured: " + e.getMessage());
61 | }
62 | finally
63 | {
64 | Wakelock.releaseWakelock();
65 | }
66 | }
67 |
68 | @Override
69 | public IBinder onBind(Intent intent)
70 | {
71 | return null;
72 | }
73 |
74 | @Override
75 | public void onDestroy()
76 | {
77 | Log.e(TAG, "Destroyed at" + DateUtils.now());
78 | Wakelock.releaseWakelock();
79 | }
80 |
81 | }
--------------------------------------------------------------------------------
/app/src/main/play/release-notes/en-US/beta.txt:
--------------------------------------------------------------------------------
1 | Screen on/off references are always saved
2 | Some UI tweaks
3 | Removed obstrusive release notes
4 | New event management for SDK26
5 | Moved reference processing to a foreground service
6 | Flattened preferences
7 | Updated widget layout and options
8 | App now asks the user to confirm permissions
9 | Reduce the number of permissions that need to be granted through adb
10 | Fixed Samsung Galaxy S10 issue
11 | Fixed misc bugs reported
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi-v11/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi-v11/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_overflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_action_overflow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_action_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_action_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_info_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_info_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_info_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_info_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_info_outline_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_info_outline_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_refresh_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_refresh_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_refresh_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_refresh_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_refresh_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_refresh_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_settings_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_settings_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_settings_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_settings_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_settings_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_settings_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_share_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_share_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_share_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_share_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_share_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_share_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-hdpi/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi-v11/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi-v11/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_overflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_action_overflow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_action_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_action_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_info_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_info_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_info_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_info_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_info_outline_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_info_outline_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_refresh_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_refresh_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_refresh_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_refresh_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_refresh_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_refresh_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_settings_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_settings_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_settings_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_settings_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_settings_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_settings_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_share_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_share_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_share_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_share_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_share_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_share_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-mdpi/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi-v11/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi-v11/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_overflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_action_overflow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_action_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_action_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_info_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_info_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_info_outline_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_info_outline_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_refresh_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_refresh_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_refresh_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_refresh_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_refresh_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_refresh_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_settings_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_settings_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_settings_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_settings_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_settings_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_settings_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_share_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_share_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_share_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_share_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_share_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_share_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xhdpi/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi-v11/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi-v11/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_overflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_action_overflow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_action_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_action_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_info_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_info_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_info_outline_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_info_outline_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_refresh_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_refresh_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_refresh_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_refresh_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_refresh_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_refresh_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_settings_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_settings_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_settings_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_settings_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_settings_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_settings_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_share_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_share_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_share_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_share_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_share_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_share_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_notext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxhdpi/icon_notext.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi-v11/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi-v11/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_dashclock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_dashclock.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_info_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_info_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_info_outline_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_info_outline_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_refresh_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_refresh_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_refresh_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_refresh_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_refresh_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_refresh_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_settings_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_settings_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_settings_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_settings_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_settings_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_settings_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_share_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_share_black_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_share_grey600_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_share_grey600_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_share_white_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_share_white_48dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_stat_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/ic_stat_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/icon_notext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable-xxxhdpi/icon_notext.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/card_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/clickable.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_sync_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_kb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable/icon_kb.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_transparent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable/icon_transparent.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/widget_frame.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/drawable/widget_frame.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/widget_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_diagnosticsapp.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
18 |
19 |
20 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/bbs_spinner_dropdown_item.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/bbs_spinner_layout.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/changelog.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/changelog_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/credits.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/credits_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
23 |
24 |
34 |
35 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/details_dialog.xml:
--------------------------------------------------------------------------------
1 |
5 |
14 |
15 |
16 |
24 |
31 |
32 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_rate.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
20 |
21 |
27 |
28 |
34 |
35 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/graph_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
24 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/graphs.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
21 |
22 |
33 |
34 |
39 |
40 |
41 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/helpwebview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/import_export_prefs.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
17 |
18 |
25 |
33 |
34 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/locale_plugin_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
19 |
20 |
25 |
31 |
32 |
37 |
43 |
44 |
45 |
50 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/package_info.xml:
--------------------------------------------------------------------------------
1 |
16 |
22 |
23 |
27 |
28 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/package_info_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
17 |
18 |
26 |
27 |
33 |
34 |
43 |
44 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/package_info_tabs.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/packageinfo.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
20 |
21 |
29 |
30 |
31 |
40 |
41 |
48 |
49 |
50 |
59 |
60 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
15 |
16 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/preferences_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/raw_stats.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
21 |
22 |
28 |
29 |
37 |
38 |
46 |
47 |
48 |
49 |
56 |
57 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/seek_bar_preference.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
18 |
19 |
20 |
26 |
27 |
28 |
33 |
34 |
35 |
42 |
43 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/text_widget_horz.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
27 |
28 |
29 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/toolbar_icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/widget.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
21 |
22 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/widget_horz.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
24 |
25 |
33 |
34 |
35 |
36 |
37 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/widget_vert.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
22 |
23 |
29 |
30 |
37 |
38 |
39 |
40 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/alarms_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/kernelwakelocks_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/locale_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/mainmenu.xml:
--------------------------------------------------------------------------------
1 |
2 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/permissions_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/serie_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/app/src/main/res/mipmap-xxxhdpi/ic_notification.png
--------------------------------------------------------------------------------
/app/src/main/res/values-small/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10dp
4 | 48dp
5 |
6 |
7 | 200dp
8 | 16dp
9 | 12sp
10 | 32dp
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values-sw600dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 288dp
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 300dp
6 | 144dp
7 | 18sp
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 480dp
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-sw720dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 192dp
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v14/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8dp
5 |
6 | 10dp
7 | 48dp
8 | 100dp
9 | 32dp
10 | 20sp
11 | 16sp
12 | 13sp
13 |
14 |
15 | 200dp
16 | 16dp
17 | 18sp
18 | 32dp
19 |
20 |
21 | 14dp
22 |
23 |
24 | 6dp
25 | 6dp
26 |
27 |
28 | 8dp
29 | 2dp
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/values/theme.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/changelog_master.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Initial prep for Andrid 14. Will not work yet!!!
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref_dashboard.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/provider_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/text_widget_provider.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/widget_provider.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/app/src/test/java/com/asksven/betterbatterystats/data/DatapointTest.java:
--------------------------------------------------------------------------------
1 | package com.asksven.betterbatterystats.data;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertTrue;
6 |
7 | /**
8 | * Created by android on 12/26/16.
9 | */
10 | public class DatapointTest
11 | {
12 | @Test
13 | public void toStringReturnsValue() throws Exception
14 | {
15 | Datapoint p1 = new Datapoint();
16 | Datapoint p2 = new Datapoint(12, 45);
17 |
18 | String s1 = p1.toString();
19 | String s2 = p2.toString();
20 |
21 | assertTrue(p1.mX == 0);
22 | assertTrue(p1.mY == 0);
23 |
24 | assertTrue(s1.equals("X=" + p1.mX + ", Y=" + p1.mY));
25 | assertTrue(s2.equals("X=" + p2.mX + ", Y=" + p2.mY));
26 |
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/app/src/test/java/com/asksven/betterbatterystats/data/GraphSerieTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | package com.asksven.betterbatterystats.data;
3 |
4 | import android.util.Log;
5 |
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.powermock.api.mockito.PowerMockito;
9 | import org.powermock.core.classloader.annotations.PrepareForTest;
10 | import org.powermock.modules.junit4.PowerMockRunner;
11 |
12 | import java.util.ArrayList;
13 |
14 | import static org.junit.Assert.assertFalse;
15 | import static org.junit.Assert.assertTrue;
16 |
17 | */
18 | /**
19 | * Created by android on 12/26/16.
20 | *//*
21 |
22 | @RunWith(PowerMockRunner.class)
23 | @PrepareForTest(Log.class)
24 | public class GraphSerieTest
25 | {
26 | @Test
27 | public void testGraphSerie() throws Exception
28 | {
29 | PowerMockito.mockStatic(Log.class);
30 |
31 | ArrayList nullSerie = null;
32 | ArrayList emptySerie = new ArrayList();
33 | ArrayList serie = new ArrayList();
34 |
35 | // populate serie
36 | for (int i = 0; i < 1000; i++)
37 | {
38 | serie.add(new Datapoint(i, 1000 - i));
39 | }
40 |
41 | GraphSerie gs1 = new GraphSerie("gs1", nullSerie);
42 | GraphSerie gs2 = new GraphSerie("gs2", emptySerie);
43 | GraphSerie gs3 = new GraphSerie("gs3", serie);
44 |
45 | assertTrue(gs1.size() == 0);
46 | assertTrue(gs2.size() == 0);
47 | assertTrue(gs3.size() > 0);
48 |
49 | assertTrue(gs1.getTitle().equals("gs1"));
50 | assertTrue(gs2.getTitle().equals("gs2"));
51 | assertTrue(gs3.getTitle().equals("gs3"));
52 |
53 | assertFalse(gs1.getValues() == nullSerie); // we expect the GraphSerie to have detected and replaced the empty array
54 | assertTrue(gs2.getValues() == emptySerie);
55 | assertTrue(gs3.getValues() == serie);
56 | }
57 |
58 |
59 | }*/
60 |
--------------------------------------------------------------------------------
/app/src/test/java/com/asksven/betterbatterystats/data/ReferenceDtoTest.java:
--------------------------------------------------------------------------------
1 | package com.asksven.betterbatterystats.data;
2 |
3 | import com.asksven.android.common.dto.MiscDto;
4 |
5 | import org.junit.Test;
6 |
7 | import java.util.ArrayList;
8 |
9 | import static org.junit.Assert.assertTrue;
10 |
11 | /**
12 | * Created on 12/26/16.
13 | */
14 | public class ReferenceDtoTest
15 | {
16 | @Test
17 | public void test_marshall_empty() throws Exception
18 | {
19 | ReferenceDto dto = new ReferenceDto();
20 |
21 | byte[] dtoBytes = dto.marshall();
22 | assertTrue(dtoBytes.length > 0);
23 | }
24 |
25 | @Test
26 | public void test_unmarshall_empty() throws Exception
27 | {
28 | ReferenceDto dto = new ReferenceDto();
29 |
30 | byte[] dtoBytes = dto.marshall();
31 | assertTrue(dtoBytes.length > 0);
32 |
33 | ReferenceDto dto2 = ReferenceDto.unmarshall(dtoBytes);
34 | assertTrue(dto2 != null);
35 | assertTrue(dto2.m_fileName.equals(dto.m_fileName));
36 | }
37 |
38 | @Test
39 | public void test_marshall_populated() throws Exception
40 | {
41 | ReferenceDto dto = new ReferenceDto();
42 | dto.m_fileName = "filename";
43 |
44 | ArrayList misc = new ArrayList();
45 | MiscDto entry = new MiscDto();
46 | entry.m_name = "name";
47 | entry.m_timeOn = 10000;
48 | entry.m_timeRunning = 100000;
49 | entry.m_total = 2000000;
50 | entry.m_uid = 12;
51 |
52 | misc.add(entry);
53 |
54 | dto.m_refOther = misc;
55 |
56 | byte[] dtoBytes = dto.marshall();
57 | assertTrue(dtoBytes.length > 0);
58 |
59 | ReferenceDto dto2 = ReferenceDto.unmarshall(dtoBytes);
60 | assertTrue(dto2.m_fileName.equals(dto.m_fileName));
61 | assertTrue(dto2.m_refOther.size() > 0);
62 |
63 | ArrayList misc2 = dto2.m_refOther;
64 | MiscDto entry2 = misc2.get(misc2.size() - 1);
65 | assertTrue(entry2.m_name.equals(entry.m_name));
66 | assertTrue(entry2.m_timeOn == entry.m_timeOn);
67 | assertTrue(entry2.m_timeRunning == entry.m_timeRunning);
68 | assertTrue(entry2.m_total == entry.m_total);
69 | assertTrue(entry2.m_uid == entry.m_uid);
70 |
71 |
72 | }
73 |
74 | }
--------------------------------------------------------------------------------
/asksven.keystore-cipher:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/asksven.keystore-cipher
--------------------------------------------------------------------------------
/asksven_debug.keystore-cipher:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/asksven_debug.keystore-cipher
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | // jcenter()
6 | mavenCentral()
7 | google()
8 | maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:7.2.2'
12 | classpath 'com.github.triplet.gradle:play-publisher:3.7.0' //2.0.0-SNAPSHOT'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
14 | classpath "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1"
15 |
16 | // classpath 'com.google.gms:google-services:3.0.0'
17 |
18 | // NOTE: Do not place your application dependencies here; they belong
19 | // in the individual module build.gradle files
20 | }
21 | }
22 |
23 | allprojects {
24 | repositories {
25 | mavenCentral()
26 | // jcenter()
27 | google()
28 | }
29 | }
30 |
31 | task clean(type: Delete) {
32 | delete rootProject.buildDir
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/circleciscripts/decrypt-tokens.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | openssl enc -in ./app/google-services.json-cipher -out ./app/google-services.json -d -aes256 -k $KEY
4 |
5 |
--------------------------------------------------------------------------------
/circleciscripts/decrypt_env_vars.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # decrypt the file that was create with
4 | # openssl aes-256-cbc -e -in secret-env-plain -out secret-env-cipher -k $KEY
5 |
6 | echo "Decrypting"
7 | openssl enc -in secret-env-cipher -out secret-env-plain -d -aes256 -k $KEY
8 | ls -l secret-*
9 |
--------------------------------------------------------------------------------
/circleciscripts/deployAppCenter.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function uploadToAppCenter {
4 | echo "Upload to appcenter"
5 | APPCENTER_APK=`find ./app/build/outputs/apk -name betterbatterystats_xdaedition_debug_*.apk`
6 | echo "APK: ${APPCENTER_APK}"
7 |
8 | GIT_COMPARE_KEY=${CIRCLE_COMPARE_URL##*/}
9 | GIT_PRETTY_COMMIT_LOG=$(echo "$(git log ${GIT_COMPARE_KEY} --pretty=format:'- [%ad] %s (%an)
' --date=short)
" | tr -d '\n')
10 |
11 | RELEASENOTES_HEADER="**Built on:** $(date +"%a %d-%b-%Y %I:%M %p")
12 | **Branch:** $(git rev-parse --abbrev-ref HEAD)
13 | **Commit:** $(git rev-parse --short HEAD)"
14 |
15 | RELEASENOTES_HEADER_HTML=${HOCKEYAPP_NOTES_HEADER//$'\n'/
}
16 | RELEASENOTES="${HOCKEYAPP_NOTES_HEADER_HTML} ${GIT_PRETTY_COMMIT_LOG}"
17 |
18 | npm install --prefix=$HOME/.local --global appcenter-cli
19 | # appcenter login --disable-telemetry --token ${APPCENTER_TOKEN}
20 | appcenter distribute release \
21 | --disable-telemetry \
22 | --app ${APPCENTER_APP} \
23 | --file ${APPCENTER_APK} \
24 | --group "${APPCENTER_GROUP}" \
25 | --release-notes "${RELEASENOTES}" \
26 | --token ${APPCENTER_TOKEN}
27 | }
--------------------------------------------------------------------------------
/circleciscripts/download_keystore.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ -e ${KEYSTORE_RELEASE}-cipher ]; then openssl enc -in ${KEYSTORE_RELEASE}-cipher -out ./app/$KEYSTORE_RELEASE -d -aes256 -k $KEY; fi
4 | if [ -e ${KEYSTORE_DEBUG}-cipher ]; then openssl enc -in ${KEYSTORE_DEBUG}-cipher -out ./app/$KEYSTORE_DEBUG -d -aes256 -k $KEY; fi
5 |
6 | ls -la ${KEYSTORE_RELEASE}*
7 | ls -la ${KEYSTORE_DEBUG}*
8 | ls -la ./app/${KEYSTORE_RELEASE}*
9 | ls -la ./app/${KEYSTORE_DEBUG}*
10 |
11 |
12 |
--------------------------------------------------------------------------------
/circleciscripts/download_pubprofile.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # we don't download as the cipher-file is in the repo
3 | # curl -O ${KEYSTORE_URI}/sa-google-play.json-cipher
4 |
5 | if [ -e ./app/sa-google-play.json-cipher ]; then openssl enc -in ./app/sa-google-play.json-cipher -out ./app/sa-google-play.json -k $KEY; fi
6 |
7 |
--------------------------------------------------------------------------------
/circleciscripts/renameapks.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | for filename in $(find $HOME/BetterBatteryStats/app/build/outputs/apk -name "*.apk"); do rename -v 's/(.*)\.apk/$1-$ENV{"CIRCLE_BUILD_NUM"}.apk/' $filename; done;
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | android.enableJetifier=true
13 | android.useAndroidX=true
14 | org.gradle.jvmargs=-Xmx1536m
15 | #org.gradle.java.home=/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home
16 |
17 | # When configured, Gradle will run in incubating parallel mode.
18 | # This option should only be used with decoupled projects. More details, visit
19 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
20 | # org.gradle.parallel=true
21 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jun 11 23:34:59 CEST 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/secret-env-cipher:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asksven/BetterBatteryStats/ccb0904791ab20e35a187dbd2a4cf53643dcba19/secret-env-cipher
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------