forked from BaronKiko/LauncherHijack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
58 additions
and
29 deletions.
There are no files selected for viewing
Binary file not shown.
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
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/parrotgeek/launcherhijack/AccServ.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,47 @@ | ||
package com.parrotgeek.launcherhijack; | ||
|
||
import android.accessibilityservice.AccessibilityService; | ||
import android.accessibilityservice.AccessibilityServiceInfo; | ||
import android.content.Intent; | ||
import android.util.Log; | ||
import android.view.accessibility.AccessibilityEvent; | ||
|
||
public class AccServ extends AccessibilityService { | ||
|
||
static final String TAG = "AccServ"; | ||
|
||
Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME).setPackage("com.teslacoilsw.launcher").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS|Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | ||
|
||
@Override | ||
public void onAccessibilityEvent(AccessibilityEvent event) { | ||
if(event.getPackageName().equals("com.amazon.firelauncher")) { | ||
performGlobalAction(AccessibilityService.GLOBAL_ACTION_RECENTS); | ||
try { | ||
Thread.sleep(200); | ||
} catch (InterruptedException e) { | ||
Log.wtf(TAG,e); | ||
} | ||
performGlobalAction(AccessibilityService.GLOBAL_ACTION_RECENTS); | ||
startActivity(intent); | ||
|
||
} | ||
} | ||
|
||
@Override | ||
public void onInterrupt() { | ||
Log.v(TAG, "onInterrupt"); | ||
} | ||
|
||
@Override | ||
protected void onServiceConnected() { | ||
super.onServiceConnected(); | ||
Log.v(TAG, "onServiceConnected"); | ||
AccessibilityServiceInfo info = new AccessibilityServiceInfo(); | ||
info.flags = AccessibilityServiceInfo.DEFAULT; | ||
info.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED; | ||
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC; | ||
info.packageNames = new String[]{"com.amazon.firelauncher"}; | ||
setServiceInfo(info); | ||
} | ||
|
||
} |
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