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

Commit f7694945 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5784984 from a0c8c12d to qt-qpr1-release

Change-Id: Iaa33838c024a163dcfbdd7d119a11e29a6116be3
parents e95af557 a0c8c12d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1547,7 +1547,9 @@ public class Activity extends ContextThemeWrapper
     * had previously been frozen by {@link #onSaveInstanceState}.
     *
     * <p>This method is called between {@link #onStart} and
     * {@link #onPostCreate}.
     * {@link #onPostCreate}. This method is called only when recreating
     * an activity; the method isn't invoked if {@link #onStart} is called for
     * any other reason.</p>
     *
     * @param savedInstanceState the data most recently supplied in {@link #onSaveInstanceState}.
     *
+49 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RemoteViews;

import java.util.ArrayList;

/**
 * A TextView that can float around an image on the end.
 *
@@ -42,6 +44,7 @@ public class MediaNotificationView extends FrameLayout {
    private View mMainColumn;
    private View mMediaContent;
    private int mImagePushIn;
    private ArrayList<VisibilityChangeListener> mListeners;

    public MediaNotificationView(Context context) {
        this(context, null);
@@ -168,4 +171,50 @@ public class MediaNotificationView extends FrameLayout {
        mMainColumn = findViewById(com.android.internal.R.id.notification_main_column);
        mMediaContent = findViewById(com.android.internal.R.id.notification_media_content);
    }

    @Override
    public void onVisibilityAggregated(boolean isVisible) {
        super.onVisibilityAggregated(isVisible);
        if (mListeners != null) {
            for (int i = 0; i < mListeners.size(); i++) {
                mListeners.get(i).onAggregatedVisibilityChanged(isVisible);
            }
        }
    }

    /**
     * Add a listener to receive updates on the visibility of this view
     *
     * @param listener The listener to add.
     */
    public void addVisibilityListener(VisibilityChangeListener listener) {
        if (mListeners == null) {
            mListeners = new ArrayList<>();
        }
        if (!mListeners.contains(listener)) {
            mListeners.add(listener);
        }
    }

    /**
     * Remove the specified listener
     *
     * @param listener The listener to remove.
     */
    public void removeVisibilityListener(VisibilityChangeListener listener) {
        if (mListeners != null) {
            mListeners.remove(listener);
        }
    }

    /**
     * Interface for receiving updates when the view's visibility changes
     */
    public interface VisibilityChangeListener {
        /**
         * Method called when the visibility of this view has changed
         * @param isVisible true if the view is now visible
         */
        void onAggregatedVisibilityChanged(boolean isVisible);
    }
}
+21 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

#include <gui/IProducerListener.h>
#include <gui/Surface.h>
#include <ui/PublicFormat.h>
#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/android_view_Surface.h>
#include <android_runtime/android_hardware_HardwareBuffer.h>
@@ -401,8 +402,28 @@ static jlong ImageWriter_init(JNIEnv* env, jobject thiz, jobject weakThiz, jobje
            return 0;
        }
    } else {
        // Set consumer buffer format to user specified format
        PublicFormat publicFormat = static_cast<PublicFormat>(userFormat);
        int nativeFormat = mapPublicFormatToHalFormat(publicFormat);
        android_dataspace nativeDataspace = mapPublicFormatToHalDataspace(publicFormat);
        res = native_window_set_buffers_format(anw.get(), nativeFormat);
        if (res != OK) {
            ALOGE("%s: Unable to configure consumer native buffer format to %#x",
                    __FUNCTION__, nativeFormat);
            jniThrowRuntimeException(env, "Failed to set Surface format");
            return 0;
        }

        res = native_window_set_buffers_data_space(anw.get(), nativeDataspace);
        if (res != OK) {
            ALOGE("%s: Unable to configure consumer dataspace %#x",
                    __FUNCTION__, nativeDataspace);
            jniThrowRuntimeException(env, "Failed to set Surface dataspace");
            return 0;
        }
        surfaceFormat = userFormat;
    }

    ctx->setBufferFormat(surfaceFormat);
    env->SetIntField(thiz,
            gImageWriterClassInfo.mWriterFormat, reinterpret_cast<jint>(surfaceFormat));
+20 −5
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ public class PowerUI extends SystemUI {
    private static final int CHARGE_CYCLE_PERCENT_RESET = 45;
    private static final long SIX_HOURS_MILLIS = Duration.ofHours(6).toMillis();
    public static final int NO_ESTIMATE_AVAILABLE = -1;
    private static final String BOOT_COUNT_KEY = "boot_count";
    private static final String PREFS = "powerui_prefs";

    private final Handler mHandler = new Handler();
    @VisibleForTesting
@@ -118,7 +120,7 @@ public class PowerUI extends SystemUI {

        // Check to see if we need to let the user know that the phone previously shut down due
        // to the temperature being too high.
        showThermalShutdownDialog();
        showWarnOnThermalShutdown();

        // Register an observer to configure mEnableSkinTemperatureWarning and perform the
        // registration of skin thermal event listener upon Settings change.
@@ -542,12 +544,25 @@ public class PowerUI extends SystemUI {
        }
    }

    private void showThermalShutdownDialog() {
    private void showWarnOnThermalShutdown() {
        int bootCount = -1;
        int lastReboot = mContext.getSharedPreferences(PREFS, 0).getInt(BOOT_COUNT_KEY, -1);
        try {
            bootCount = Settings.Global.getInt(mContext.getContentResolver(),
                    Settings.Global.BOOT_COUNT);
        } catch (Settings.SettingNotFoundException e) {
            Slog.e(TAG, "Failed to read system boot count from Settings.Global.BOOT_COUNT");
        }
        // Only show the thermal shutdown warning when there is a thermal reboot.
        if (bootCount > lastReboot) {
            mContext.getSharedPreferences(PREFS, 0).edit().putInt(BOOT_COUNT_KEY,
                    bootCount).apply();
            if (mPowerManager.getLastShutdownReason()
                    == PowerManager.SHUTDOWN_REASON_THERMAL_SHUTDOWN) {
                mWarnings.showThermalShutdownWarning();
            }
        }
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.print("mLowBatteryAlertCloseLevel=");
+3 −1
Original line number Diff line number Diff line
@@ -1367,7 +1367,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        if (isChildInGroup()) {
            mTranslationWhenRemoved += getNotificationParent().getTranslationY();
        }
        mPrivateLayout.setRemoved();
        for (NotificationContentView l : mLayouts) {
            l.setRemoved();
        }
    }

    public boolean wasChildInGroupWhenRemoved() {
Loading