CameraManager: Update display size query
Account for any UI insets by retrieving the real display size. Bug: 214576274 Test: Camera CTS Change-Id: I7842b3cda4df99a84cf7325da5c097b0ff3f81d4
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user