Skip to content

Commit

Permalink
Fix issue with Amazon Fire Phone
Browse files Browse the repository at this point in the history
  • Loading branch information
dbergloev committed Dec 21, 2015
1 parent d73963b commit 1cd52af
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,17 @@ protected IMediatorSetup(ReflectClass pwm, XServiceManager xServiceManager) {
* Get the Power Management tools
*/
mPowerManager = ReflectClass.fromReceiver(((Context) mContext.getReceiver()).getSystemService(Context.POWER_SERVICE));
mPowerManagerService = (ReflectClass) mPowerManager.findField("mService").getValue(Result.INSTANCE);

try {
mPowerManagerService = (ReflectClass) mPowerManager.findField("mService").getValue(Result.INSTANCE);

} catch (ReflectException e) {
/*
* This is a work-around for devices that is heavily modified, like Amazon Fire Phone where the above field for some reason returns NULL
*/
mPowerManagerService = ReflectClass.fromName("android.os.IPowerManager").bindInterface("power");
}

mWakelock = ((PowerManager) mPowerManager.getReceiver()).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "HookedPhoneWindowManager");

/*
Expand Down

0 comments on commit 1cd52af

Please sign in to comment.