[Lenovo P2 Themes, Apps, and Mods] Prospero.X-3:
View attachment 5542223

P2oggle​

The Lenovo P2 features a somewhat unusual hardware switch (referred to by Lenovo as the "one-key power saver"). On the stock ROM this switch toggles a battery saving mode but in aftermarket development it has remained unused - until now. P2oggle (pronounced "P-Toggle") is an app which enables this switch and allows you to assign toggleable "actions" to it.

DOWNLOAD(v1.2)

​

Currently, available actions include:

Flashlight

Silent mode

Battery saver

Aeroplane mode

Wi-Fi

Mobile data

Bluetooth

NFC

Location

Silent

Vibrate

Priority only

Alarms only

Total silence

Play/pause

Caffeine

Dictaphone

Actions can be configured separately for when the screen is on or off. If you have suggestions for any you think would be useful, please make them below and I will be happy to add them.

Additionally you can configure P2oggle to broadcast switch events for other apps.

Requirements

Since the Android input stack more or less ignores the existence of hardware switches, P2oggle uses the kernel's input event interface (evdev) directly. It therefore requires a rooted device. You will need a superuser binary that includes supolicy and BusyBox, e.g. Magisk.

The service that listens for switch input consumes minimal resources: in my testing battery usage has never risen above 0% with memory consumption averaging about 25 MB, depending on the actions selected.

P2oggle is compatible with the stock ROM and should work with all custom ROMs and kernels. I wrote it for the P2a42 (global variant) but it should also be fully compatible with the P2c72 (domestic variant). If it works for you please let me know.

If you are on stock you will probably want to disable the power saver mode from being bound to the switch in order to use P2oggle properly. You can do that by running su -c pm hide com.lenovo.powersetting in a terminal emulator or adb shell. Replace hide with unhide to reverse.

P2oggle is released under the Mozilla General Public License version 2.0. As always, please post any feedback/suggestions/bug reports below, or open an issue on GitHub if you prefer.

Changelog

Latest version - 1.2

Changes in this release:

Bug fixes

Fixes a crash when the service tries to start on an unrooted device

Older versions

1.1

Changes in this release:

Enhancements

New app icon

New overlay icons for Flashlight

Service notification is now hidden on lock screen by default

Optimisations

Updated SDK version to 29

Write external storage is no longer requested on Android 10 and up

Bug fixes

Fixed Dictaphone on Android 11 and up

1.0

Changes in this release:

Enhancements

Added much-requested Dictaphone action

Optimisations

Removed unnecessary library dependency

Many code cleanups and linter warnings fixed

Bug fixes

Fixed service unresponsive to configuration changes until restarted

Fixed Caffeine not working on all ROMs

Fixed overlay delay on Android 10+

Fixed horrible hangs when su access denied

Fixed su sometimes not being detected until app restart

0.4

Changes in this release:

New action: Caffeine

Fixed a crash on unrooted devices

0.3

Changes in this release:

App should now be compatible with Android 10

Minimised number of su processes to reduce toast notification spam from Magisk and lag on enabling service

0.2

New in this release:

New actions: Vibrate, Silent, Play/pause, Location, Priority only, Alarms only

New option: Emit broadcasts for other apps - this lets you extend P2oggle with apps such as Tasker

Overlay theming options added

Action Silent mode renamed to Total silence to better represent its function

Better error messages on initial setup

Bug fixes in this release:

Overlay should now be completely reliable

Disabling Start on boot now actually works

Service now immediately unbinds from switch when disabled

Disabled Notification settings and Hide intents on N, where using these options would prevent the overlay from working

Fixed superuser access not being detected until app restart

0.1

Initial release

[/B]

XDA:DevDB Information

P2oggle, Device Specific App for the Lenovo P2

Contributors

Prospero.X-3

Source Code: https://github.com/biqqles/p2oggle

Version Information

Status: Stable

Current Stable Version: 1.2

Created 2019-09-06

Last Updated 2022-02-20