Merge "Convert Privacy Types to use PermissionGroup icons" into qt-dev
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index e9ce6ac..94b5da6b 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -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>
diff --git a/packages/SystemUI/res/layout/ongoing_privacy_chip.xml b/packages/SystemUI/res/layout/ongoing_privacy_chip.xml
index b16e062..49c16be 100644
--- a/packages/SystemUI/res/layout/ongoing_privacy_chip.xml
+++ b/packages/SystemUI/res/layout/ongoing_privacy_chip.xml
@@ -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>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 74924fb..bfdb218 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -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>
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt b/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt
index 23742c0..a5a915b 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt
+++ b/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt
@@ -16,13 +16,12 @@
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 @@
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 @@
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(
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItem.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItem.kt
index 3f581c4d..2909424 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItem.kt
+++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItem.kt
@@ -24,10 +24,14 @@
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)