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

Commit 6dd3edd3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I13f25b3f,Ic065b351,I6870f26b into main

* changes:
  Lint: enforce as error
  Properly inject mediaPlayerList in test
  Properly escape % in xml
parents dc7cc04d 0e257142
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -293,15 +293,44 @@ android_app {
    javacflags: ["-Aroom.schemaLocation=packages/modules/Bluetooth/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/schemas"],

    lint: {
        // TODO(b/318814235): Add back ObsoleteSdkInt to this list.
        error_checks: [
            "Autofill",
            "DefaultLocale",
            "DuplicateDefinition",
            // "ExportedContentProvider", // TODO: b/289445022 - enable this check
            // "ExportedReceiver", // TODO: b/289445022 - enable this check
            // "ExportedService", // TODO: b/289445022 - enable this check
            "ExtraText",
            "ExtraTranslation",
            "GestureBackNavigation",
            "GuardedLogInvocation",
            "HandlerLeak",
            "InflateParams",
            // "InvalidPermission", // TODO: b/289445022 - enable this check
            "LabelFor",
            "MissingClass",
            // "MissingVersion", // TODO: b/289445022 - enable this check
            "MonochromeLauncherIcon",
            "NewApi",
            "ObsoleteSdkInt",
            // "QueryAllPackagesPermission", // TODO: b/289445022 - enable this check
            "Recycle",
            "RtlHardcoded",
            "RtlSymmetry",
            "ScrollViewSize",
            "SetTextI18n",
            "SimpleDateFormat",
            "StaticFieldLeak",
            "StringFormatCount",
            "StringFormatInvalid",
            "TextFields",
            "TypographyEllipsis",
            "UseSparseArrays",
            "UseValueOf",
            "VectorPath",
            "VisibleForTests",
            "Wakelock",
            "WakelockTimeout",
        ],
        extra_check_modules: ["BluetoothLintChecker"],
        baseline_filename: "lint-baseline.xml",
+2854 −4122

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@
    <!-- label for the notification item of sent file -->
    <string name="notification_sent">Bluetooth share: Sent <xliff:g id="file">%1$s</xliff:g></string>
    <!-- label for the notification item of sent file -status -->
    <string name="notification_sent_complete">100% complete</string>
    <string name="notification_sent_complete">100%% complete</string>
    <!-- label for the notification item of failed sending file -->
    <string name="notification_sent_fail">Bluetooth share: File <xliff:g id="file">%1$s</xliff:g> not sent</string>

+5 −11
Original line number Diff line number Diff line
@@ -87,12 +87,6 @@ public class MediaControlProfile implements MediaControlServiceCallbacks {

    private MediaPlayerWrapper mLastActivePlayer = null;

    static MediaPlayerList sMediaPlayerListForTesting = null;

    static void setsMediaPlayerListForTesting(MediaPlayerList mediaPlayerList) {
        sMediaPlayerListForTesting = mediaPlayerList;
    }

    // Same base feature set as the player item features defined in `avrcp/get_foder_items.cc`
    private static final long BASE_PLAYER_ACTION_SET =
            PlaybackState.ACTION_PLAY
@@ -281,16 +275,16 @@ public class MediaControlProfile implements MediaControlServiceCallbacks {
    }

    public MediaControlProfile(@NonNull McpService mcpService) {
        this(mcpService, new MediaPlayerList(Looper.myLooper(), mcpService));
    }

    public MediaControlProfile(@NonNull McpService mcpService, MediaPlayerList mediaPlayerList) {
        Log.v(TAG, "Creating Generic Media Control Service");

        mMcpService = requireNonNull(mcpService);
        mContext = mcpService;

        if (sMediaPlayerListForTesting != null) {
            mMediaPlayerList = sMediaPlayerListForTesting;
        } else {
            mMediaPlayerList = new MediaPlayerList(Looper.myLooper(), mContext);
        }
        mMediaPlayerList = requireNonNull(mediaPlayerList);
    }

    @Override
+1 −2
Original line number Diff line number Diff line
@@ -112,8 +112,7 @@ public class MediaControlProfileTest {
                .when(mMockPackageManager)
                .getApplicationInfo(anyString(), anyInt());

        MediaControlProfile.setsMediaPlayerListForTesting(mMockMediaPlayerList);
        mMediaControlProfile = new MediaControlProfile(mMockMcpService);
        mMediaControlProfile = new MediaControlProfile(mMockMcpService, mMockMediaPlayerList);

        // this is equivalent of what usually happens inside init class
        mMediaControlProfile.injectGattServiceForTesting(packageName, mMockGMcsService);