Merge "Convert Privacy Types to use PermissionGroup icons" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5a8b95c3c0
@@ -3751,4 +3751,9 @@
|
||||
<!-- For DropBox -->
|
||||
<java-symbol type="integer" name="config_dropboxLowPriorityBroadcastRateLimitPeriod" />
|
||||
<java-symbol type="array" name="config_dropboxLowPriorityTags" />
|
||||
|
||||
<!-- For Privacy Type -->
|
||||
<java-symbol type="drawable" name="perm_group_camera" />
|
||||
<java-symbol type="drawable" name="perm_group_location" />
|
||||
<java-symbol type="drawable" name="perm_group_microphone" />
|
||||
</resources>
|
||||
|
||||
@@ -23,21 +23,20 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginLeft="@dimen/ongoing_appops_chip_margin"
|
||||
android:layout_marginRight="@dimen/ongoing_appops_chip_margin"
|
||||
android:layout_gravity="center_vertical|start"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:focusable="true">
|
||||
android:focusable="true" >
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/background"
|
||||
android:layout_height="@dimen/ongoing_appops_chip_height"
|
||||
android:layout_width="wrap_content"
|
||||
>
|
||||
android:minWidth="48dp"
|
||||
android:layout_width="wrap_content" >
|
||||
<LinearLayout
|
||||
android:id="@+id/icons_container"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -1044,7 +1044,7 @@
|
||||
<!-- Margin between icons of Ongoing App Ops chip when QS-->
|
||||
<dimen name="ongoing_appops_chip_icon_margin_expanded">2dp</dimen>
|
||||
<!-- Icon size of Ongoing App Ops chip -->
|
||||
<dimen name="ongoing_appops_chip_icon_size">@*android:dimen/status_bar_icon_size</dimen>
|
||||
<dimen name="ongoing_appops_chip_icon_size">@dimen/status_bar_icon_drawing_size</dimen>
|
||||
<!-- Radius of Ongoing App Ops chip corners -->
|
||||
<dimen name="ongoing_appops_chip_bg_corner_radius">16dp</dimen>
|
||||
|
||||
|
||||
@@ -16,13 +16,12 @@ package com.android.systemui.privacy
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import com.android.systemui.Dependency
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.statusbar.policy.KeyguardMonitor
|
||||
|
||||
class OngoingPrivacyChip @JvmOverloads constructor(
|
||||
context: Context,
|
||||
@@ -51,8 +50,7 @@ class OngoingPrivacyChip @JvmOverloads constructor(
|
||||
updateView()
|
||||
}
|
||||
}
|
||||
@Suppress("DEPRECATION")
|
||||
private val keyguardMonitor = Dependency.get(KeyguardMonitor::class.java)
|
||||
|
||||
var builder = PrivacyDialogBuilder(context, emptyList<PrivacyItem>())
|
||||
var privacyList = emptyList<PrivacyItem>()
|
||||
set(value) {
|
||||
@@ -94,14 +92,16 @@ class OngoingPrivacyChip @JvmOverloads constructor(
|
||||
if (!privacyList.isEmpty()) {
|
||||
generateContentDescription()
|
||||
setIcons(builder, iconsContainer)
|
||||
val lp = iconsContainer.layoutParams as FrameLayout.LayoutParams
|
||||
lp.gravity = Gravity.CENTER_VERTICAL or
|
||||
(if (expanded) Gravity.CENTER_HORIZONTAL else Gravity.END)
|
||||
iconsContainer.layoutParams = lp
|
||||
} else {
|
||||
iconsContainer.removeAllViews()
|
||||
}
|
||||
requestLayout()
|
||||
}
|
||||
|
||||
private fun amISecure() = keyguardMonitor.isShowing && keyguardMonitor.isSecure
|
||||
|
||||
private fun generateContentDescription() {
|
||||
val typesText = builder.joinTypes()
|
||||
contentDescription = context.getString(
|
||||
|
||||
@@ -24,10 +24,14 @@ import com.android.systemui.R
|
||||
|
||||
typealias Privacy = PrivacyType
|
||||
|
||||
enum class PrivacyType(val nameId: Int, val iconId: Int) {
|
||||
TYPE_CAMERA(R.string.privacy_type_camera, R.drawable.stat_sys_camera),
|
||||
TYPE_MICROPHONE(R.string.privacy_type_microphone, R.drawable.stat_sys_mic_none),
|
||||
TYPE_LOCATION(R.string.privacy_type_location, R.drawable.stat_sys_location);
|
||||
enum class PrivacyType(private val nameId: Int, val iconId: Int) {
|
||||
// This is uses the icons used by the corresponding permission groups in the AndroidManifest
|
||||
TYPE_CAMERA(R.string.privacy_type_camera,
|
||||
com.android.internal.R.drawable.perm_group_camera),
|
||||
TYPE_MICROPHONE(R.string.privacy_type_microphone,
|
||||
com.android.internal.R.drawable.perm_group_microphone),
|
||||
TYPE_LOCATION(R.string.privacy_type_location,
|
||||
com.android.internal.R.drawable.perm_group_location);
|
||||
|
||||
fun getName(context: Context) = context.resources.getString(nameId)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user