Revert "[1/2] SystemUI: Add custom fingerprint icon support"
This reverts commit f07b84e24f67281c7b904131c20c3b893fc1921f.
Not working and UdfpsKeyguardViewLegacy.java is now more used / removed in A15 QPR2
Change-Id: I875e676ad56d84337ed24719d9e0af1c3db7b86f
Signed-off-by: micky387 <mickaelsaibi@free.fr>
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 2217b5b..fed1ef5 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -1155,12 +1155,5 @@
<!-- omni additions start -->
<service android:name=".omni.CPUInfoService"
android:exported="false" />
-
- <service android:name=".omni.OmniSystemUIService"
- android:exported="true">
- <intent-filter>
- <action android:name="android.intent.action.OMNI_SYSTEMUI_SERVICE"/>
- </intent-filter>
- </service>
</application>
</manifest>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/omni/IOmniSystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/omni/IOmniSystemUiProxy.aidl
deleted file mode 100644
index 812defd..0000000
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/omni/IOmniSystemUiProxy.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.shared.omni;
-
-import android.graphics.Bitmap;
-
-/**
- * Temporary callbacks into SystemUI.
- */
-interface IOmniSystemUiProxy {
- void setUfpsImageBitmap(in Bitmap imageData) = 1;
- void resetUfpsImage() = 2;
-}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewLegacy.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewLegacy.java
index b470f29..6d4eea8 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewLegacy.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewLegacy.java
@@ -25,16 +25,10 @@
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.RectF;
-import android.net.Uri;
-import android.os.ParcelFileDescriptor;
-import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.MathUtils;
import android.view.View;
@@ -49,18 +43,11 @@
import com.android.app.animation.Interpolators;
import com.android.settingslib.Utils;
import com.android.systemui.res.R;
-import com.android.systemui.Dependency;
-import com.android.systemui.omni.OmniSettingsService;
-import com.android.systemui.omni.OmniSystemUIService;
import com.airbnb.lottie.LottieAnimationView;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.model.KeyPath;
-import org.omnirom.omnilib.utils.OmniSettings;
-
-import java.io.File;
-import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -68,8 +55,7 @@
/**
* View corresponding with udfps_keyguard_view_legacy.xml
*/
-public class UdfpsKeyguardViewLegacy extends UdfpsAnimationView implements
- OmniSettingsService.OmniSettingsObserver {
+public class UdfpsKeyguardViewLegacy extends UdfpsAnimationView {
private UdfpsDrawable mFingerprintDrawable; // placeholder
private LottieAnimationView mAodFp;
private LottieAnimationView mLockScreenFp;
@@ -92,10 +78,6 @@
private boolean mFullyInflated;
private Runnable mOnFinishInflateRunnable;
- //omni-addon
- private boolean mUseUdfpsIcon;
- private BitmapDrawable mCustomImage;
-
public UdfpsKeyguardViewLegacy(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mFingerprintDrawable = new UdfpsFpDrawable(context);
@@ -104,7 +86,6 @@
.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_x);
mMaxBurnInOffsetY = context.getResources()
.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_y);
- mUseUdfpsIcon = getCustomImagePath().exists();
}
/**
@@ -117,8 +98,6 @@
AsyncLayoutInflater inflater = new AsyncLayoutInflater(mContext);
inflater.inflate(R.layout.udfps_keyguard_view_internal, this,
mLayoutInflaterFinishListener);
- Dependency.get(OmniSettingsService.class).addStringObserver(this,
- OmniSettings.OMNI_CUSTOM_FP_ICON_UPDATE);
}
@Override
@@ -169,13 +148,13 @@
mLockScreenFp.setTranslationX(burnInOffsetX);
mLockScreenFp.setTranslationY(burnInOffsetY);
mBgProtection.setAlpha(1f - mInterpolatedDarkAmount);
- mLockScreenFp.setAlpha(mUseUdfpsIcon ? 0.0f : (1f - mInterpolatedDarkAmount));
+ mLockScreenFp.setAlpha(1f - mInterpolatedDarkAmount);
} else if (darkAmountForAnimation == 0f) {
// we're on the lockscreen and should use mAlpha (changes based on shade expansion)
mLockScreenFp.setTranslationX(0);
mLockScreenFp.setTranslationY(0);
mBgProtection.setAlpha(mAlpha / 255f);
- mLockScreenFp.setAlpha(mUseUdfpsIcon ? 0.0f : mAlpha / 255f);
+ mLockScreenFp.setAlpha(mAlpha / 255f);
} else {
mBgProtection.setAlpha(0f);
mLockScreenFp.setAlpha(0f);
@@ -210,7 +189,9 @@
mTextColorPrimary = Utils.getColorAttrDefaultColor(mContext,
com.android.internal.R.attr.materialColorOnSurface);
- setCustomIcon();
+ final int backgroundColor = Utils.getColorAttrDefaultColor(getContext(),
+ com.android.internal.R.attr.materialColorSurfaceContainerHigh);
+ mBgProtection.setImageTintList(ColorStateList.valueOf(backgroundColor));
mLockScreenFp.invalidate(); // updated with a valueCallback
}
@@ -318,43 +299,6 @@
pw.println(" mAnimationType=" + mAnimationType);
}
- private void setCustomIcon(){
- if (mCustomImage != null) {
- mBgProtection.setImageDrawable(mCustomImage);
- } else {
- final int backgroundColor = Utils.getColorAttrDefaultColor(getContext(),
- com.android.internal.R.attr.materialColorSurfaceContainerHigh);
- mBgProtection.setImageTintList(ColorStateList.valueOf(backgroundColor));
- }
- }
-
- @Override
- public void onStringSettingChanged(String key, String customIconURI) {
- if (getCustomImagePath().exists()) {
- loadCustomImage();
- } else {
- mCustomImage = null;
- }
- }
-
- private void loadCustomImage() {
- try {
- ParcelFileDescriptor parcelFileDescriptor =
- getContext().getContentResolver().openFileDescriptor(Uri.fromFile(getCustomImagePath()), "r");
- FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
- Bitmap image = BitmapFactory.decodeFileDescriptor(fileDescriptor);
- parcelFileDescriptor.close();
- mCustomImage = new BitmapDrawable(getResources(), image);
- }
- catch (Exception e) {
- mCustomImage = null;
- }
- }
-
- private File getCustomImagePath() {
- return new File(getContext().getFilesDir(), OmniSystemUIService.UFPSIMAGE_FILE_NAME);
- }
-
private final AsyncLayoutInflater.OnInflateFinishedListener mLayoutInflaterFinishListener =
new AsyncLayoutInflater.OnInflateFinishedListener() {
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/omni/OmniSystemUIService.java b/packages/SystemUI/src/com/android/systemui/omni/OmniSystemUIService.java
deleted file mode 100644
index 42a26cf..0000000
--- a/packages/SystemUI/src/com/android/systemui/omni/OmniSystemUIService.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2022 The OmniROM Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.omni;
-
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.os.IBinder;
-import android.util.Log;
-
-import com.android.systemui.dagger.SysUISingleton;
-import com.android.systemui.shared.omni.IOmniSystemUiProxy;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import javax.inject.Inject;
-
-public class OmniSystemUIService extends Service {
- private final String TAG = "OmniSystemUIService";
- public static String UFPSIMAGE_FILE_NAME = "ufpsImage";
-
- public IOmniSystemUiProxy mOmniSysUiProxy = new IOmniSystemUiProxy.Stub() {
- @Override
- public void setUfpsImageBitmap(Bitmap imageData) {
- FileOutputStream fos = null;
- try {
- File filePath = new File(getFilesDir(), UFPSIMAGE_FILE_NAME);
- Log.d(TAG, "setUfpsImageBitmap -> " + filePath.getAbsolutePath());
- fos = new FileOutputStream(filePath);
- imageData.compress(Bitmap.CompressFormat.PNG, 90, fos);
- fos.close();
- // TODO notify eg set current time to dummy settings
- } catch (Exception e) {
- Log.e(TAG, "setUfpsImageBitmap", e);
- }
- }
-
- @Override
- public void resetUfpsImage() {
- File filePath = new File(getFilesDir(), UFPSIMAGE_FILE_NAME);
- if (filePath.exists()) {
- filePath.delete();
- // TODO notify eg set current time to dummy settings
- }
- }
- };
-
- @Inject
- public OmniSystemUIService() {
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- Log.d(TAG, "onCreate");
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- Log.d(TAG, "onDestroy");
- }
-
- @Override
- public IBinder onBind(Intent intent) {
- Log.d(TAG, "onBind");
- return mOmniSysUiProxy.asBinder();
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/omni/dagger/OmniModule.java b/packages/SystemUI/src/com/android/systemui/omni/dagger/OmniModule.java
index 9298f12..6ba05ff 100644
--- a/packages/SystemUI/src/com/android/systemui/omni/dagger/OmniModule.java
+++ b/packages/SystemUI/src/com/android/systemui/omni/dagger/OmniModule.java
@@ -16,11 +16,8 @@
package com.android.systemui.omni.dagger;
-import android.app.Service;
-
import com.android.systemui.omni.OmniSettingsService;
import com.android.systemui.omni.OmniSettingsServiceImpl;
-import com.android.systemui.omni.OmniSystemUIService;
import com.android.systemui.qs.tiles.AODTile;
import com.android.systemui.qs.tiles.CaffeineTile;
@@ -63,10 +60,4 @@
@IntoMap
@StringKey(ScreenshotTile.TILE_SPEC)
public abstract QSTileImpl<?> bindScreenshotTile(ScreenshotTile screenshotTile);
-
- /** */
- @Binds
- @IntoMap
- @ClassKey(OmniSystemUIService.class)
- public abstract Service bindOmniSystemUIService(OmniSystemUIService service);
}