From a30ce8e6b25e41f392a41fd4d0d3e0a424a84dad Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Wed, 11 Nov 2009 08:16:49 -0800 Subject: Bug 2231692 - Turn off launcher2 logging. --- src/com/android/launcher2/AllAppsView.java | 28 ++----------- src/com/android/launcher2/DragController.java | 2 +- src/com/android/launcher2/Launcher.java | 28 ++++--------- src/com/android/launcher2/LauncherModel.java | 52 +++++++++++++++++-------- src/com/android/launcher2/LauncherProvider.java | 46 +++++++++++----------- src/com/android/launcher2/Search.java | 2 +- src/com/android/launcher2/WallpaperChooser.java | 8 ++-- src/com/android/launcher2/Workspace.java | 18 --------- 8 files changed, 78 insertions(+), 106 deletions(-) (limited to 'src/com/android/launcher2') diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index a7a1e6421..76fee5b91 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -182,8 +182,7 @@ public class AllAppsView extends RSSurfaceView @Override public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { - Log.d(TAG, "starting surfaceChanged"); - long startTime = SystemClock.uptimeMillis(); + //long startTime = SystemClock.uptimeMillis(); super.surfaceChanged(holder, format, w, h); @@ -194,7 +193,6 @@ public class AllAppsView extends RSSurfaceView mRollo.init(getResources(), w, h); if (mAllAppsList != null) { mRollo.setApps(mAllAppsList); - Log.d(TAG, "surfaceChanged... calling mRollo.setApps"); } if (mShouldGainFocus) { gainFocus(); @@ -209,8 +207,8 @@ public class AllAppsView extends RSSurfaceView Resources res = getContext().getResources(); int barHeight = (int)res.getDimension(R.dimen.button_bar_height); - long endTime = SystemClock.uptimeMillis(); - Log.d(TAG, "surfaceChanged took " + (endTime-startTime) + "ms"); + //long endTime = SystemClock.uptimeMillis(); + //Log.d(TAG, "surfaceChanged took " + (endTime-startTime) + "ms"); } @Override @@ -615,21 +613,6 @@ public class AllAppsView extends RSSurfaceView } } - /* - @Override - public boolean onTrackballEvent(MotionEvent ev) - { - float x = ev.getX(); - float y = ev.getY(); - //Float tx = new Float(x); - //Float ty = new Float(y); - //Log.e("rs", "tbe " + tx.toString() + ", " + ty.toString()); - - - return true; - } - */ - public void setApps(ArrayList list) { mAllAppsList = list; if (mRollo != null) { @@ -655,7 +638,6 @@ public class AllAppsView extends RSSurfaceView if (index < 0) { index = -(index+1); } - Log.d(TAG, "Adding app '" + item + "' at index " + index + " mRollo=" + mRollo); mAllAppsList.add(index, item); if (mRollo != null) { mRollo.addApp(index, item); @@ -685,7 +667,7 @@ public class AllAppsView extends RSSurfaceView mRollo.mState.iconCount--; } } else { - Log.e(TAG, "couldn't find a match for item \"" + item + "\""); + Log.w(TAG, "couldn't find a match for item \"" + item + "\""); // Try to recover. This should keep us from crashing for now. } } @@ -795,7 +777,6 @@ public class AllAppsView extends RSSurfaceView mPosX = ((float)mData[0]) / (1 << 16); mVelocity = ((float)mData[1]) / (1 << 16); mZoom = ((float)mData[2]) / (1 << 16); - //Log.d("rs", "new msg " + mPosX + " " + mVelocity + " " + mZoom); } float mZoom; float mPosX; @@ -804,7 +785,6 @@ public class AllAppsView extends RSSurfaceView AAMessage mMessageProc; private boolean checkClickOK() { - //android.util.Log.e("rs", "check click " + Float.toString(mReadback.velocity) + ", " + Float.toString(mReadback.posX)); return (Math.abs(mMessageProc.mVelocity) < 0.4f) && (Math.abs(mMessageProc.mPosX - Math.round(mMessageProc.mPosX)) < 0.4f); } diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index 5eb900718..1655cb8cd 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -300,7 +300,7 @@ public class DragController { */ public boolean onInterceptTouchEvent(MotionEvent ev) { if (false) { - Log.d(Launcher.LOG_TAG, "DragController.onInterceptTouchEvent " + ev + " mDragging=" + Log.d(Launcher.TAG, "DragController.onInterceptTouchEvent " + ev + " mDragging=" + mDragging); } final int action = ev.getAction(); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index ce3d5a71a..2242e6f25 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -56,7 +56,6 @@ import android.text.Selection; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.method.TextKeyListener; -import static android.util.Log.*; import android.util.Log; import android.view.Display; import android.view.KeyEvent; @@ -88,8 +87,7 @@ import java.io.DataInputStream; */ public final class Launcher extends Activity implements View.OnClickListener, OnLongClickListener, LauncherModel.Callbacks { - static final String LOG_TAG = "Launcher"; - static final String TAG = LOG_TAG; + static final String TAG = "Launcher"; static final boolean LOGD = false; static final boolean PROFILE_STARTUP = false; @@ -200,14 +198,11 @@ public final class Launcher extends Activity private ArrayList mDesktopItems = new ArrayList(); private static HashMap mFolders = new HashMap(); - public static long lastStartTime; private ImageView mPreviousView; private ImageView mNextView; @Override protected void onCreate(Bundle savedInstanceState) { - lastStartTime = SystemClock.uptimeMillis(); - super.onCreate(savedInstanceState); mModel = ((LauncherApplication)getApplication()).setLauncher(this); @@ -408,10 +403,6 @@ public final class Launcher extends Activity @Override protected void onResume() { - if (lastStartTime == 0) { - lastStartTime = SystemClock.uptimeMillis(); - } - super.onResume(); if (mRestoring) { @@ -433,7 +424,7 @@ public final class Launcher extends Activity try { searchManagerService.stopSearch(); } catch (RemoteException e) { - e(LOG_TAG, "error stopping search", e); + Log.e(TAG, "error stopping search", e); } } }); @@ -667,7 +658,7 @@ public final class Launcher extends Activity try { activityInfo = packageManager.getActivityInfo(component, 0 /* no flags */); } catch (NameNotFoundException e) { - e(LOG_TAG, "Couldn't find ActivityInfo for selected application", e); + Log.e(TAG, "Couldn't find ActivityInfo for selected application", e); } if (activityInfo != null) { @@ -719,7 +710,7 @@ public final class Launcher extends Activity Bundle extras = data.getExtras(); int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1); - if (LOGD) d(LOG_TAG, "dumping extras content=" + extras.toString()); + if (LOGD) Log.d(TAG, "dumping extras content=" + extras.toString()); AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId); @@ -801,7 +792,7 @@ public final class Launcher extends Activity final int id = resources.getIdentifier(iconResource.resourceName, null, null); icon = resources.getDrawable(id); } catch (Exception e) { - w(LOG_TAG, "Could not load shortcut icon: " + extra); + Log.w(TAG, "Could not load shortcut icon: " + extra); } } } @@ -929,7 +920,7 @@ public final class Launcher extends Activity try { mAppWidgetHost.stopListening(); } catch (NullPointerException ex) { - w(LOG_TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex); + Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex); } TextKeyListener.getInstance().release(); @@ -1239,7 +1230,7 @@ public final class Launcher extends Activity final int id = resources.getIdentifier(iconResource.resourceName, null, null); icon = resources.getDrawable(id); } catch (Exception e) { - w(LOG_TAG, "Could not load live folder icon: " + extra); + Log.w(TAG, "Could not load live folder icon: " + extra); } } @@ -1403,7 +1394,6 @@ public final class Launcher extends Activity } else if (tag instanceof FolderInfo) { handleFolderClick((FolderInfo) tag); } else if (v == mHandleView) { - Log.d(TAG, "onClick"); if (isAllAppsVisible()) { closeAllApps(true); } else { @@ -1420,7 +1410,7 @@ public final class Launcher extends Activity Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show(); } catch (SecurityException e) { Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show(); - e(LOG_TAG, "Launcher does not have the permission to launch " + intent + + Log.e(TAG, "Launcher does not have the permission to launch " + intent + ". Make sure to create a MAIN intent-filter for the corresponding activity " + "or use the exported attribute for this activity.", e); } @@ -1974,7 +1964,6 @@ public final class Launcher extends Activity private class CloseSystemDialogsIntentReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - Log.d(TAG, "CloseSystemDialogsIntentReceiver.onReceiver intent=" + intent); closeSystemDialogs(); } } @@ -2143,7 +2132,6 @@ public final class Launcher extends Activity mSavedInstanceState = null; } - Log.d(TAG, "finishBindingItems done"); mWorkspaceLoading = false; } diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index fc97832a5..a796831b6 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -49,7 +49,7 @@ import java.util.List; * for the Launcher. */ public class LauncherModel extends BroadcastReceiver { - static final boolean DEBUG_LOADERS = true; + static final boolean DEBUG_LOADERS = false; static final String TAG = "Launcher.Model"; private final LauncherApplication mApp; @@ -270,8 +270,6 @@ public class LauncherModel extends BroadcastReceiver { * ACTION_PACKAGE_CHANGED. */ public void onReceive(Context context, Intent intent) { - Log.d(TAG, "onReceive intent=" + intent); - // Use the app as the context. context = mApp; @@ -335,7 +333,7 @@ public class LauncherModel extends BroadcastReceiver { final Callbacks callbacks = mCallbacks != null ? mCallbacks.get() : null; if (callbacks == null) { - Log.d(TAG, "nobody to tell about the new app"); + Log.w(TAG, "Nobody to tell about the new app. Launcher is probably loading."); return; } @@ -389,7 +387,9 @@ public class LauncherModel extends BroadcastReceiver { public void startLoader(Context context, boolean isLaunching) { synchronized (mLock) { - Log.d(TAG, "startLoader isLaunching=" + isLaunching); + if (DEBUG_LOADERS) { + Log.d(TAG, "startLoader isLaunching=" + isLaunching); + } // Don't bother to start the thread if we know it's not going to do anything if (mCallbacks.get() != null) { LoaderThread oldThread = mLoaderThread; @@ -512,12 +512,16 @@ public class LauncherModel extends BroadcastReceiver { public void run() { synchronized (LoaderThread.this) { mWorkspaceDoneBinding = true; - Log.d(TAG, "done with workspace"); + if (DEBUG_LOADERS) { + Log.d(TAG, "done with workspace"); + } LoaderThread.this.notify(); } } }); - Log.d(TAG, "waiting to be done with workspace"); + if (DEBUG_LOADERS) { + Log.d(TAG, "waiting to be done with workspace"); + } while (!mStopped && !mWorkspaceDoneBinding) { try { this.wait(); @@ -525,7 +529,9 @@ public class LauncherModel extends BroadcastReceiver { // Ignore } } - Log.d(TAG, "done waiting to be done with workspace"); + if (DEBUG_LOADERS) { + Log.d(TAG, "done waiting to be done with workspace"); + } } // Load all apps if they're dirty @@ -534,8 +540,10 @@ public class LauncherModel extends BroadcastReceiver { synchronized (mLock) { allAppsSeq = mAllAppsSeq; allAppsDirty = mAllAppsSeq != mLastAllAppsSeq; - //Log.d(TAG, "mAllAppsSeq=" + mAllAppsSeq - // + " mLastAllAppsSeq=" + mLastAllAppsSeq + " allAppsDirty"); + if (DEBUG_LOADERS) { + Log.d(TAG, "mAllAppsSeq=" + mAllAppsSeq + + " mLastAllAppsSeq=" + mLastAllAppsSeq + " allAppsDirty"); + } } if (allAppsDirty) { loadAllApps(); @@ -814,7 +822,9 @@ public class LauncherModel extends BroadcastReceiver { } finally { c.close(); } - Log.d(TAG, "loaded workspace in " + (SystemClock.uptimeMillis()-t) + "ms"); + if (DEBUG_LOADERS) { + Log.d(TAG, "loaded workspace in " + (SystemClock.uptimeMillis()-t) + "ms"); + } } /** @@ -867,7 +877,9 @@ public class LauncherModel extends BroadcastReceiver { // Wait until the queue goes empty. mHandler.postIdle(new Runnable() { public void run() { - Log.d(TAG, "Going to start binding widgets soon."); + if (DEBUG_LOADERS) { + Log.d(TAG, "Going to start binding widgets soon."); + } } }); // Bind the widgets, one at a time. @@ -917,7 +929,10 @@ public class LauncherModel extends BroadcastReceiver { // If we're profiling, this is the last thing in the queue. mHandler.post(new Runnable() { public void run() { - Log.d(TAG, "bound workspace in " + (SystemClock.uptimeMillis()-t) + "ms"); + if (DEBUG_LOADERS) { + Log.d(TAG, "bound workspace in " + + (SystemClock.uptimeMillis()-t) + "ms"); + } if (Launcher.PROFILE_ROTATE) { android.os.Debug.stopMethodTracing(); } @@ -954,7 +969,10 @@ public class LauncherModel extends BroadcastReceiver { } Collections.sort(mAllAppsList.data, sComparator); Collections.sort(mAllAppsList.added, sComparator); - Log.d(TAG, "cached app icons in " + (SystemClock.uptimeMillis()-t) + "ms"); + if (DEBUG_LOADERS) { + Log.d(TAG, "cached app icons in " + + (SystemClock.uptimeMillis()-t) + "ms"); + } } } } @@ -973,8 +991,10 @@ public class LauncherModel extends BroadcastReceiver { callbacks.bindAllApplications(results); } - Log.d(TAG, "bound app " + count + " icons in " - + (SystemClock.uptimeMillis()-t) + "ms"); + if (DEBUG_LOADERS) { + Log.d(TAG, "bound app " + count + " icons in " + + (SystemClock.uptimeMillis()-t) + "ms"); + } } }); } diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java index 942b4beac..433addbc9 100644 --- a/src/com/android/launcher2/LauncherProvider.java +++ b/src/com/android/launcher2/LauncherProvider.java @@ -53,8 +53,8 @@ import com.android.internal.util.XmlUtils; import com.android.launcher2.LauncherSettings.Favorites; public class LauncherProvider extends ContentProvider { - private static final String LOG_TAG = "LauncherProvider"; - private static final boolean LOGD = true; + private static final String TAG = "Launcher.LauncherProvider"; + private static final boolean LOGD = false; private static final String DATABASE_NAME = "launcher.db"; @@ -203,7 +203,7 @@ public class LauncherProvider extends ContentProvider { @Override public void onCreate(SQLiteDatabase db) { - if (LOGD) Log.d(LOG_TAG, "creating new launcher database"); + if (LOGD) Log.d(TAG, "creating new launcher database"); db.execSQL("CREATE TABLE favorites (" + "_id INTEGER PRIMARY KEY," + @@ -250,7 +250,7 @@ public class LauncherProvider extends ContentProvider { } private boolean convertDatabase(SQLiteDatabase db) { - if (LOGD) Log.d(LOG_TAG, "converting database from an older format, but not onUpgrade"); + if (LOGD) Log.d(TAG, "converting database from an older format, but not onUpgrade"); boolean converted = false; final Uri uri = Uri.parse("content://" + Settings.AUTHORITY + @@ -279,7 +279,7 @@ public class LauncherProvider extends ContentProvider { if (converted) { // Convert widgets from this import into widgets - if (LOGD) Log.d(LOG_TAG, "converted and now triggering widget upgrade"); + if (LOGD) Log.d(TAG, "converted and now triggering widget upgrade"); convertWidgets(db); } @@ -345,7 +345,7 @@ public class LauncherProvider extends ContentProvider { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - if (LOGD) Log.d(LOG_TAG, "onUpgrade triggered"); + if (LOGD) Log.d(TAG, "onUpgrade triggered"); int version = oldVersion; if (version < 3) { @@ -359,7 +359,7 @@ public class LauncherProvider extends ContentProvider { version = 3; } catch (SQLException ex) { // Old version remains, which means we wipe old data - Log.e(LOG_TAG, ex.getMessage(), ex); + Log.e(TAG, ex.getMessage(), ex); } finally { db.endTransaction(); } @@ -387,7 +387,7 @@ public class LauncherProvider extends ContentProvider { version = 4; } catch (SQLException ex) { // Old version remains, which means we wipe old data - Log.e(LOG_TAG, ex.getMessage(), ex); + Log.e(TAG, ex.getMessage(), ex); } finally { db.endTransaction(); } @@ -402,14 +402,14 @@ public class LauncherProvider extends ContentProvider { version = 5; } catch (SQLException ex) { // Old version remains, which means we wipe old data - Log.e(LOG_TAG, ex.getMessage(), ex); + Log.e(TAG, ex.getMessage(), ex); } finally { db.endTransaction(); } } if (version != DATABASE_VERSION) { - Log.w(LOG_TAG, "Destroying all old data."); + Log.w(TAG, "Destroying all old data."); db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES); db.execSQL("DROP TABLE IF EXISTS " + TABLE_GESTURES); onCreate(db); @@ -444,7 +444,7 @@ public class LauncherProvider extends ContentProvider { c = db.query(TABLE_FAVORITES, new String[] { Favorites._ID }, selectWhere, null, null, null, null); - if (LOGD) Log.d(LOG_TAG, "found upgrade cursor count="+c.getCount()); + if (LOGD) Log.d(TAG, "found upgrade cursor count=" + c.getCount()); final ContentValues values = new ContentValues(); while (c != null && c.moveToNext()) { @@ -454,7 +454,10 @@ public class LauncherProvider extends ContentProvider { try { int appWidgetId = mAppWidgetHost.allocateAppWidgetId(); - if (LOGD) Log.d(LOG_TAG, "allocated appWidgetId="+appWidgetId+" for favoriteId="+favoriteId); + if (LOGD) { + Log.d(TAG, "allocated appWidgetId=" + appWidgetId + + " for favoriteId=" + favoriteId); + } values.clear(); values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId); @@ -468,13 +471,13 @@ public class LauncherProvider extends ContentProvider { allocatedAppWidgets = true; } catch (RuntimeException ex) { - Log.e(LOG_TAG, "Problem allocating appWidgetId", ex); + Log.e(TAG, "Problem allocating appWidgetId", ex); } } db.setTransactionSuccessful(); } catch (SQLException ex) { - Log.w(LOG_TAG, "Problem while allocating appWidgetIds for existing widgets", ex); + Log.w(TAG, "Problem while allocating appWidgetIds for existing widgets", ex); } finally { db.endTransaction(); if (c != null) { @@ -567,9 +570,9 @@ public class LauncherProvider extends ContentProvider { a.recycle(); } } catch (XmlPullParserException e) { - Log.w(LOG_TAG, "Got exception parsing favorites.", e); + Log.w(TAG, "Got exception parsing favorites.", e); } catch (IOException e) { - Log.w(LOG_TAG, "Got exception parsing favorites.", e); + Log.w(TAG, "Got exception parsing favorites.", e); } return i; @@ -594,7 +597,7 @@ public class LauncherProvider extends ContentProvider { values.put(Favorites.SPANY, 1); db.insert(TABLE_FAVORITES, null, values); } catch (PackageManager.NameNotFoundException e) { - Log.w(LOG_TAG, "Unable to add favorite: " + packageName + + Log.w(TAG, "Unable to add favorite: " + packageName + "/" + className, e); return false; } @@ -634,7 +637,7 @@ public class LauncherProvider extends ContentProvider { allocatedAppWidgets = true; } catch (RuntimeException ex) { - Log.e(LOG_TAG, "Problem allocating appWidgetId", ex); + Log.e(TAG, "Problem allocating appWidgetId", ex); } // If any appWidgetIds allocated, then launch over to binder @@ -678,7 +681,7 @@ public class LauncherProvider extends ContentProvider { appWidgetManager.bindAppWidgetId(appWidgetId, cn); } catch (RuntimeException ex) { - Log.e(LOG_TAG, "Problem allocating appWidgetId", ex); + Log.e(TAG, "Problem allocating appWidgetId", ex); } return allocatedAppWidgets; @@ -697,13 +700,12 @@ public class LauncherProvider extends ContentProvider { uri = a.getString(R.styleable.Favorite_uri); intent = Intent.parseUri(uri, 0); } catch (URISyntaxException e) { - Log.w(LauncherModel.TAG, "Shortcut has malformed uri: " + uri); + Log.w(TAG, "Shortcut has malformed uri: " + uri); return false; // Oh well } if (iconResId == 0 || titleResId == 0) { - Log.w(LauncherModel.TAG, - "Shortcut is missing title or icon resource ID"); + Log.w(TAG, "Shortcut is missing title or icon resource ID"); return false; } diff --git a/src/com/android/launcher2/Search.java b/src/com/android/launcher2/Search.java index ca21997a8..f9630487c 100644 --- a/src/com/android/launcher2/Search.java +++ b/src/com/android/launcher2/Search.java @@ -51,7 +51,7 @@ public class Search extends LinearLayout private static final float WIDGET_TOP_OFFSET = 9; - private final String TAG = "SearchWidget"; + private final String TAG = "Launcher.SearchWidget"; private Launcher mLauncher; diff --git a/src/com/android/launcher2/WallpaperChooser.java b/src/com/android/launcher2/WallpaperChooser.java index a74fa6a56..8045059e7 100644 --- a/src/com/android/launcher2/WallpaperChooser.java +++ b/src/com/android/launcher2/WallpaperChooser.java @@ -40,6 +40,7 @@ import java.util.ArrayList; public class WallpaperChooser extends Activity implements AdapterView.OnItemSelectedListener, OnClickListener { + private static final String TAG = "Launcher.WallpaperChooser"; private Gallery mGallery; private ImageView mImageView; @@ -137,7 +138,7 @@ public class WallpaperChooser extends Activity implements AdapterView.OnItemSele setResult(RESULT_OK); finish(); } catch (IOException e) { - Log.e(Launcher.LOG_TAG, "Failed to set wallpaper: " + e); + Log.e(TAG, "Failed to set wallpaper: " + e); } } @@ -178,9 +179,8 @@ public class WallpaperChooser extends Activity implements AdapterView.OnItemSele if (thumbDrawable != null) { thumbDrawable.setDither(true); } else { - Log.e(Launcher.LOG_TAG, String.format( - "Error decoding thumbnail resId=%d for wallpaper #%d", - thumbRes, position)); + Log.e(TAG, "Error decoding thumbnail resId=" + thumbRes + " for wallpaper #" + + position); } return image; } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 3b038cb7a..b70c34221 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -495,24 +495,6 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag return; } - if (Launcher.lastStartTime != 0) { - int itemCount = 0; - for (int i=0; i