Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96f886be authored by Jason Chang's avatar Jason Chang
Browse files

Optimize for debug log coding style.

Optimize for debug log coding style to following coding guideline.

Change-Id: I7077356b41f11914d4654285ab0959b943e47612
Fix: 123164197
Test: atest DocumentsUITests
parent f4de7ac6
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -616,9 +616,11 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA
                    contentsUri = DocumentsContract.setManageMode(contentsUri);
                }

                if (DEBUG) Log.d(TAG,
                if (DEBUG) {
                    Log.d(TAG,
                        "Creating new directory loader for: "
                            + DocumentInfo.debugString(mState.stack.peek()));
                }

                return new DirectoryLoader(
                        mInjector.features,
@@ -633,8 +635,10 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA

        @Override
        public void onLoadFinished(Loader<DirectoryResult> loader, DirectoryResult result) {
            if (DEBUG) Log.d(TAG, "Loader has finished for: "
            if (DEBUG) {
                Log.d(TAG, "Loader has finished for: "
                    + DocumentInfo.debugString(mState.stack.peek()));
            }
            assert(result != null);

            mInjector.getModel().update(result);
+12 −4
Original line number Diff line number Diff line
@@ -75,13 +75,17 @@ public class ActionModeController extends SelectionObserver<String>
        mSelectionMgr.copySelection(mSelected);
        if (mSelected.size() > 0) {
            if (mActionMode == null) {
                if (DEBUG) Log.d(TAG, "Starting action mode.");
                if (DEBUG) {
                    Log.d(TAG, "Starting action mode.");
                }
                mActionMode = mActivity.startActionMode(this);
            }
            updateActionMenu();
        } else {
            if (mActionMode != null) {
                if (DEBUG) Log.d(TAG, "Finishing action mode.");
                if (DEBUG) {
                    Log.d(TAG, "Finishing action mode.");
                }
                mActionMode.finish();
            }
        }
@@ -104,12 +108,16 @@ public class ActionModeController extends SelectionObserver<String>
    @Override
    public void onDestroyActionMode(ActionMode mode) {
        if (mActionMode == null) {
            if (DEBUG) Log.w(TAG, "Received call to destroy action mode on alien mode object.");
            if (DEBUG) {
                Log.w(TAG, "Received call to destroy action mode on alien mode object.");
            }
        }

        assert(mActionMode.equals(mode));

        if (DEBUG) Log.d(TAG, "Handling action mode destroyed.");
        if (DEBUG) {
            Log.d(TAG, "Handling action mode destroyed.");
        }
        mActionMode = null;
        mMenu = null;

+6 −2
Original line number Diff line number Diff line
@@ -334,7 +334,9 @@ public abstract class BaseActivity
    private State getState(@Nullable Bundle icicle) {
        if (icicle != null) {
            State state = icicle.<State>getParcelable(Shared.EXTRA_STATE);
            if (DEBUG) Log.d(mTag, "Recovered existing state object: " + state);
            if (DEBUG) {
                Log.d(mTag, "Recovered existing state object: " + state);
            }
            return state;
        }

@@ -354,7 +356,9 @@ public abstract class BaseActivity
        // Only show the toggle if advanced isn't forced enabled.
        state.showDeviceStorageOption = !Shared.mustShowDeviceRoot(intent);

        if (DEBUG) Log.d(mTag, "Created new state object: " + state);
        if (DEBUG) {
            Log.d(mTag, "Created new state object: " + state);
        }

        return state;
    }
+9 −3
Original line number Diff line number Diff line
@@ -143,7 +143,9 @@ public final class FocusManager extends FocusDelegate<String> implements FocusHa
    @Override
    public boolean focusDirectoryList() {
        if (!mScope.isValid() || mScope.adapter.getItemCount() == 0) {
            if (DEBUG) Log.v(TAG, "Nothing to focus.");
            if (DEBUG) {
                Log.v(TAG, "Nothing to focus.");
            }
            return false;
        }

@@ -152,7 +154,9 @@ public final class FocusManager extends FocusDelegate<String> implements FocusHa
        // vs. Cut focused
        // item)
        if (mSelectionMgr.hasSelection()) {
            if (DEBUG) Log.v(TAG, "Existing selection found. No focus will be done.");
            if (DEBUG) {
                Log.v(TAG, "Existing selection found. No focus will be done.");
            }
            return false;
        }

@@ -199,7 +203,9 @@ public final class FocusManager extends FocusDelegate<String> implements FocusHa
    @Override
    public void focusDocument(String modelId) {
        if (!mScope.isValid()) {
            if (DEBUG) Log.v(TAG, "Invalid mScope. No focus will be done.");
            if (DEBUG) {
                Log.v(TAG, "Invalid mScope. No focus will be done.");
            }
            return;
        }
        int pos = mScope.adapter.getAdapterPosition(modelId);
+9 −3
Original line number Diff line number Diff line
@@ -113,7 +113,9 @@ public class Model {
    @VisibleForTesting
    public void update(DirectoryResult result) {
        assert(result != null);
        if (DEBUG) Log.i(TAG, "Updating model with new result set.");
        if (DEBUG) {
            Log.i(TAG, "Updating model with new result set.");
        }

        if (result.exception != null) {
            Log.e(TAG, "Error while loading directory contents", result.exception);
@@ -177,13 +179,17 @@ public class Model {
    public @Nullable Cursor getItem(String modelId) {
        Integer pos = mPositions.get(modelId);
        if (pos == null) {
            if (DEBUG) Log.d(TAG, "Unabled to find cursor position for modelId: " + modelId);
            if (DEBUG) {
                Log.d(TAG, "Unabled to find cursor position for modelId: " + modelId);
            }
            return null;
        }

        if (!mCursor.moveToPosition(pos)) {
            if (DEBUG) Log.d(TAG,
            if (DEBUG) {
                Log.d(TAG,
                    "Unabled to move cursor to position " + pos + " for modelId: " + modelId);
            }
            return null;
        }

Loading