Clean up warnings and some private API usage
Change-Id: Ic3c0b333942bc3de130e41531017e71358bd5bfb
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 28dfd65..e3f7b75 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -61,7 +61,6 @@
import android.os.Message;
import android.os.StrictMode;
import android.os.SystemClock;
-import android.os.SystemProperties;
import android.provider.Settings;
import android.speech.RecognizerIntent;
import android.text.Selection;
@@ -99,6 +98,7 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
@@ -146,6 +146,7 @@
private static final String PREFERENCES = "launcher.preferences";
static final String FORCE_ENABLE_ROTATION_PROPERTY = "launcher.force_enable_rotation";
+ static final String DUMP_STATE_PROPERTY = "debug.launcher2.dumpstate";
// The Intent extra that defines whether to ignore the launch animation
static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION =
@@ -308,6 +309,20 @@
int cellY;
}
+
+ private boolean doesFileExist(String filename) {
+ FileInputStream fis = null;
+ try {
+ fis = openFileInput(filename);
+ fis.close();
+ return true;
+ } catch (java.io.FileNotFoundException e) {
+ return false;
+ } catch (java.io.IOException e) {
+ return true;
+ }
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
if (DEBUG_STRICT_MODE) {
@@ -902,7 +917,6 @@
findViewById(R.id.apps_customize_pane);
mAppsCustomizeContent = (AppsCustomizePagedView)
mAppsCustomizeTabHost.findViewById(R.id.apps_customize_pane_content);
- mAppsCustomizeTabHost.setup(this);
mAppsCustomizeContent.setup(this, dragController);
// Get the all apps button
@@ -1746,7 +1760,7 @@
case KeyEvent.KEYCODE_HOME:
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
- if (SystemProperties.getInt("debug.launcher2.dumpstate", 0) != 0) {
+ if (doesFileExist(DUMP_STATE_PROPERTY)) {
dumpState();
return true;
}
@@ -3526,8 +3540,7 @@
}
public boolean isRotationEnabled() {
- boolean forceEnableRotation = "true".equalsIgnoreCase(SystemProperties.get(
- FORCE_ENABLE_ROTATION_PROPERTY, "false"));
+ boolean forceEnableRotation = doesFileExist(FORCE_ENABLE_ROTATION_PROPERTY);
boolean enableRotation = forceEnableRotation ||
getResources().getBoolean(R.bool.allow_rotation);
return enableRotation;
@@ -3565,7 +3578,6 @@
cling.init(this, positionData);
cling.setVisibility(View.VISIBLE);
cling.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- cling.requestAccessibilityFocus();
if (animate) {
cling.buildLayer();
cling.setAlpha(0f);