Exploit database

GH-50afc00e93ad474caf20584d2a24a90f

trinadh465/frameworks_base_aosp_10_r33_cve-2022-20338

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2022-20338

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files85Next files →

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

core/java/com/android/internal/widget/EmphasizedNotificationButton.java

Java · 2,926 bytes
/*
 * Copyright (C) 2018 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.internal.widget;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.DrawableWrapper;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.RippleDrawable;
import android.util.AttributeSet;
import android.view.RemotableViewMethod;
import android.widget.Button;
import android.widget.RemoteViews;

/**
 * A button implementation for the emphasized notification style.
 *
 * @hide
 */
@RemoteViews.RemoteView
public class EmphasizedNotificationButton extends Button {
    private final RippleDrawable mRipple;
    private final int mStrokeWidth;
    private final int mStrokeColor;

    public EmphasizedNotificationButton(Context context) {
        this(context, null);
    }

    public EmphasizedNotificationButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public EmphasizedNotificationButton(Context context, AttributeSet attrs, int defStyleAttr) {
        this(context, attrs, defStyleAttr, 0);
    }

    public EmphasizedNotificationButton(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        DrawableWrapper background = (DrawableWrapper) getBackground().mutate();
        mRipple = (RippleDrawable) background.getDrawable();
        mStrokeWidth = getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.emphasized_button_stroke_width);
        mStrokeColor = getContext().getColor(com.android.internal.R.color.material_grey_300);
        mRipple.mutate();
    }

    @RemotableViewMethod
    public void setRippleColor(ColorStateList color) {
        mRipple.setColor(color);
        invalidate();
    }

    @RemotableViewMethod
    public void setButtonBackground(ColorStateList color) {
        GradientDrawable inner = (GradientDrawable) mRipple.getDrawable(0);
        inner.setColor(color);
        invalidate();
    }

    @RemotableViewMethod
    public void setHasStroke(boolean hasStroke) {
        GradientDrawable inner = (GradientDrawable) mRipple.getDrawable(0);
        inner.setStroke(hasStroke ? mStrokeWidth : 0, mStrokeColor);
        invalidate();
    }
}