This NPE is caused by not having a PreviewStatusListener in
photosphere module. Hooking up PreviewStatusListener in
photosphere requires a refactor which is non-trivial amount
of work.
So for now, a null check is added here to prevent NPE
and the logic of detecting and handling device flip will be
added into photosphere to properly handle device flp.
Part II at ag/412607
Bug:
12679997
Change-Id: I5392674e387800e6a2a3114ec3f834b439aed31e
public void onDisplayChanged(int displayId) {
int rotation = CameraUtil.getDisplayRotation(
(Activity) mController.getAndroidContext());
- if ((rotation - mLastRotation + 360) % 360 == 180) {
+ if ((rotation - mLastRotation + 360) % 360 == 180
+ && mPreviewStatusListener != null) {
mPreviewStatusListener.onPreviewFlipped();
}
mLastRotation = rotation;