Setup wizard page for Samsung's power manager

https://gitlab.com/axet/android-library/blob/master/src/main/java/com/github/axet/androidlibrary/widgets/OptimizationPreferenceCompat.java

https://stackoverflow.com/questions/37205106/how-do-i-avoid-that-my-app-enters-optimization-on-samsung-devices

https://stackoverflow.com/questions/34074955/android-exact-alarm-is-always-3-minutes-off/34085645#34085645

Looks like the situation is similar to Huawei - we create an intent for the power manager's whitelisting activity, and if the intent is callable, we're on an affected device. I haven't looked into whether we can detect whether we're already whitelisted.

Apparently the intent's package and class name should be:

  • "com.samsung.android.sm", "com.samsung.android.sm.ui.battery.BatteryActivity" on Android L
  • "com.samsung.android.lool", "com.samsung.android.sm.ui.battery.BatteryActivity" on Android N

According to one of the StackOverflow answers, keywords like "alert" and "clock" in the package name will cause the app to be automatically whitelisted. Good grief...