Loading AndroidManifest.xml +0 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,6 @@ <activity-alias android:name=".LauncherActivity" android:targetActivity=".files.LauncherActivity" android:enabled="@bool/is_launcher_enabled" android:label="@string/launcher_label" android:icon="@drawable/launcher_icon" > <intent-filter> Loading res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -538,4 +538,8 @@ <!-- Accessibility label to indicate the subject(e.g. file/folder) is from work profile --> <string name="a11y_work">Work</string> <!-- Snackbar shown when users drag and drop files from another app to DocumentsUI. [CHAR_LIMIT=100] --> <string name="drag_from_another_app">Drag from another app not allowed.</string> </resources> src/com/android/documentsui/BaseActivity.java +0 −6 Original line number Diff line number Diff line Loading @@ -595,12 +595,6 @@ public abstract class BaseActivity */ @Override public final void refreshCurrentRootAndDirectory(int anim) { // The following call will crash if it's called before onCreateOptionMenu() is called in // which we install menu item to search view manager, and there is a search query we need to // restore. This happens when we're still initializing our UI so we shouldn't cancel the // search which will be restored later in onCreateOptionMenu(). Try finding a way to guard // refreshCurrentRootAndDirectory() from being called while we're restoring the state of UI // from the saved state passed in onCreate(). mSearchManager.cancelSearch(); // only set the query content in the first launch Loading src/com/android/documentsui/DevicePolicyMetricConsts.java 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.documentsui; import androidx.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * All constants are based on the enums in * frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto. */ public class DevicePolicyMetricConsts { public static final int ATOM_DEVICE_POLICY_EVENT = 103; @IntDef(flag = true, value = { ATOM_DEVICE_POLICY_EVENT, }) @Retention(RetentionPolicy.SOURCE) public @interface Atom { } // Codes representing DocsUI event id. public static final int EVENT_ID_DOCSUI_EMPTY_STATE_NO_PERMISSION = 173; public static final int EVENT_ID_DOCSUI_EMPTY_STATE_QUIET_MODE = 174; public static final int EVENT_ID_DOCSUI_LAUNCH_OTHER_APP = 175; public static final int EVENT_ID_DOCSUI_PICK_RESULT = 176; @IntDef(flag = true, value = { EVENT_ID_DOCSUI_EMPTY_STATE_NO_PERMISSION, EVENT_ID_DOCSUI_EMPTY_STATE_QUIET_MODE, EVENT_ID_DOCSUI_LAUNCH_OTHER_APP, EVENT_ID_DOCSUI_PICK_RESULT, }) @Retention(RetentionPolicy.SOURCE) public @interface EventId { } } src/com/android/documentsui/DragAndDropManager.java +18 −3 Original line number Diff line number Diff line Loading @@ -16,18 +16,19 @@ package com.android.documentsui; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import android.content.ClipData; import android.content.Context; import android.graphics.drawable.Drawable; import android.net.Uri; import android.provider.DocumentsContract; import androidx.annotation.VisibleForTesting; import android.view.DragEvent; import android.view.KeyEvent; import android.view.View; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.documentsui.MenuManager.SelectionDetails; import com.android.documentsui.base.DocumentInfo; import com.android.documentsui.base.DocumentStack; Loading Loading @@ -118,6 +119,12 @@ public interface DragAndDropManager { */ void resetState(View v); /** * Checks whether the drag was initiated from FilesApp. * @return true if initiated from Files app. */ boolean isDragFromSameApp(); /** * Drops items onto the a root. * Loading Loading @@ -165,6 +172,7 @@ public interface DragAndDropManager { private final Drawable mDefaultShadowIcon; private @State int mState = STATE_UNKNOWN; private boolean mDragInitiated = false; // Key events info. This is used to derive state when user drags items into a view to derive // type of file operations. Loading Loading @@ -233,6 +241,7 @@ public interface DragAndDropManager { IconHelper iconHelper, @Nullable DocumentInfo parent) { mDragInitiated = true; mView = v; mInvalidDest = invalidDest; mMustBeCopied = !selectionDetails.canDelete(); Loading Loading @@ -355,6 +364,11 @@ public interface DragAndDropManager { updateState(STATE_UNKNOWN); } @Override public boolean isDragFromSameApp() { return mDragInitiated; } private void updateState(@State int state) { mState = state; Loading Loading @@ -461,6 +475,7 @@ public interface DragAndDropManager { mDestDoc = null; mDestRoot = null; mMustBeCopied = false; mDragInitiated = false; } private @OpType int calculateOpType(ClipData clipData, RootInfo destRoot) { Loading Loading
AndroidManifest.xml +0 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,6 @@ <activity-alias android:name=".LauncherActivity" android:targetActivity=".files.LauncherActivity" android:enabled="@bool/is_launcher_enabled" android:label="@string/launcher_label" android:icon="@drawable/launcher_icon" > <intent-filter> Loading
res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -538,4 +538,8 @@ <!-- Accessibility label to indicate the subject(e.g. file/folder) is from work profile --> <string name="a11y_work">Work</string> <!-- Snackbar shown when users drag and drop files from another app to DocumentsUI. [CHAR_LIMIT=100] --> <string name="drag_from_another_app">Drag from another app not allowed.</string> </resources>
src/com/android/documentsui/BaseActivity.java +0 −6 Original line number Diff line number Diff line Loading @@ -595,12 +595,6 @@ public abstract class BaseActivity */ @Override public final void refreshCurrentRootAndDirectory(int anim) { // The following call will crash if it's called before onCreateOptionMenu() is called in // which we install menu item to search view manager, and there is a search query we need to // restore. This happens when we're still initializing our UI so we shouldn't cancel the // search which will be restored later in onCreateOptionMenu(). Try finding a way to guard // refreshCurrentRootAndDirectory() from being called while we're restoring the state of UI // from the saved state passed in onCreate(). mSearchManager.cancelSearch(); // only set the query content in the first launch Loading
src/com/android/documentsui/DevicePolicyMetricConsts.java 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.documentsui; import androidx.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * All constants are based on the enums in * frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto. */ public class DevicePolicyMetricConsts { public static final int ATOM_DEVICE_POLICY_EVENT = 103; @IntDef(flag = true, value = { ATOM_DEVICE_POLICY_EVENT, }) @Retention(RetentionPolicy.SOURCE) public @interface Atom { } // Codes representing DocsUI event id. public static final int EVENT_ID_DOCSUI_EMPTY_STATE_NO_PERMISSION = 173; public static final int EVENT_ID_DOCSUI_EMPTY_STATE_QUIET_MODE = 174; public static final int EVENT_ID_DOCSUI_LAUNCH_OTHER_APP = 175; public static final int EVENT_ID_DOCSUI_PICK_RESULT = 176; @IntDef(flag = true, value = { EVENT_ID_DOCSUI_EMPTY_STATE_NO_PERMISSION, EVENT_ID_DOCSUI_EMPTY_STATE_QUIET_MODE, EVENT_ID_DOCSUI_LAUNCH_OTHER_APP, EVENT_ID_DOCSUI_PICK_RESULT, }) @Retention(RetentionPolicy.SOURCE) public @interface EventId { } }
src/com/android/documentsui/DragAndDropManager.java +18 −3 Original line number Diff line number Diff line Loading @@ -16,18 +16,19 @@ package com.android.documentsui; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import android.content.ClipData; import android.content.Context; import android.graphics.drawable.Drawable; import android.net.Uri; import android.provider.DocumentsContract; import androidx.annotation.VisibleForTesting; import android.view.DragEvent; import android.view.KeyEvent; import android.view.View; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.documentsui.MenuManager.SelectionDetails; import com.android.documentsui.base.DocumentInfo; import com.android.documentsui.base.DocumentStack; Loading Loading @@ -118,6 +119,12 @@ public interface DragAndDropManager { */ void resetState(View v); /** * Checks whether the drag was initiated from FilesApp. * @return true if initiated from Files app. */ boolean isDragFromSameApp(); /** * Drops items onto the a root. * Loading Loading @@ -165,6 +172,7 @@ public interface DragAndDropManager { private final Drawable mDefaultShadowIcon; private @State int mState = STATE_UNKNOWN; private boolean mDragInitiated = false; // Key events info. This is used to derive state when user drags items into a view to derive // type of file operations. Loading Loading @@ -233,6 +241,7 @@ public interface DragAndDropManager { IconHelper iconHelper, @Nullable DocumentInfo parent) { mDragInitiated = true; mView = v; mInvalidDest = invalidDest; mMustBeCopied = !selectionDetails.canDelete(); Loading Loading @@ -355,6 +364,11 @@ public interface DragAndDropManager { updateState(STATE_UNKNOWN); } @Override public boolean isDragFromSameApp() { return mDragInitiated; } private void updateState(@State int state) { mState = state; Loading Loading @@ -461,6 +475,7 @@ public interface DragAndDropManager { mDestDoc = null; mDestRoot = null; mMustBeCopied = false; mDragInitiated = false; } private @OpType int calculateOpType(ClipData clipData, RootInfo destRoot) { Loading