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

Commit 035c5308 authored by Colin Cross's avatar Colin Cross Committed by Android (Google) Code Review
Browse files

Merge "Fix kotlin nullable errors in CredentialManager" into aosp-main-future

parents 80634316 b3198987
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -85,15 +85,15 @@ public class BaseDialogResult implements Parcelable {
     */
    public static final int RESULT_CODE_DATA_PARSING_FAILURE = 3;

    @NonNull
    @Nullable
    private final IBinder mRequestToken;

    public BaseDialogResult(@NonNull IBinder requestToken) {
    public BaseDialogResult(@Nullable IBinder requestToken) {
        mRequestToken = requestToken;
    }

    /** Returns the unique identifier for the request that launched the operation. */
    @NonNull
    @Nullable
    public IBinder getRequestToken() {
        return mRequestToken;
    }
@@ -101,7 +101,6 @@ public class BaseDialogResult implements Parcelable {
    protected BaseDialogResult(@NonNull Parcel in) {
        IBinder requestToken = in.readStrongBinder();
        mRequestToken = requestToken;
        AnnotationValidations.validate(NonNull.class, null, mRequestToken);
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public final class UserSelectionDialogResult extends BaseDialogResult implements
    @Nullable private ProviderPendingIntentResponse mProviderPendingIntentResponse;

    public UserSelectionDialogResult(
            @NonNull IBinder requestToken, @NonNull String providerId,
            @Nullable IBinder requestToken, @NonNull String providerId,
            @NonNull String entryKey, @NonNull String entrySubkey) {
        super(requestToken);
        mProviderId = providerId;
@@ -69,7 +69,7 @@ public final class UserSelectionDialogResult extends BaseDialogResult implements
    }

    public UserSelectionDialogResult(
            @NonNull IBinder requestToken, @NonNull String providerId,
            @Nullable IBinder requestToken, @NonNull String providerId,
            @NonNull String entryKey, @NonNull String entrySubkey,
            @Nullable ProviderPendingIntentResponse providerPendingIntentResponse) {
        super(requestToken);
+11 −8
Original line number Diff line number Diff line
@@ -68,11 +68,12 @@ fun getAppLabel(
): String? {
    return try {
        val pkgInfo = pm.getPackageInfo(appPackageName, PackageManager.PackageInfoFlags.of(0))
        pkgInfo.applicationInfo.loadSafeLabel(
        val applicationInfo = checkNotNull(pkgInfo.applicationInfo)
        applicationInfo.loadSafeLabel(
            pm, 0f,
            TextUtils.SAFE_STRING_FLAG_FIRST_LINE or TextUtils.SAFE_STRING_FLAG_TRIM
        ).toString()
    } catch (e: PackageManager.NameNotFoundException) {
    } catch (e: Exception) {
        Log.e(Constants.LOG_TAG, "Caller app not found", e)
        null
    }
@@ -93,13 +94,14 @@ private fun getServiceLabelAndIcon(
                providerFlattenedComponentName,
                PackageManager.PackageInfoFlags.of(0)
            )
            val applicationInfo = checkNotNull(pkgInfo.applicationInfo)
            providerLabel =
                pkgInfo.applicationInfo.loadSafeLabel(
                applicationInfo.loadSafeLabel(
                    pm, 0f,
                    TextUtils.SAFE_STRING_FLAG_FIRST_LINE or TextUtils.SAFE_STRING_FLAG_TRIM
                ).toString()
            providerIcon = pkgInfo.applicationInfo.loadIcon(pm)
        } catch (e: PackageManager.NameNotFoundException) {
            providerIcon = applicationInfo.loadIcon(pm)
        } catch (e: Exception) {
            Log.e(Constants.LOG_TAG, "Provider package info not found", e)
        }
    } else {
@@ -119,13 +121,14 @@ private fun getServiceLabelAndIcon(
                    component.packageName,
                    PackageManager.PackageInfoFlags.of(0)
                )
                val applicationInfo = checkNotNull(pkgInfo.applicationInfo)
                providerLabel =
                    pkgInfo.applicationInfo.loadSafeLabel(
                    applicationInfo.loadSafeLabel(
                        pm, 0f,
                        TextUtils.SAFE_STRING_FLAG_FIRST_LINE or TextUtils.SAFE_STRING_FLAG_TRIM
                    ).toString()
                providerIcon = pkgInfo.applicationInfo.loadIcon(pm)
            } catch (e: PackageManager.NameNotFoundException) {
                providerIcon = applicationInfo.loadIcon(pm)
            } catch (e: Exception) {
                Log.e(Constants.LOG_TAG, "Provider package info not found", e)
            }
        }