1 package com.android.camera.app; 2 3 import android.os.Handler; 4 import android.view.OrientationEventListener; 5 6 /** 7 * An interface which defines the orientation manager. 8 */ 9 public interface OrientationManager { 10 public final static int ORIENTATION_UNKNOWN = OrientationEventListener.ORIENTATION_UNKNOWN; 11 12 public interface OnOrientationChangeListener { 13 /** 14 * Called when the orientation changes. 15 * 16 * @param orientation The current orientation. 17 */ onOrientationChanged(int orientation)18 public void onOrientationChanged(int orientation); 19 } 20 21 /** 22 * Adds the 23 * {@link com.android.camera.app.OrientationManager.OnOrientationChangeListener}. 24 */ addOnOrientationChangeListener( Handler handler, OnOrientationChangeListener listener)25 public void addOnOrientationChangeListener( 26 Handler handler, OnOrientationChangeListener listener); 27 28 /** 29 * Removes the listener. 30 */ removeOnOrientationChangeListener( Handler handler, OnOrientationChangeListener listener)31 public void removeOnOrientationChangeListener( 32 Handler handler, OnOrientationChangeListener listener); 33 34 /** 35 * Lock the framework orientation to the current device orientation 36 * rotates. No effect if the system setting of auto-rotation is off. 37 */ lockOrientation()38 void lockOrientation(); 39 40 /** 41 * Unlock the framework orientation, so it can change when the device 42 * rotates. No effect if the system setting of auto-rotation is off. 43 */ unlockOrientation()44 void unlockOrientation(); 45 46 /** @return Whether the orientation is locked by the app or the system. */ isOrientationLocked()47 boolean isOrientationLocked(); 48 49 /** 50 * Returns the display rotation degrees relative to the natural orientation 51 * in clockwise. 52 * 53 * @return 0, 90, 180, or 270. 54 */ getDisplayRotation()55 int getDisplayRotation(); 56 } 57