From 6619801fe672f5655cc314cd2e9b8f188829d1aa Mon Sep 17 00:00:00 2001 From: Nehemiah of Zebulun Date: Wed, 24 Jan 2024 15:55:29 -0500 Subject: [PATCH] updating and adding patches for external screen functionality --- ...hed-revert-of-LOS-FOD-implementation.patch | 4 +- .../0001-fix-external-screen-cats22flip.patch | 31 ++++ ...add-presentation-on-external-display.patch | 153 ++++++++++++++++++ .../0004-disable-lock-screen.patch | 26 --- 4 files changed, 186 insertions(+), 28 deletions(-) create mode 100644 patches_wephone/device_phh_treble/0001-fix-external-screen-cats22flip.patch create mode 100644 patches_wephone/frameworks_base/0001-add-presentation-on-external-display.patch delete mode 100644 patches_wephone/frameworks_base/0004-disable-lock-screen.patch diff --git a/patches_treble_prerequisite/frameworks_base/0001-Squashed-revert-of-LOS-FOD-implementation.patch b/patches_treble_prerequisite/frameworks_base/0001-Squashed-revert-of-LOS-FOD-implementation.patch index 9d2c8d7..f761979 100644 --- a/patches_treble_prerequisite/frameworks_base/0001-Squashed-revert-of-LOS-FOD-implementation.patch +++ b/patches_treble_prerequisite/frameworks_base/0001-Squashed-revert-of-LOS-FOD-implementation.patch @@ -311,10 +311,10 @@ index bace9324ac9..1db2e32b8cd 100644 private final ViewConfiguration mViewConfiguration; private final SpringAnimation mSpringAnimation; -@@ -265,10 +261,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe - mKeyguardStateController = Dependency.get(KeyguardStateController.class); +@@ -268,10 +268,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe mSecondaryLockScreenController = new AdminSecondaryLockScreenController(context, this, mUpdateMonitor, mCallback, new Handler(Looper.myLooper())); + mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); - - PackageManager packageManager = mContext.getPackageManager(); - mHasFod = packageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) && diff --git a/patches_wephone/device_phh_treble/0001-fix-external-screen-cats22flip.patch b/patches_wephone/device_phh_treble/0001-fix-external-screen-cats22flip.patch new file mode 100644 index 0000000..7b3a895 --- /dev/null +++ b/patches_wephone/device_phh_treble/0001-fix-external-screen-cats22flip.patch @@ -0,0 +1,31 @@ +From 023fc7d4c634d8a1a8eaa15a5187bd49d12d9726 Mon Sep 17 00:00:00 2001 +From: Nehemiah of Zebulun +Date: Wed, 24 Jan 2024 15:49:10 -0500 +Subject: [PATCH] fix external screen cats22flip + +Change-Id: Ia4f4c8d1d037fa031831aa4028cf94d5eb940c03 +--- + phh-on-data.sh | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/phh-on-data.sh b/phh-on-data.sh +index 472d16e..9427514 100644 +--- a/phh-on-data.sh ++++ b/phh-on-data.sh +@@ -13,6 +13,13 @@ if getprop persist.sys.phh.caf.media_profile |grep -q true;then + setprop media.settings.xml "/vendor/etc/media_profiles_vendor.xml" + fi + ++#Fix external screen on Cat S22 Flip ++if getprop ro.vendor.build.fingerprint | grep -iq -e S22FLIP; then ++ if ! getprop ro.vendor.gsi.image_running | grep -iq -F false; then ++ setprop ro.vendor.gsi.image_running false ++ setprop ctl.restart vendor.hwcomposer-2-1 ++ fi ++fi + + minijailSrc=/system/system_ext/apex/com.android.vndk.v28/lib/libminijail.so + minijailSrc64=/system/system_ext/apex/com.android.vndk.v28/lib64/libminijail.so +-- +2.39.2 + diff --git a/patches_wephone/frameworks_base/0001-add-presentation-on-external-display.patch b/patches_wephone/frameworks_base/0001-add-presentation-on-external-display.patch new file mode 100644 index 0000000..44fe038 --- /dev/null +++ b/patches_wephone/frameworks_base/0001-add-presentation-on-external-display.patch @@ -0,0 +1,153 @@ +From 8765b97c6f66d449a4cee746abf015553877a153 Mon Sep 17 00:00:00 2001 +From: Nehemiah of Zebulun +Date: Wed, 24 Jan 2024 15:25:52 -0500 +Subject: [PATCH] add presentation on external display + +Change-Id: I83ecae9888cec97a806bda9b5f9580724455d8cd +--- + .../keyguard/KeyguardDisplayManager.java | 24 ------ + .../com/android/systemui/SystemUIService.java | 81 +++++++++++++++++++ + 2 files changed, 81 insertions(+), 24 deletions(-) + +diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java +index d6fabd63420..26d08af339c 100644 +--- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java ++++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java +@@ -121,30 +121,6 @@ public class KeyguardDisplayManager { + * was already there. + */ + private boolean showPresentation(Display display) { +- if (!isKeyguardShowable(display)) return false; +- if (DEBUG) Log.i(TAG, "Keyguard enabled on display: " + display); +- final int displayId = display.getDisplayId(); +- Presentation presentation = mPresentations.get(displayId); +- if (presentation == null) { +- final Presentation newPresentation = new KeyguardPresentation(mContext, display, +- mInjectableInflater.injectable(LayoutInflater.from(mContext))); +- newPresentation.setOnDismissListener(dialog -> { +- if (newPresentation.equals(mPresentations.get(displayId))) { +- mPresentations.remove(displayId); +- } +- }); +- presentation = newPresentation; +- try { +- presentation.show(); +- } catch (WindowManager.InvalidDisplayException ex) { +- Log.w(TAG, "Invalid display:", ex); +- presentation = null; +- } +- if (presentation != null) { +- mPresentations.append(displayId, presentation); +- return true; +- } +- } + return false; + } + +diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java +index c56bab290ce..36fbf91189b 100644 +--- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java ++++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java +@@ -39,6 +39,20 @@ import java.io.PrintWriter; + + import javax.inject.Inject; + ++import android.widget.LinearLayout; ++import android.widget.LinearLayout.LayoutParams; ++import android.widget.TextClock; ++import android.util.TypedValue; ++import android.util.Log; ++import android.os.Bundle; ++import android.content.Context; ++import android.app.Presentation; ++import android.view.Display; ++import android.graphics.Color; ++import android.view.View; ++import android.view.Window; ++import android.media.MediaRouter; ++ + public class SystemUIService extends Service { + + private final Handler mMainHandler; +@@ -101,6 +115,18 @@ public class SystemUIService extends Service { + startServiceAsUser( + new Intent(getApplicationContext(), SystemUIAuxiliaryDumpService.class), + UserHandle.SYSTEM); ++ try { ++ MediaRouter mediaRouter = (MediaRouter) getSystemService(Context.MEDIA_ROUTER_SERVICE); ++ MediaRouter.RouteInfo selectedRoute = mediaRouter.getSelectedRoute(1); ++ Display presentationDisplay = selectedRoute != null ? selectedRoute.getPresentationDisplay() : null; ++ PresentationScreen mPresentation = new PresentationScreen(this, presentationDisplay); ++ Log.i("SystemUIService", "Showing presentation on display: " + presentationDisplay); ++ mPresentation.requestWindowFeature(Window.FEATURE_NO_TITLE); ++ mPresentation.show(); ++ Log.i("SystemUIService", "Showing presentation."); ++ } catch (Exception e) { ++ Log.w("SystemUIService", "Couldn't show presentation! Display was removed in the meantime.", e); ++ } + } + + @Override +@@ -122,4 +148,59 @@ public class SystemUIService extends Service { + + mDumpHandler.dump(fd, pw, massagedArgs); + } ++ ++ static final class PresentationScreen extends Presentation { ++ private Context mOuterContext; ++ ++ PresentationScreen(Context context, Display display) { ++ super(context, display, R.style.Theme_SystemUI_KeyguardPresentation); ++ setCancelable(false); ++ mOuterContext = context; ++ } ++ ++ @Override ++ public void cancel() { ++ // Do not allow anything to cancel KeyguardPresetation except KeyguardDisplayManager. ++ } ++ ++ @Override ++ public void onDetachedFromWindow() { ++ } ++ ++ @Override ++ protected void onCreate(Bundle savedInstanceState) { ++ super.onCreate(savedInstanceState); ++ ++ LinearLayout mLayout = new LinearLayout(mOuterContext); ++ mLayout.setLayoutParams(new LayoutParams(96, 96)); ++ mLayout.setOrientation(LinearLayout.VERTICAL); ++ mLayout.setBackgroundColor(Color.BLACK); ++ ++ LayoutParams mClockParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); ++ ++ TextClock mEmptyClock = new TextClock(mOuterContext); ++ mEmptyClock.setLayoutParams(mClockParams); ++ mEmptyClock.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10); ++ mEmptyClock.setVisibility(View.INVISIBLE); ++ mLayout.addView(mEmptyClock); ++ ++ TextClock mTextClock = new TextClock(mOuterContext); ++ mTextClock.setLayoutParams(mClockParams); ++ mTextClock.setFormat12Hour("hh:mm"); ++ mTextClock.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); ++ mTextClock.setTextColor(Color.WHITE); ++ mTextClock.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); ++ mLayout.addView(mTextClock); ++ ++ TextClock mDateClock = new TextClock(mOuterContext); ++ mDateClock.setLayoutParams(mClockParams); ++ mDateClock.setFormat12Hour("EEE, MMMM dd"); ++ mDateClock.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); ++ mDateClock.setTextColor(Color.WHITE); ++ mDateClock.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10); ++ mLayout.addView(mDateClock); ++ ++ setContentView(mLayout); ++ } ++ } + } +-- +2.39.2 + diff --git a/patches_wephone/frameworks_base/0004-disable-lock-screen.patch b/patches_wephone/frameworks_base/0004-disable-lock-screen.patch deleted file mode 100644 index eb1b5d9..0000000 --- a/patches_wephone/frameworks_base/0004-disable-lock-screen.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 3aceacf62182951ef8cdcb88866aa77fad768687 Mon Sep 17 00:00:00 2001 -From: Nehemiah of Zebulun -Date: Fri, 22 Dec 2023 14:48:20 -0500 -Subject: [PATCH] disable lock screen - -Change-Id: I68fd449b67d2c3fbf6dd48db87e3ea06b3a7d3ee ---- - packages/SettingsProvider/res/values/defaults.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml -index 51f69a95e16..278903e0c47 100644 ---- a/packages/SettingsProvider/res/values/defaults.xml -+++ b/packages/SettingsProvider/res/values/defaults.xml -@@ -82,7 +82,7 @@ - 1000 - 15000 - -- false -+ true - false - 1 - --- -2.39.2 -