Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea86ce85 authored by Daniel Zheng's avatar Daniel Zheng
Browse files

update screenPartStatus to return a list

in the case of foldables, there could be multiple internal displays that
can have a replacement part. account for that here

Flag: com.android.tradeinmode.flags.trade_in_mode_2025q4
Test: th
Change-Id: Ia6a90f42d11cb1d88142f9ad07372b2b0086fa41
parent 5f64c533
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -131,5 +131,5 @@ interface ITradeInMode {
     * Get ScreenPartStatus
     *
     */
    ScreenPartStatus getScreenPartStatus();
    ScreenPartStatus[] getScreenPartStatus();
}
+7 −6
Original line number Diff line number Diff line
@@ -252,16 +252,17 @@ public final class TradeInModeService extends SystemService {

        @Override
        @RequiresPermission(android.Manifest.permission.ENTER_TRADE_IN_MODE)
        public int getScreenPartStatus() throws RemoteException {
            SurfaceControl b = new SurfaceControl.Builder().setName("TIM").build();
        public int[] getScreenPartStatus() throws RemoteException {
            int[] statuses = new int[DisplayControl.getPhysicalDisplayIds().length];
            int index = 0;
            // loop through all displayId to find id of internal display
            for (long physicalDisplayId : DisplayControl.getPhysicalDisplayIds()) {
                SurfaceControl.StaticDisplayInfo info = b.getStaticDisplayInfo(physicalDisplayId);
                if (info.isInternal) {
                    return info.screenPartStatus;
                SurfaceControl.StaticDisplayInfo info = SurfaceControl.getStaticDisplayInfo(physicalDisplayId);
                if (info != null && info.isInternal) {
                    statuses[index++] = info.screenPartStatus;
                }
            }
            return 0;
            return statuses;
        }

        @Override