|
|
@ -24,27 +24,30 @@ public final class SystemHelper extends AndroidJUnitRunner
|
|
|
|
|
|
|
|
|
|
|
|
void unlockScreen()
|
|
|
|
void unlockScreen()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.i("SystemHelper", "Trying to unlock screen");
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KeyguardManager mKeyGuardManager = (KeyguardManager) context
|
|
|
|
KeyguardManager mKeyGuardManager = (KeyguardManager) context
|
|
|
|
.getSystemService(Context.KEYGUARD_SERVICE);
|
|
|
|
.getSystemService(Context.KEYGUARD_SERVICE);
|
|
|
|
KeyguardManager.KeyguardLock mLock = mKeyGuardManager.newKeyguardLock("lock");
|
|
|
|
KeyguardManager.KeyguardLock mLock = mKeyGuardManager.newKeyguardLock("lock");
|
|
|
|
mLock.disableKeyguard();
|
|
|
|
mLock.disableKeyguard();
|
|
|
|
|
|
|
|
Log.e("SystemHelper", "Successfully unlocked screen");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.e("SystemHelper", "Could not unlock screen");
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void disableAllAnimations()
|
|
|
|
void disableAllAnimations()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.i("SystemAnimations", "Trying to disable animations");
|
|
|
|
Log.i("SystemHelper", "Trying to disable animations");
|
|
|
|
int permStatus = context.checkCallingOrSelfPermission(ANIMATION_PERMISSION);
|
|
|
|
int permStatus = context.checkCallingOrSelfPermission(ANIMATION_PERMISSION);
|
|
|
|
if (permStatus == PackageManager.PERMISSION_GRANTED)
|
|
|
|
if (permStatus == PackageManager.PERMISSION_GRANTED)
|
|
|
|
setSystemAnimationsScale(DISABLED);
|
|
|
|
setSystemAnimationsScale(DISABLED);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Log.e("SystemAnimations", "Permission denied");
|
|
|
|
Log.e("SystemHelper", "Permission denied");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -78,11 +81,11 @@ public final class SystemHelper extends AndroidJUnitRunner
|
|
|
|
currentScales[i] = animationScale;
|
|
|
|
currentScales[i] = animationScale;
|
|
|
|
|
|
|
|
|
|
|
|
setAnimationScales.invoke(windowManagerObj, new Object[]{currentScales});
|
|
|
|
setAnimationScales.invoke(windowManagerObj, new Object[]{currentScales});
|
|
|
|
Log.i("SystemAnimations", "All animations successfully disabled");
|
|
|
|
Log.i("SystemHelper", "All animations successfully disabled");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.e("SystemAnimations",
|
|
|
|
Log.e("SystemHelper",
|
|
|
|
"Could not change animation scale to " + animationScale + " :'(");
|
|
|
|
"Could not change animation scale to " + animationScale + " :'(");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|