-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pushing the Power button will stop FakeStandby now
- Loading branch information
1 parent
bc7b391
commit 081df2d
Showing
5 changed files
with
127 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/src/main/java/android/jonas/fakestandby/service/PhoneLockReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package android.jonas.fakestandby.service; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.jonas.fakestandby.utils.Constants; | ||
import android.jonas.fakestandby.utils.Utils; | ||
import android.os.PowerManager; | ||
import android.util.Log; | ||
|
||
public class PhoneLockReceiver extends BroadcastReceiver { | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
if (Utils.isOverlayShowing(context)) { | ||
Intent new_intent = new Intent(context, AccessibilityOverlayService.class); | ||
new_intent.putExtra(Constants.Intent.Extra.OverlayAction.KEY, Constants.Intent.Extra.OverlayAction.HIDE_IMMEDIATELY); | ||
context.startService(new_intent); | ||
|
||
Log.i(getClass().getName(), "Sent intent to hide overlay"); | ||
|
||
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); | ||
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "fakestandby:overlaystopped"); | ||
wakeLock.acquire(); | ||
wakeLock.release(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters