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

Commit f8f858e4 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Add restricted padlocks to tiles in quick settings."

parents 768464c6 1c7cda8b
Loading
Loading
Loading
Loading
+39 −2
Original line number Diff line number Diff line
@@ -190,18 +190,27 @@ public class RestrictedLockUtils {
     * Send the intent to trigger the {@link android.settings.ShowAdminSupportDetailsDialog}.
     */
    public static void sendShowAdminSupportDetailsIntent(Context context, EnforcedAdmin admin) {
        Intent intent = new Intent(Settings.ACTION_SHOW_ADMIN_SUPPORT_DETAILS);
        final Intent intent = getShowAdminSupportDetailsIntent(context, admin);
        int adminUserId = UserHandle.myUserId();
        if (admin.userId != UserHandle.USER_NULL) {
            adminUserId = admin.userId;
        }
        context.startActivityAsUser(intent, new UserHandle(adminUserId));
    }

    public static Intent getShowAdminSupportDetailsIntent(Context context, EnforcedAdmin admin) {
        final Intent intent = new Intent(Settings.ACTION_SHOW_ADMIN_SUPPORT_DETAILS);
        if (admin != null) {
            if (admin.component != null) {
                intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, admin.component);
            }
            int adminUserId = UserHandle.myUserId();
            if (admin.userId != UserHandle.USER_NULL) {
                adminUserId = admin.userId;
            }
            intent.putExtra(Intent.EXTRA_USER_ID, adminUserId);
        }
        context.startActivityAsUser(intent, new UserHandle(adminUserId));
        return intent;
    }

    public static void setTextViewPadlock(Context context,
@@ -224,6 +233,34 @@ public class RestrictedLockUtils {
            this.userId = userId;
        }

        @Override
        public boolean equals(Object object) {
            if (object == this) return true;
            if (!(object instanceof EnforcedAdmin)) return false;
            EnforcedAdmin other = (EnforcedAdmin) object;
            if (userId != other.userId) {
                return false;
            }
            if ((component == null && other == null) ||
                    (component != null && component.equals(other))) {
                return true;
            }
            return false;
        }

        @Override
        public String toString() {
            return "EnforcedAdmin{component=" + component + ",userId=" + userId + "}";
        }

        public void copyTo(EnforcedAdmin other) {
            if (other == null) {
                other = new EnforcedAdmin();
            }
            other.component = component;
            other.userId = userId;
        }

        public EnforcedAdmin() {}
    }
}
 No newline at end of file
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (C) 2015 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
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:color="@color/qs_tile_disabled_color" />
    <item android:color="#B3FFFFFF" /> <!-- 70% white -->
</selector>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -18,5 +18,6 @@

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_activated="true" android:color="@color/current_user_border_color" />
    <item android:state_enabled="false" android:color="@color/qs_tile_disabled_color" />
    <item android:color="#66ffffff" /> <!-- 40% white -->
</selector>
 No newline at end of file
+41 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016 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.
-->
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
     <TextView android:id="@+id/tile_label"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textColor="@color/qs_tile_text"
             android:gravity="center_horizontal"
             android:minLines="2"
             android:padding="0dp"
             android:fontFamily="sans-serif-condensed"
             android:textStyle="normal"
             android:textSize="@dimen/qs_tile_text_size"
             android:clickable="false" />
     <ImageView android:id="@+id/restricted_padlock"
             android:layout_width="@dimen/qs_tile_text_size"
             android:layout_height="@dimen/qs_tile_text_size"
             android:src="@drawable/ic_settings_lock_outline"
             android:layout_marginLeft="@dimen/restricted_padlock_pading"
             android:baselineAlignBottom="true"
             android:scaleType="centerInside"
             android:visibility="gone" />
</LinearLayout>
 No newline at end of file
+19 −6
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@
            systemui:framePadding="6dp"
            systemui:activeFrameColor="@color/current_user_border_color"/>

    <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
        <TextView
                android:id="@+id/user_name"
                android:layout_width="wrap_content"
@@ -47,5 +50,15 @@
                android:textSize="@dimen/qs_detail_item_secondary_text_size"
                android:textColor="@color/qs_user_detail_name"
                android:gravity="center_horizontal" />
        <ImageView
                android:id="@+id/restricted_padlock"
                android:layout_width="@dimen/qs_detail_item_secondary_text_size"
                android:layout_height="@dimen/qs_detail_item_secondary_text_size"
                android:src="@drawable/ic_settings_lock_outline"
                android:layout_marginLeft="@dimen/restricted_padlock_pading"
                android:baselineAlignBottom="true"
                android:scaleType="centerInside"
                android:visibility="gone" />
    </LinearLayout>

</com.android.systemui.qs.tiles.UserDetailItemView>
 No newline at end of file
Loading