Code cleanup
> Removing obsolete logging
> Removing unused methods
> Removing resource leak warning due to non-static handler class in launcher
Change-Id: Ic38cc8aea82899b0b5ee3235f04e5964e49245fb
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 6dfe0eb..2be2d9d 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1810,16 +1810,17 @@
}
}
- private final Handler mHandler = new Handler() {
+ @Thunk final Handler mHandler = new Handler(new Handler.Callback() {
+
@Override
- public void handleMessage(Message msg) {
+ public boolean handleMessage(Message msg) {
if (msg.what == ADVANCE_MSG) {
int i = 0;
for (View key: mWidgetsToAdvance.keySet()) {
final View v = key.findViewById(mWidgetsToAdvance.get(key).autoAdvanceViewId);
final int delay = mAdvanceStagger * i;
if (v instanceof Advanceable) {
- postDelayed(new Runnable() {
+ mHandler.postDelayed(new Runnable() {
public void run() {
((Advanceable) v).advance();
}
@@ -1829,8 +1830,9 @@
}
sendAdvanceMessage(mAdvanceInterval);
}
+ return true;
}
- };
+ });
void addWidgetToAutoAdvanceIfNeeded(View hostView, AppWidgetProviderInfo appWidgetInfo) {
if (appWidgetInfo == null || appWidgetInfo.autoAdvanceViewId == -1) return;
@@ -2345,7 +2347,7 @@
Intent createShortcutIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
createShortcutIntent.setComponent(componentName);
- processShortcut(createShortcutIntent);
+ Utilities.startActivityForResultSafely(this, createShortcutIntent, REQUEST_CREATE_SHORTCUT);
}
/**
@@ -2402,14 +2404,6 @@
}
}
- void processShortcut(Intent intent) {
- Utilities.startActivityForResultSafely(this, intent, REQUEST_CREATE_SHORTCUT);
- }
-
- void processWallpaper(Intent intent) {
- startActivityForResult(intent, REQUEST_PICK_WALLPAPER);
- }
-
FolderIcon addFolder(CellLayout layout, long container, final long screenId, int cellX,
int cellY) {
final FolderInfo folderInfo = new FolderInfo();
@@ -2811,20 +2805,10 @@
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onClickSettingsButton(v);
} else {
- showSettingsActivity();
+ startActivity(new Intent(this, SettingsActivity.class));
}
}
- public void onTouchDownAllAppsButton(View v) {
- // Provide the same haptic feedback that the system offers for virtual keys.
- v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
- }
-
- public void performHapticFeedbackOnTouchDown(View v) {
- // Provide the same haptic feedback that the system offers for virtual keys.
- v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
- }
-
public View.OnTouchListener getHapticFeedbackTouchListener() {
if (mHapticFeedbackTouchListener == null) {
mHapticFeedbackTouchListener = new View.OnTouchListener() {
@@ -3774,10 +3758,6 @@
@Override
public void bindAddScreens(ArrayList<Long> orderedScreenIds) {
- // Log to disk
- Launcher.addDumpLog(TAG, "11683562 - bindAddScreens()", true);
- Launcher.addDumpLog(TAG, "11683562 - orderedScreenIds: " +
- TextUtils.join(", ", orderedScreenIds), true);
int count = orderedScreenIds.size();
for (int i = 0; i < count; i++) {
mWorkspace.insertNewWorkspaceScreenBeforeEmptyScreen(orderedScreenIds.get(i));
@@ -4535,10 +4515,6 @@
editor.apply();
}
- private void showSettingsActivity() {
- startActivity(new Intent(this, SettingsActivity.class));
- }
-
/**
* To be overridden by subclasses to indicate that there is an in-activity full-screen intro
* screen that must be displayed and dismissed.