Merge "CameraManager: Update display size query"

This commit is contained in:
TreeHugger Robot
2022-02-02 22:04:55 +00:00
committed by Android (Google) Code Review

View File

@@ -25,6 +25,7 @@ import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.hardware.CameraStatus;
import android.hardware.ICameraService;
import android.hardware.ICameraServiceListener;
@@ -458,12 +459,14 @@ public final class CameraManager {
(DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
if (display != null) {
int width = display.getWidth();
int height = display.getHeight();
Point sz = new Point();
display.getRealSize(sz);
int width = sz.x;
int height = sz.y;
if (height > width) {
height = width;
width = display.getHeight();
width = sz.y;
}
ret = new Size(width, height);
@@ -471,7 +474,7 @@ public final class CameraManager {
Log.e(TAG, "Invalid default display!");
}
} catch (Exception e) {
Log.e(TAG, "getDisplaySize Failed. " + e.toString());
Log.e(TAG, "getDisplaySize Failed. " + e);
}
return ret;