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

Commit 4c2c97d3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean hidden api - getSystemService" into sc-dev-plus-aosp

parents 6b0c8385 d2d0000f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -626,7 +626,7 @@ public final class Utils {
        // Use the Bluetooth process identity when making call to get parent user
        final long ident = Binder.clearCallingIdentity();
        try {
            UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
            UserManager um = context.getSystemService(UserManager.class);
            UserHandle uh = um.getProfileParent(callingUser);
            int parentUser = (uh != null) ? uh.getIdentifier() : UserHandle.USER_NULL;

+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class A2dpCodecConfig {
        mA2dpNativeInterface = a2dpNativeInterface;
        mCodecConfigPriorities = assignCodecConfigPriorities();

        AudioManager audioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
        AudioManager audioManager = mContext.getSystemService(AudioManager.class);
        if (audioManager == null) {
          Log.w(TAG, "Can't obtain the codec offloading prefernece from null AudioManager");
          return;
+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ public class A2dpService extends ProfileService {
                "A2dpNativeInterface cannot be null when A2dpService starts");
        mDatabaseManager = Objects.requireNonNull(mAdapterService.getDatabase(),
                "DatabaseManager cannot be null when A2dpService starts");
        mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
        mAudioManager = getSystemService(AudioManager.class);
        Objects.requireNonNull(mAudioManager,
                               "AudioManager cannot be null when A2dpService starts");

+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.bluetooth.a2dpsink;

import android.annotation.RequiresPermission;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHeadsetClientCall;
import android.content.Context;
@@ -115,7 +114,7 @@ public class A2dpSinkStreamHandler extends Handler {
    public A2dpSinkStreamHandler(A2dpSinkService a2dpSinkService, Context context) {
        mA2dpSinkService = a2dpSinkService;
        mContext = context;
        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        mAudioManager = context.getSystemService(AudioManager.class);
    }

    /**
+2 −3
Original line number Diff line number Diff line
@@ -136,11 +136,10 @@ public class MediaPlayerList {
        pkgFilter.addDataScheme(PACKAGE_SCHEME);
        context.registerReceiver(mPackageChangedBroadcastReceiver, pkgFilter);

        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        mAudioManager = context.getSystemService(AudioManager.class);
        mAudioManager.registerAudioPlaybackCallback(mAudioPlaybackCallback, new Handler(mLooper));

        mMediaSessionManager =
                (MediaSessionManager) context.getSystemService(Context.MEDIA_SESSION_SERVICE);
        mMediaSessionManager = context.getSystemService(MediaSessionManager.class);
        mMediaSessionManager.addOnActiveSessionsChangedListener(
                mActiveSessionsChangedListener, null, new Handler(looper));
        mMediaSessionManager.addOnMediaKeyEventSessionChangedListener(
Loading