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

Commit ee00a4cd authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7787524 from f48db4d6 to sc-qpr1-d-release

Change-Id: I94a818dc9fab14a98f4bb58f528fd5333164c35a
parents cea68f0c f48db4d6
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -9733,6 +9733,27 @@ public class DevicePolicyManager {
        return null;
    }
    /**
     * @param userId      The user for whom to retrieve information.
     * @param restriction The restriction enforced by admin. It could be any user restriction or
     *                    policy like {@link DevicePolicyManager#POLICY_DISABLE_CAMERA} and
     *                    {@link DevicePolicyManager#POLICY_DISABLE_SCREEN_CAPTURE}.
     * @return Details of admin and user which enforced the restriction for the userId. If
     * restriction is null, profile owner for the user or device owner info is returned.
     * @hide
     */
    public @Nullable Bundle getEnforcingAdminAndUserDetails(int userId,
            @Nullable String restriction) {
        if (mService != null) {
            try {
                return mService.getEnforcingAdminAndUserDetails(userId, restriction);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }
        return null;
    }
    /**
     * Hide or unhide packages. When a package is hidden it is unavailable for use, but the data and
     * actual package file remain. This function can be called by a device owner, profile owner, or
+1 −0
Original line number Diff line number Diff line
@@ -251,6 +251,7 @@ interface IDevicePolicyManager {
    boolean isNotificationListenerServicePermitted(in String packageName, int userId);

    Intent createAdminSupportIntent(in String restriction);
    Bundle getEnforcingAdminAndUserDetails(int userId,String restriction);
    boolean setApplicationHidden(in ComponentName admin, in String callerPackage, in String packageName, boolean hidden, boolean parent);
    boolean isApplicationHidden(in ComponentName admin, in String callerPackage, in String packageName, boolean parent);

+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@
    <!-- How much we expand the touchable region of the status bar below the notch to catch touches
         that just start below the notch. -->
    <dimen name="display_cutout_touchable_region_size">12dp</dimen>
    <!-- The default margin used in immersive mode to capture the start of a swipe gesture from the
         edge of the screen to show the system bars. -->
    <dimen name="system_gestures_start_threshold">24dp</dimen>

    <!-- Height of the bottom navigation bar frame; this is different than navigation_bar_height
         where that is the height reported to all the other windows to resize themselves around the
+1 −0
Original line number Diff line number Diff line
@@ -1743,6 +1743,7 @@
  <java-symbol type="dimen" name="navigation_bar_width_car_mode" />
  <java-symbol type="dimen" name="status_bar_height" />
  <java-symbol type="dimen" name="display_cutout_touchable_region_size" />
  <java-symbol type="dimen" name="system_gestures_start_threshold" />
  <java-symbol type="dimen" name="quick_qs_offset_height" />
  <java-symbol type="drawable" name="ic_jog_dial_sound_off" />
  <java-symbol type="drawable" name="ic_jog_dial_sound_on" />
+74 −0
Original line number Diff line number Diff line
package com.android.systemui.sensorprivacy

import android.content.Context
import android.content.DialogInterface
import android.content.res.Resources
import android.text.Html
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import com.android.internal.widget.DialogTitle
import com.android.systemui.R
import com.android.systemui.statusbar.phone.SystemUIDialog

class SensorUseDialog(
    context: Context,
    val sensor: Int,
    val clickListener: DialogInterface.OnClickListener
) : SystemUIDialog(context) {

    // TODO move to onCreate (b/200815309)
    init {
        window!!.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED)
        window!!.addSystemFlags(
                WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS)

        val layoutInflater = LayoutInflater.from(context)
        val customTitleView = layoutInflater.inflate(R.layout.sensor_use_started_title, null)
        customTitleView.requireViewById<DialogTitle>(R.id.sensor_use_started_title_message)
                .setText(when (sensor) {
                    SensorUseStartedActivity.MICROPHONE ->
                        R.string.sensor_privacy_start_use_mic_dialog_title
                    SensorUseStartedActivity.CAMERA ->
                        R.string.sensor_privacy_start_use_camera_dialog_title
                    SensorUseStartedActivity.ALL_SENSORS ->
                        R.string.sensor_privacy_start_use_mic_camera_dialog_title
                    else -> Resources.ID_NULL
                })
        customTitleView.requireViewById<ImageView>(R.id.sensor_use_microphone_icon).visibility =
                if (sensor == SensorUseStartedActivity.MICROPHONE ||
                        sensor == SensorUseStartedActivity.ALL_SENSORS) {
                    View.VISIBLE
                } else {
                    View.GONE
                }
        customTitleView.requireViewById<ImageView>(R.id.sensor_use_camera_icon).visibility =
                if (sensor == SensorUseStartedActivity.CAMERA ||
                        sensor == SensorUseStartedActivity.ALL_SENSORS) {
                    View.VISIBLE
                } else {
                    View.GONE
                }

        setCustomTitle(customTitleView)
        setMessage(Html.fromHtml(context.getString(when (sensor) {
            SensorUseStartedActivity.MICROPHONE ->
                R.string.sensor_privacy_start_use_mic_dialog_content
            SensorUseStartedActivity.CAMERA ->
                R.string.sensor_privacy_start_use_camera_dialog_content
            SensorUseStartedActivity.ALL_SENSORS ->
                R.string.sensor_privacy_start_use_mic_camera_dialog_content
            else -> Resources.ID_NULL
        }), 0))

        setButton(BUTTON_POSITIVE,
                context.getString(com.android.internal.R.string
                        .sensor_privacy_start_use_dialog_turn_on_button), clickListener)
        setButton(BUTTON_NEGATIVE,
                context.getString(com.android.internal.R.string
                        .cancel), clickListener)

        setCancelable(false)
    }
}
Loading