Allow CryptKeeper dialogs to rotate on tablets

Tablets may be used in docking stations thus need to support landscape mode.
Phones will not be, and having them rotate is both ugly and annoying.
Also this matches lock screen behavior.

The attribute screenOrientation is not themeable, so the only way of doing
this is programmatic.

Test for truth of bool which is only set for sw600dp devices and
clear the nosensor setting from the manifest if set.

Bug: 16405551
Change-Id: I5b3f945b89402e5aa39642c2c06e98f9ca1ce298
This commit is contained in:
Paul Lawrence
2014-07-22 15:00:50 -07:00
parent 59c3da2367
commit 7ae20e3ce9
4 changed files with 13 additions and 119 deletions

View File

@@ -21,7 +21,9 @@ import android.app.StatusBarManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources.NotFoundException;
import android.media.AudioManager;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -339,6 +341,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
return;
}
try {
if (getResources().getBoolean(R.bool.crypt_keeper_allow_rotation)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
} catch (NotFoundException e) {
}
// Disable the status bar, but do NOT disable back because the user needs a way to go
// from keyboard settings and back to the password screen.
mStatusBar = (StatusBarManager) getSystemService(Context.STATUS_BAR_SERVICE);