Skip to content

Commit

Permalink
CHANGELOG: Added Hide Lock icon in Lockscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed May 1, 2024
1 parent 378ee35 commit f2ed148
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public class Lockscreen extends XposedMods {
private boolean removeSOS;
private boolean hideFingerprint = false, customFingerprint = false;
private int fingerprintStyle = 0;
private Object mFpIcon;
private float mFpScale = 1.0f;
private Drawable mFpDrawable = null;
private boolean removeLeftAffordance = false, removeRightAffordance = false;
Expand All @@ -77,7 +76,6 @@ public class Lockscreen extends XposedMods {
private ImageView mLockIcon = null;
private boolean hideLockscreenCarrier = false, hideLockscreenStatusbar = false, hideLockscreenCapsule = false;
private String lockscreenCarrierReplacement = "";
private static Object carrierTextController;

public Lockscreen(Context context) {
super(context);
Expand Down Expand Up @@ -112,6 +110,9 @@ public void updatePrefs(String... Key) {
) {
hideLockscreenStuff();
}
if (Key[0].equals(LOCKSCREEN_REMOVE_LOCK)) {
if (mLockIcon != null) mLockIcon.setVisibility(removeLockIcon ? View.GONE : View.VISIBLE);
}
}

}
Expand Down Expand Up @@ -150,7 +151,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
try {
OnScreenFingerprint = findClass("com.oplus.systemui.biometrics.finger.udfps.OnScreenFingerprintUiMach", lpparam.classLoader);
} catch (Throwable t) {
OnScreenFingerprint = findClass("com.oplus.systemui.keyguard.finger.onscreenfingerprint.OnScreenFingerprintUiMech", lpparam.classLoader);
OnScreenFingerprint = findClass("com.oplus.systemui.keyguard.finger.onscreenfingerprint.OnScreenFingerprintUiMech", lpparam.classLoader); // OOS 13
}
hookAllMethods(OnScreenFingerprint, "initFpIconWin", new XC_MethodHook() {
@Override
Expand All @@ -173,11 +174,11 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
hookAllMethods(OnScreenFingerprint, "startFadeInAnimation", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (hideFingerprint || customFingerprint) updateFingerprintIcon(param, true);
if (hideFingerprint || customFingerprint) updateFingerprintIcon(param, false);
}
});
} catch (Throwable t) {
log(TAG + "startFadeInAnimation not found");
log(TAG + "loadAnimDrawables not found");
}

try {
Expand All @@ -193,17 +194,6 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
log(TAG + "updateFpIconColor not found");
}

try {
hookAllMethods(OnScreenFingerprint, "startFadeOutAnimation", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (hideFingerprint || customFingerprint) updateFingerprintIcon(param, true);
}
});
} catch (Throwable t) {
log(TAG + "startFadeOutAnimation not found");
}

// Affordance Section
hookAffordance(lpparam);

Expand All @@ -216,7 +206,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}

private void updateFingerprintIcon(XC_MethodHook.MethodHookParam param, boolean isStartMethod) {
if (mFpIcon == null) mFpIcon = getObjectField(param.thisObject, "mFpIcon");
Object mFpIcon = getObjectField(param.thisObject, "mFpIcon");

if (BuildConfig.DEBUG) log(TAG + "updateFingerprintIcon");

Expand All @@ -228,7 +218,7 @@ private void updateFingerprintIcon(XC_MethodHook.MethodHookParam param, boolean
if (mFpIcon != null) {
callMethod(mFpIcon, "setImageDrawable", mFpDrawable == null ? null : mFpDrawable);
}
if (hideFingerprint && isStartMethod) {
if (isStartMethod) {
param.setResult(null);
}
//if (!isStartMethod) callMethod(param.thisObject, "updateFpIconColor");
Expand Down Expand Up @@ -319,7 +309,20 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}

private void hookLockIcon(XC_LoadPackage.LoadPackageParam lpparam) {

try {
Class<?> LockIconView = findClass("com.android.keyguard.LockIconView", lpparam.classLoader);
hookAllMethods(LockIconView, "onFinishInflate", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
mLockIcon = (ImageView) getObjectField(param.thisObject, "mLockIcon");
if (removeLockIcon) {
mLockIcon.setVisibility(View.GONE);
}
}
});
} catch (Throwable t) {
log(TAG + "LockIconViewController not found");
}
}

private void hookCarrier(XC_LoadPackage.LoadPackageParam lpparam) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/xml/lockscreen_prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@
android:title="@string/misc"
app:iconSpaceReserved="false">

<!-- <SwitchPreferenceCompat
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="lockscreen_hide_lock_icon"
android:title="@string/lockscreen_hide_lock_icon"
android:summaryOn="@string/general_on"
android:summaryOff="@string/general_off"
app:iconSpaceReserved="false" /> -->
app:iconSpaceReserved="false" />

<SwitchPreferenceCompat
android:defaultValue="false"
Expand Down

0 comments on commit f2ed148

Please sign in to comment.