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

Commit 97c4fa0f authored by Ben Reich's avatar Ben Reich Committed by Automerger Merge Worker
Browse files

Trim the application name to make it safe for presentation am: 05839b7a

parents 27ad4b9a 05839b7a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -520,7 +520,7 @@
    <!-- Confrim dialog title show on open document tree flow. [CHAR_LIMIT=80] -->
    <string name="open_tree_dialog_title">Allow <xliff:g id="appName" example="Drive">%1$s</xliff:g> to access files in <xliff:g id="directory" example="DCIM">%2$s</xliff:g>?</string>
    <!-- Confrim dialog message show on open document tree flow.-->
    <string name="open_tree_dialog_message">This will let <xliff:g id="appName" example="Drive">%1$s</xliff:g> access current and future content stored in <xliff:g id="directory" example="DCIM">%2$s</xliff:g>.</string>
    <string name="open_tree_dialog_message">This will let "<xliff:g id="appName" example="Drive">%1$s</xliff:g>" access current and future content stored in <xliff:g id="directory" example="DCIM">%2$s</xliff:g>.</string>
    <!-- Header message title show on open document tree flow when directory is blocked. [CHAR_LIMIT=48] -->
    <string name="directory_blocked_header_title">Can\u2019t use this folder</string>
    <!-- Header message subtitle show on open document tree flow when directory is blocked. [CHAR_LIMIT=90]-->
+10 −2
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.documentsui.base;

import static android.text.TextUtils.SAFE_STRING_FLAG_SINGLE_LINE;
import static android.text.TextUtils.SAFE_STRING_FLAG_TRIM;

import static com.android.documentsui.base.SharedMinimal.TAG;

import android.app.Activity;
@@ -276,7 +279,7 @@ public final class Shared {
     * @return the calling app name or general anonymous name if not found
     */
    @NonNull
    public static String getCallingAppName(Activity activity) {
    public static CharSequence getCallingAppName(Activity activity) {
        final String anonymous = activity.getString(R.string.anonymous_application);
        final String packageName = getCallingPackageName(activity);
        if (TextUtils.isEmpty(packageName)) {
@@ -292,7 +295,12 @@ public final class Shared {
        }

        CharSequence result = pm.getApplicationLabel(ai);
        return TextUtils.isEmpty(result) ? anonymous : result.toString();
        if (TextUtils.isEmpty(result)) {
            return anonymous;
        }

        return TextUtils.makeSafeForPresentation(
                result.toString(), 500, 0, SAFE_STRING_FLAG_TRIM | SAFE_STRING_FLAG_SINGLE_LINE);
    }

    /**
+0 −5
Original line number Diff line number Diff line
@@ -1495,10 +1495,5 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
        public ActionHandler getActionHandler() {
            return mActions;
        }

        @Override
        public String getCallingAppName() {
            return Shared.getCallingAppName(mActivity);
        }
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ public abstract class DocumentsAdapter extends RecyclerView.Adapter<DocumentHold
        boolean isInSearchMode();
        boolean isSelected(String id);
        Model getModel();
        String getCallingAppName();
        boolean isDocumentEnabled(String mimeType, int flags);
        void initDocumentHolder(DocumentHolder holder);
        void onBindDocumentHolder(DocumentHolder holder, Cursor cursor);
+0 −5
Original line number Diff line number Diff line
@@ -88,9 +88,4 @@ public final class TestEnvironment implements DocumentsAdapter.Environment {
    @Override
    public void onBindDocumentHolder(DocumentHolder holder, Cursor cursor) {
    }

    @Override
    public String getCallingAppName() {
        return "unknown";
    }
}
Loading