<activity android:name="ChooseLockPassword" android:exported="false"
android:windowSoftInputMode="stateVisible|adjustResize"/>
+ <activity android:name=".EncryptionInterstitial"/>
+
<!-- Runs in the phone process since it needs access to the Phone object -->
<activity android:name=".deviceinfo.Status"
android:label="@string/device_status_activity_title"
--- /dev/null
+<!--
+Copyright (C) 2014 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.
+-->
+<!-- shrink ic_audio_alarm from 32dp to 24dp using insets -->
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@*android:drawable/ic_audio_alarm"
+ android:inset="4dp"
+ />
--- /dev/null
+<!--
+Copyright (C) 2014 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.
+-->
+<!-- shrink ic_audio_vol from 32dp to 24dp using insets -->
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@*android:drawable/ic_audio_vol"
+ android:inset="4dp"
+ />
<!-- shrink ic_audio_ring_notif from 32dp to 24dp using insets -->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@*android:drawable/ic_audio_ring_notif"
- android:insetLeft="4dp"
- android:insetRight="4dp"
- android:insetTop="4dp"
- android:insetBottom="4dp"
+ android:inset="4dp"
/>
<!-- shrink ic_audio_ring_notif_mute from 32dp to 24dp using insets -->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@*android:drawable/ic_audio_ring_notif_mute"
- android:insetLeft="4dp"
- android:insetRight="4dp"
- android:insetTop="4dp"
- android:insetBottom="4dp"
+ android:inset="4dp"
/>
<!-- shrink ic_audio_ring_notif_vibrate from 32dp to 24dp using insets -->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@*android:drawable/ic_audio_ring_notif_vibrate"
- android:insetLeft="4dp"
- android:insetRight="4dp"
- android:insetTop="4dp"
- android:insetBottom="4dp"
+ android:inset="4dp"
/>
android:layout_marginBottom="10dip"
android:gravity="start"
android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textAppearance="?android:attr/textAppearanceMedium"
/>
<!-- Password entry field -->
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:lines="2"
- android:textAppearance="?android:attr/textAppearanceLarge"/>
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
<!-- spacer above text entry field -->
<View
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:lines="2"
- android:textAppearance="?android:attr/textAppearanceLarge"/>
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
<!-- Password entry field -->
<EditText android:id="@+id/password_entry"
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2014 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:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingStart="@dimen/settings_side_margin"
+ android:paddingEnd="@dimen/settings_side_margin">
+
+ <TextView
+ android:id="@+id/encryption_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
+ android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <RadioGroup
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
+ android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:checkedButton="@+id/encrypt_require_password">
+
+ <RadioButton
+ android:id="@+id/encrypt_require_password"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp" />
+
+ <RadioButton
+ android:id="@+id/encrypt_dont_require_password"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp" />
+
+ </RadioGroup>
+
+</LinearLayout>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent" >
+ android:layout_height="match_parent"
+ android:paddingStart="24dp"
+ android:paddingTop="16dp"
+ android:paddingEnd="24dp">
<GridView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:columnWidth="112dp"
+ android:horizontalSpacing="16dp"
+ android:verticalSpacing="16dp"
android:numColumns="auto_fit"
+ android:columnWidth="96dp"
android:scrollbarStyle="insideOverlay"
- android:stretchMode="spacingWidthUniform" />
+ android:stretchMode="columnWidth" />
<!-- HACK: Setting minHeight has no effect within a dialog layout,
so this view keeps the minimum height above 300dp. -->
android:layout_height="match_parent"
android:orientation="vertical">
- <FrameLayout android:id="@+id/pinned_header"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:visibility="gone" />
-
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:background="@drawable/default_preference_background">
+ <FrameLayout android:id="@+id/pinned_header"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
- <FrameLayout android:id="@+id/pinned_header"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:visibility="gone" />
-
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:includeFontPadding="false"
android:textSize="18sp"
android:text="@string/master_clear_desc" />
<TextView android:id="@+id/also_erases_external"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:includeFontPadding="false"
android:visibility="gone"
android:textSize="18sp"
android:text="@string/master_clear_desc_also_erases_external" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/sim_dialog_margin_top"
+ android:paddingStart="@dimen/sim_label_padding"
android:text="@string/sim_editor_name"
style="?android:attr/textAppearanceMedium" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
+ android:layout_marginStart="@dimen/sim_content_padding"
android:paddingBottom="@dimen/sim_dialog_margin_bottom"
android:hint="@string/wifi_ssid_hint"
android:inputType="textNoSuggestions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/sim_dialog_margin_top"
+ android:paddingStart="@dimen/sim_label_padding"
android:text="@string/sim_editor_carrier" />
<TextView android:id="@+id/carrier"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingStart="@dimen/sim_label_padding"
android:paddingBottom="@dimen/sim_dialog_margin_bottom"
android:singleLine="true"
style="?android:attr/textAppearanceMedium" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/sim_dialog_margin_top"
+ android:paddingStart="@dimen/sim_label_padding"
android:text="@string/sim_editor_number" />
<TextView android:id="@+id/number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/sim_dialog_margin_bottom"
+ android:paddingStart="@dimen/sim_label_padding"
android:singleLine="true"
android:textColor="@android:color/black"
style="?android:attr/textAppearanceMedium" />
</LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/sim_dialog_margin_top"
- android:text="@string/sim_editor_num_format" />
-
- <Spinner android:id="@+id/display_numbers"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:entries="@array/sim_card_data_range"
- android:paddingBottom="@dimen/sim_dialog_margin_bottom"
- android:prompt="@string/sim_editor_num_format" />
-
- </LinearLayout>
-
</LinearLayout>
</ScrollView>
limitations under the License.
-->
-<!-- Layout used by SyncStateCheckBoxPreference. This is inflated
+<!-- Layout used by SyncStateSwitchPreference. This is inflated
inside android.R.layout.preference. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_marginEnd="8dip"
android:contentDescription="@string/sync_active" />
- <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@android:id/checkbox"
+ <Switch xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@*android:id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:gravity="center"
- android:orientation="vertical"
- android:paddingLeft="4dp"
- android:paddingRight="4dp"
- android:paddingTop="16dp" >
+ android:minWidth="96dp"
+ android:orientation="vertical">
<FrameLayout
- android:layout_width="96dp"
+ android:layout_width="match_parent"
android:layout_height="96dp"
android:background="@drawable/transparency_tileable" >
android:text="@string/captioning_preview_characters" />
</FrameLayout>
+ <!-- HACK: GridView doesn't perform layout properly in this configuration,
+ so we need to manually set the height to roughly two scaled lines. -->
<TextView
android:id="@+id/summary"
- android:layout_width="96dp"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:gravity="center" />
+ android:ellipsize="end"
+ android:maxLines="2"
+ android:minLines="2"
+ android:gravity="top|center_horizontal"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1" />
</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<!-- Layout of a single item in the InCallUI Account Chooser Dialog. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="4dp" >
+
+ <ImageView android:id="@+id/icon"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:scaleType="center" />
+
+ <TextView android:id="@+id/text"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:gravity="start|center_vertical"
+ android:layout_marginLeft="8dp"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="match_parent" />
+</LinearLayout>
android:id="@+id/profile_spinner"
android:layout_width="wrap_content"
android:layout_height="@dimen/user_spinner_height"
- android:dropDownVerticalOffset="@dimen/user_spinner_offset"
- android:dropDownHorizontalOffset="@dimen/user_spinner_offset"
+ android:overlapAnchor="true"
android:paddingBottom="@dimen/user_spinner_padding"
android:paddingTop="@dimen/user_spinner_padding"
android:paddingLeft="@dimen/user_spinner_padding" />
</RelativeLayout>
- <!-- checkbox is invisible and not gone so that the height is consistent between tabs -->
- <CheckBox
+ <!-- Switch is invisible and not gone so that the height is consistent between tabs -->
+ <Switch
android:id="@+id/trusted_credential_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="300sp"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:fadeScrollbars="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="8dip"
android:orientation="vertical">
<LinearLayout android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item"
android:orientation="vertical" />
<LinearLayout android:id="@+id/type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item"
android:orientation="vertical"
android:visibility="gone">
<TextView
- style="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item_label"
android:layout_marginTop="8dip"
android:text="@string/wifi_ssid" />
<EditText android:id="@+id/ssid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item_edit_content"
android:singleLine="true"
android:hint="@string/wifi_ssid_hint"
android:inputType="textNoSuggestions"
android:maxLength="32" />
<TextView
- style="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item_label"
android:layout_marginTop="8dip"
android:text="@string/wifi_security" />
<Spinner android:id="@+id/security"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item_content"
android:prompt="@string/wifi_security"
android:entries="@array/wifi_ap_security" />
</LinearLayout>
<LinearLayout android:id="@+id/fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item"
android:orientation="vertical"
android:visibility="gone">
<TextView
- style="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="4dip"
+ style="@style/wifi_item_label"
+ android:layout_marginTop="8dip"
android:text="@string/wifi_password" />
<EditText android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item_edit_content"
android:singleLine="true"
android:password="true"
android:maxLength="63"
android:imeOptions="flagForceAscii" />
<TextView android:id="@+id/hint"
- style="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textSize="12sp"
+ style="@style/wifi_item_label"
android:text="@string/credentials_password_too_short"
+ android:layout_marginTop="8dip"
android:layout_marginBottom="10sp"/>
<CheckBox android:id="@+id/show_password"
- style="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/wifi_item_content"
android:text="@string/wifi_show_password" />
</LinearLayout>
</LinearLayout>
android:paddingBottom="8dip">
<LinearLayout android:id="@+id/info"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_section" />
<LinearLayout android:id="@+id/type"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_section"
android:visibility="gone">
<LinearLayout
- style="@style/wifi_item" >
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_ssid"
android:textDirection="locale" />
<EditText android:id="@+id/ssid"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:hint="@string/wifi_ssid_hint"
android:maxLength="32"
android:inputType="textNoSuggestions" />
</LinearLayout>
- <LinearLayout
- style="@style/wifi_item" >
- <TextView
- style="@style/wifi_item_label"
- android:text="@string/wifi_security" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item" >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item_label"
+ android:text="@string/wifi_security" />
- <Spinner android:id="@+id/security"
- style="@style/wifi_item_content"
- android:prompt="@string/wifi_security"
- android:entries="@array/wifi_security" />
- </LinearLayout>
+ <Spinner android:id="@+id/security"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item_content"
+ android:prompt="@string/wifi_security"
+ android:entries="@array/wifi_security" />
+ </LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/security_fields"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_section"
android:visibility="gone">
<LinearLayout android:id="@+id/eap"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_section"
android:visibility="gone">
<LinearLayout android:id="@+id/l_method"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:visibility="gone"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_eap_method" />
<Spinner android:id="@+id/method"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:prompt="@string/wifi_eap_method"
android:entries="@array/wifi_eap_method" />
</LinearLayout>
<LinearLayout android:id="@+id/l_phase2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:visibility="gone"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/please_select_phase2" />
<Spinner android:id="@+id/phase2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:prompt="@string/please_select_phase2"
android:entries="@array/wifi_phase2_entries" />
</LinearLayout>
<LinearLayout android:id="@+id/l_ca_cert"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:visibility="gone"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_eap_ca_cert" />
<Spinner android:id="@+id/ca_cert"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:prompt="@string/wifi_eap_ca_cert" />
</LinearLayout>
<LinearLayout android:id="@+id/l_user_cert"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:visibility="gone"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_eap_user_cert" />
<Spinner android:id="@+id/user_cert"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:prompt="@string/wifi_eap_user_cert" />
</LinearLayout>
<LinearLayout android:id="@+id/l_identity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:visibility="gone"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_eap_identity" />
<EditText android:id="@+id/identity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:singleLine="true"
android:inputType="textNoSuggestions" />
</LinearLayout>
<LinearLayout android:id="@+id/l_anonymous"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:visibility="gone"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_eap_anonymous" />
<EditText android:id="@+id/anonymous"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:singleLine="true"
android:inputType="textNoSuggestions" />
</LinearLayout>
<LinearLayout android:id="@+id/password_layout"
- style="@style/wifi_item" >
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_password" />
<EditText android:id="@+id/password"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:singleLine="true"
android:password="true" />
</LinearLayout>
<LinearLayout android:id="@+id/show_password_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item" >
<!-- Dummy to enable right-justification of checkbox -->
<TextView
- style="@style/wifi_item_label" />
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item_label" />
<CheckBox android:id="@+id/show_password"
- style="@style/wifi_item_content"
- android:textSize="14sp"
- android:text="@string/wifi_show_password" />
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item_content"
+ android:textSize="14sp"
+ android:text="@string/wifi_show_password" />
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/wifi_advanced_toggle"
- style="@style/wifi_item"
- android:visibility="gone">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item"
+ android:visibility="gone">
<CheckBox android:id="@+id/wifi_advanced_togglebox"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:textSize="14sp"
android:text="@string/wifi_show_advanced" />
android:visibility="gone">
<LinearLayout android:id="@+id/proxy_settings_fields"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item"
android:visibility="gone">
<TextView android:id="@+id/proxy_settings_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/proxy_settings_title" />
<Spinner android:id="@+id/proxy_settings"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:prompt="@string/proxy_settings_title"
android:entries="@array/wifi_proxy_settings" />
</LinearLayout>
<LinearLayout android:id="@+id/proxy_warning_limited_support"
- style="@style/wifi_item"
- android:visibility="gone">
- <!-- Dummy to enable right-justification of warning -->
- <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item"
+ android:visibility="gone">
+ <!-- Dummy to enable right-justification of warning -->
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label" />
- <TextView
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:text="@string/proxy_warning_limited_support" />
</LinearLayout>
<LinearLayout android:id="@+id/proxy_pac_field"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_section"
android:visibility="gone">
- <LinearLayout style="@style/wifi_item">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item">
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/proxy_url_title" />
<EditText android:id="@+id/proxy_pac"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:hint="@string/proxy_url_hint"
android:inputType="textNoSuggestions"
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/proxy_fields"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_section"
android:visibility="gone">
- <LinearLayout style="@style/wifi_item">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item">
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/proxy_hostname_label" />
<EditText android:id="@+id/proxy_hostname"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:hint="@string/proxy_hostname_hint"
android:inputType="textNoSuggestions"
android:singleLine="true" />
</LinearLayout>
- <LinearLayout style="@style/wifi_item">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item">
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/proxy_port_label" />
<EditText android:id="@+id/proxy_port"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:hint="@string/proxy_port_hint"
android:inputType="number"
android:singleLine="true" />
</LinearLayout>
- <LinearLayout style="@style/wifi_item">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item">
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/proxy_exclusionlist_label" />
<EditText android:id="@+id/proxy_exclusionlist"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:hint="@string/proxy_exclusionlist_hint"
android:inputType="textNoSuggestions"
</LinearLayout>
<LinearLayout android:id="@+id/ip_fields"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item"
android:visibility="gone">
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_ip_settings" />
<Spinner android:id="@+id/ip_settings"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_content"
android:prompt="@string/wifi_ip_settings"
android:entries="@array/wifi_ip_settings" />
</LinearLayout>
<LinearLayout android:id="@+id/staticip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_section"
android:visibility="gone">
<LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_ip_address" />
<EditText android:id="@+id/ipaddress"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:singleLine="true"
android:hint="@string/wifi_ip_address_hint"
</LinearLayout>
<LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_gateway" />
<EditText android:id="@+id/gateway"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:singleLine="true"
android:hint="@string/wifi_gateway_hint"
</LinearLayout>
<LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_network_prefix_length" />
<EditText android:id="@+id/network_prefix_length"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:singleLine="true"
android:hint="@string/wifi_network_prefix_length_hint"
android:inputType="number" />
</LinearLayout>
<LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_dns1" />
<EditText android:id="@+id/dns1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:singleLine="true"
android:hint="@string/wifi_dns1_hint"
</LinearLayout>
<LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item" >
<TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
android:text="@string/wifi_dns2" />
<EditText android:id="@+id/dns2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item_edit_content"
android:singleLine="true"
android:hint="@string/wifi_dns2_hint"
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
style="@style/wifi_item" >
- <TextView
+ <TextView android:id="@+id/name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
style="@style/wifi_item_label"
- android:id="@+id/name"
android:textAlignment="viewStart" />
- <TextView
- android:id="@+id/value"
- style="@style/wifi_item_content"
+ <TextView android:id="@+id/value"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/wifi_item_label"
android:textStyle="bold"
android:textAlignment="viewStart" />
</LinearLayout>
<LinearLayout android:id="@+id/password_layout"
style="@style/wifi_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:padding="8dip"
android:orientation="vertical" >
<string name="awake" msgid="387122265874485088">"وقت الوضع النشط للجهاز"</string>
<string name="wifi_on_time" msgid="3208518458663637035">"وقت تشغيل Wi-Fi"</string>
<string name="bluetooth_on_time" msgid="3056108148042308690">"وقت تشغيل Wi-Fi"</string>
- <string name="usage_name_percent" msgid="7976919382448235858">"<xliff:g id="NAME">%1$s</xliff:g> - <xliff:g id="NUMBER">%2$s</xliff:g><xliff:g id="PERCENT">%%</xliff:g>"</string>
<string name="history_details_title" msgid="3608240585315506067">"تفاصيل السجل"</string>
<string name="details_title" msgid="3792801565213935385">"تفاصيل الاستخدام"</string>
<string name="details_subtitle" msgid="32593908269911734">"استخدام التفاصيل"</string>
<string name="awake" msgid="387122265874485088">"زمان بیداری دستگاه"</string>
<string name="wifi_on_time" msgid="3208518458663637035">"Wi-Fi به موقع"</string>
<string name="bluetooth_on_time" msgid="3056108148042308690">"Wi-Fi به موقع"</string>
- <string name="usage_name_percent" msgid="7976919382448235858">"<xliff:g id="NAME">%1$s</xliff:g> - <xliff:g id="NUMBER">%2$s</xliff:g><xliff:g id="PERCENT">%%</xliff:g>"</string>
<string name="history_details_title" msgid="3608240585315506067">"جزئیات سابقه"</string>
<string name="details_title" msgid="3792801565213935385">"جزئیات استفاده"</string>
<string name="details_subtitle" msgid="32593908269911734">"جزئیات استفاده"</string>
<style name="KeyguardAppWidgetItem">
<item name="android:textSize">16sp</item>
</style>
+
+ <style name="wifi_item">
+ <item name="android:layout_marginTop">8dip</item>
+ <item name="android:layout_marginStart">8dip</item>
+ <item name="android:layout_marginEnd">8dip</item>
+ <item name="android:paddingStart">8dip</item>
+ <item name="android:paddingEnd">8dip</item>
+ <item name="android:orientation">vertical</item>
+ <item name="android:gravity">start</item>
+ </style>
+
+ <style name="wifi_item_label">
+ <item name="android:paddingStart">8dip</item>
+ <item name="android:textSize">14sp</item>
+ <item name="android:textAlignment">viewStart</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.Material.Body1</item>
+ <item name="android:textColor">@*android:color/secondary_text_default_material_light</item>
+ </style>
+
+ <style name="wifi_item_content">
+ <item name="android:textAlignment">viewStart</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.Material.Subhead</item>
+ <item name="android:textColor">@*android:color/primary_text_default_material_light</item>
+ </style>
+
+ <style name="wifi_item_edit_content">
+ <item name="android:paddingStart">4dip</item>
+ <item name="android:layout_marginStart">4dip</item>
+ <item name="android:textSize">18sp</item>
+ </style>
+
+ <style name="wifi_section">
+ <item name="android:orientation">vertical</item>
+ </style>
</resources>
<style name="KeyguardAppWidgetItem">
<item name="android:textSize">18sp</item>
</style>
+
+ <style name="wifi_item">
+ <item name="android:layout_marginTop">8dip</item>
+ <item name="android:layout_marginStart">8dip</item>
+ <item name="android:layout_marginEnd">8dip</item>
+ <item name="android:paddingStart">8dip</item>
+ <item name="android:paddingEnd">8dip</item>
+ <item name="android:orientation">vertical</item>
+ <item name="android:gravity">start</item>
+ </style>
+
+ <style name="wifi_item_label">
+ <item name="android:paddingStart">8dip</item>
+ <item name="android:textSize">14sp</item>
+ <item name="android:textAlignment">viewStart</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.Material.Body1</item>
+ <item name="android:textColor">@*android:color/secondary_text_default_material_light</item>
+ </style>
+
+ <style name="wifi_item_content">
+ <item name="android:textAlignment">viewStart</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.Material.Subhead</item>
+ <item name="android:textColor">@*android:color/primary_text_default_material_light</item>
+ </style>
+
+ <style name="wifi_item_edit_content">
+ <item name="android:paddingStart">4dip</item>
+ <item name="android:layout_marginStart">4dip</item>
+ <item name="android:textSize">18sp</item>
+ </style>
+
+ <style name="wifi_section">
+ <item name="android:orientation">vertical</item>
+ </style>
</resources>
<style name="KeyguardAppWidgetItem">
<item name="android:textSize">18sp</item>
</style>
+
+ <style name="wifi_item">
+ <item name="android:layout_marginTop">8dip</item>
+ <item name="android:layout_marginStart">8dip</item>
+ <item name="android:layout_marginEnd">8dip</item>
+ <item name="android:paddingStart">8dip</item>
+ <item name="android:paddingEnd">8dip</item>
+ <item name="android:orientation">vertical</item>
+ <item name="android:gravity">start</item>
+ </style>
+
+ <style name="wifi_item_label">
+ <item name="android:paddingStart">8dip</item>
+ <item name="android:textSize">14sp</item>
+ <item name="android:textAlignment">viewStart</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.Material.Body1</item>
+ <item name="android:textColor">@*android:color/secondary_text_default_material_light</item>
+ </style>
+
+ <style name="wifi_item_content">
+ <item name="android:textAlignment">viewStart</item>
+ <item name="android:textAppearance">@android:style/TextAppearance.Material.Subhead</item>
+ <item name="android:textColor">@*android:color/primary_text_default_material_light</item>
+ </style>
+
+ <style name="wifi_item_edit_content">
+ <item name="android:paddingStart">4dip</item>
+ <item name="android:layout_marginStart">4dip</item>
+ <item name="android:textSize">18sp</item>
+ </style>
+
+ <style name="wifi_section">
+ <item name="android:orientation">vertical</item>
+ </style>
</resources>
<item>Set usage cycle...</item>
</string-array>
- <!-- Sim Cards display numbers. Range of data usage. -->
- <string-array name="sim_card_data_range">
- <!-- Last 4 digits [CHAR LIMIT=40]-->
- <item>Last 4 digits</item>
- <!-- First 4 digits [CHAR LIMIT=40]-->
- <item>First 4 digits</item>
- </string-array>
-
<!-- Wi-Fi settings. Presented as a list dialog to the user to choose the Wi-Fi frequency band. -->
<string-array name="wifi_frequency_band_entries">
<!-- Operation on both 2.4 GHz and 5 GHz [CHAR LIMIT=25]-->
<item>Default</item>
<item>Sans-serif</item>
<item>Sans-serif condensed</item>
+ <item>Sans-serif monospace</item>
<item>Serif</item>
- <item>Monospace</item>
+ <item>Serif monospace</item>
<item>Casual</item>
<item>Cursive</item>
<item>Small capitals</item>
<item></item>
<item>sans-serif</item>
<item>sans-serif-condensed</item>
+ <item>sans-serif-monospace</item>
<item>serif</item>
- <item>monospace</item>
+ <item>serif-monospace</item>
<item>casual</item>
<item>cursive</item>
<item>sans-serif-smallcaps</item>
<item>Cached (activity client)</item>
<item>Cached (empty)</item>
</string-array>
+
+ <!-- Multi-SIM titles for captioning color preference. -->
+ <string-array name="sim_info_picker_color_titles" translatable="false" >
+ <item>@string/color_blue</item>
+ <item>@string/color_green</item>
+ <item>@string/color_purple</item>
+ <item>@string/color_red</item>
+ <item>@string/color_orange</item>
+ </string-array>
+
+ <!-- Multi-SIM colors. -->
+ <integer-array name="sim_info_picker_color_values" translatable="false" >
+ <item>@color/blue_500</item>
+ <item>@color/green_500</item>
+ <item>@color/purple_500</item>
+ <item>@color/red_500</item>
+ <item>@color/orange_500</item>
+ </integer-array>
</resources>
<color name="wifi_divider">#ffe0e0e0</color>
+ <!-- Multi-SIM colors -->
+ <color name="blue_500">#5677fc</color>
+ <color name="green_500">#259b24</color>
+ <color name="purple_500">#9c27b0</color>
+ <color name="red_500">#e51c23</color>
+ <color name="orange_500">#ff9800</color>
+
</resources>
<dimen name="sim_dialog_margin_bottom">16dip</dimen>
<!-- SIM Dialog padding -->
<dimen name="sim_dialog_padding">8dip</dimen>
+ <dimen name="sim_label_padding">16dip</dimen>
+ <dimen name="sim_content_padding">12dip</dimen>
<!-- Sim Card Name length -->
<integer name="sim_name_length">32</integer>
<!-- Height of a user icon view -->
<dimen name="user_icon_view_height">56dp</dimen>
- <!-- User spinner offset-->
- <dimen name="user_spinner_offset">-64dp</dimen>
+ <!-- User spinner -->
<dimen name="user_spinner_height">72dp</dimen>
<dimen name="user_spinner_padding">8dp</dimen>
<dimen name="user_spinner_item_height">56dp</dimen>
<!-- Text displayed when WPS fails due to another session [CHAR LIMIT=150] -->
<string name="wifi_wps_failed_overlap">Another WPS session was detected. Please try again in a few minutes.</string>
<!-- Label for the SSID of the network -->
- <string name="wifi_ssid">Network SSID</string>
+ <string name="wifi_ssid">Network name</string>
<!-- Hint for a text field to enter the SSID of a hidden wifi network. [CHAR LIMIT=35] -->
<string name="wifi_ssid_hint">Enter the SSID</string>
<!-- Label for the security of the connection -->
<string name="vibrate_in_silent_title">Vibrate when silent</string>
<!-- Sound settings screen, setting option name -->
<string name="notification_sound_title">Default notification sound</string>
- <!-- Display settings screen, notification popups are enabled [CHAR LIMIT=30] -->
- <string name="heads_up_enabled_title">Pop up if high priority</string>
<!-- Sound settings screen, the title of the volume bar to adjust the incoming call volume -->
<string name="incoming_call_volume_title">Ringtone</string>
<!-- Sound settings screen, the title of the volume bar to adjust the notification volume -->
<!-- Warning that the device data will not be encrypted with password or PIN if
enabling an accessibility service and there is a secure lock setup. [CHAR LIMIT=NONE] -->
<string name="enable_service_encryption_warning">If you turn on <xliff:g id="service"
- example="TalkBack">%1$s</xliff:g>, your data\'s encryption won\'t be as strong.</string>
+ example="TalkBack">%1$s</xliff:g>, your device won’t use your screen lock to enhance
+ data encryption.</string>
<!-- Warning that the device data will not be encrypted with password or PIN if
choosing a secure lock and there is an enabled accessibility service. [CHAR LIMIT=NONE] -->
<string name="secure_lock_encryption_warning">Because you\'ve turned on an accessibility service,
- encryption based on this type of lock won\'t be as strong.</string>
+ your device won’t use your screen lock to enhance data encryption.</string>
+
+ <!-- Message to the user to enter his pattern before enabling an accessibility service. [CHAR LIMIT=NONE] -->
+ <string name="enable_service_pattern_reason">Because turning on <xliff:g id="service"
+ example="TalkBack">%1$s</xliff:g> affects data encryption, you need to confirm your pattern.
+ </string>
+
+ <!-- Message to the user to enter his PIN before enabling an accessibility service. [CHAR LIMIT=NONE] -->
+ <string name="enable_service_pin_reason">Because turning on <xliff:g id="service"
+ example="TalkBack">%1$s</xliff:g> affects data encryption, you need to confirm your PIN.
+ </string>
+
+ <!-- Message to the user to enter his password before enabling an accessibility service. [CHAR LIMIT=NONE] -->
+ <string name="enable_service_password_reason">Because turning on <xliff:g id="service"
+ example="TalkBack">%1$s</xliff:g> affects data encryption, you need to confirm your password.
+ </string>
<!-- Title for the capability of an accessibility service to receive events and keys. -->
<string name="capability_title_receiveAccessibilityEvents">Observe your actions</string>
<!-- Display time remaining until battery is charged [CHAR_LIMIT=60] -->
<string name="power_charge_remaining"><xliff:g id="until_charged">%1$s</xliff:g> to charge</string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when discharging with duration -->
- <string name="power_discharging_duration"><xliff:g id="level">%1$d</xliff:g>%%
+ <string name="power_discharging_duration"><xliff:g id="level">%1$s</xliff:g>
- approx. <xliff:g id="time">%2$s</xliff:g> left</string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging -->
- <string name="power_charging"><xliff:g id="level">%1$d</xliff:g>%% -
+ <string name="power_charging"><xliff:g id="level">%1$s</xliff:g> -
<xliff:g id="state">%2$s</xliff:g></string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
- <string name="power_charging_duration"><xliff:g id="level">%1$d</xliff:g>%% -
+ <string name="power_charging_duration"><xliff:g id="level">%1$s</xliff:g> -
<xliff:g id="time">%2$s</xliff:g> until full</string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
- <string name="power_charging_duration_ac"><xliff:g id="level">%1$d</xliff:g>%% -
+ <string name="power_charging_duration_ac"><xliff:g id="level">%1$s</xliff:g> -
<xliff:g id="time">%2$s</xliff:g> until full on AC</string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
- <string name="power_charging_duration_usb"><xliff:g id="level">%1$d</xliff:g>%% -
+ <string name="power_charging_duration_usb"><xliff:g id="level">%1$s</xliff:g> -
<xliff:g id="time">%2$s</xliff:g> until full over USB</string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
- <string name="power_charging_duration_wireless"><xliff:g id="level">%1$d</xliff:g>%% -
+ <string name="power_charging_duration_wireless"><xliff:g id="level">%1$s</xliff:g> -
<xliff:g id="time">%2$s</xliff:g> until full from wireless</string>
<!-- [CHAR_LIMIT=40] Label for list of apps using battery in power use UI -->
<string name="power_usage_list_summary">Use since last full charge</string>
<string name="wifi_on_time">Wi\u2011Fi on time</string>
<!-- Bluetooth on time -->
<string name="bluetooth_on_time">Wi\u2011Fi on time</string>
- <!-- Application name and battery usage percentage -->
- <string name="usage_name_percent"><xliff:g id="name">%1$s</xliff:g>" - "
- <xliff:g id="number" example="30">%2$s</xliff:g><xliff:g id="percent" example="%">%%</xliff:g></string>
<!-- Activity title for battery usage history details -->
<string name="history_details_title">History details</string>
<string name="battery_saver_turn_on_automatically_never">Never</string>
<!-- [CHAR_LIMIT=40] Battery saver: Value for automatic entry option: pct% battery -->
- <string name="battery_saver_turn_on_automatically_pct">at %1$d%% battery</string>
+ <string name="battery_saver_turn_on_automatically_pct">at %1$s battery</string>
<!-- Process Stats strings -->
<skip />
<string name="show_all_anrs_summary">Show App Not Responding dialog
for background apps</string>
- <!-- UI debug setting: webview data reduction proxy [CHAR LIMIT=100] -->
- <string name="dev_settings_use_google_settings">Please use GoogleSettings app for this operation</string>
-
- <!-- UI debug setting: webview data reduction proxy [CHAR LIMIT=50] -->
- <string name="webview_data_reduction_proxy">Reduce WebView Network Usage</string>
- <!-- UI debug setting: webview data reduction proxy summary [CHAR LIMIT=200] -->
- <string name="webview_data_reduction_proxy_summary">Reduce network usage by
- proxying WebView connections through Google compression servers</string>
-
<!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
<string name="data_usage_summary_title">Data usage</string>
<!-- Activity title for Appk data usage summary. [CHAR LIMIT=25] -->
<string name="sim_cellular_data_unavailable_summary">Touch to select a data SIM</string>
<!-- Checkbox to always use for calls. [CHAR LIMIT=40] -->
<string name="sim_calls_always_use">Always use this for calls</string>
+ <!-- Message for selecting sim for data in settings. [CHAR LIMIT=40] -->
+ <string name="select_sim_for_data">Select a SIM for data</string>
+ <!-- Message for selecting sim for call in settings. [CHAR LIMIT=40] -->
+ <string name="select_sim_for_calls">Call with</string>
<!-- Title for selecting a SIM card. [CHAR LIMIT=40] -->
<string name="sim_select_card">Select a SIM card</string>
<!-- Label for a numbered SIM card. [CHAR LIMIT=40] -->
<!-- Name label of Sim Editor. [CHAR LIMIT=40] -->
<string name="sim_editor_name">SIM name</string>
<!-- Title label of Sim Editor. [CHAR LIMIT=40] -->
- <string name="sim_editor_title">SIM card</string>
+ <string name="sim_editor_title">SIM slot %1$d</string>
<!-- Carrier label of Sim Editor. [CHAR LIMIT=40] -->
<string name="sim_editor_carrier">Carrier</string>
<!-- Number label of Sim Editor. [CHAR LIMIT=40] -->
<string name="sim_editor_number">Number</string>
<!-- Color label of Sim Editor. [CHAR LIMIT=40] -->
<string name="sim_editor_color">SIM color</string>
- <!-- Display label numbers of Sim Editor. [CHAR LIMIT=40] -->
- <string name="sim_editor_num_format">Display numbers</string>
<!-- Select label Title of Sim Editor. [CHAR LIMIT=40] -->
<string name="sim_card_select_title">Select SIM card</string>
<!-- Orange label. [CHAR LIMIT=40] -->
<string name="preferred_network_offload_popup">Disabling Network Name Broadcast will prevent automatic connection to hidden networks.</string>
<!-- This is a divider in the SIM cards preferences that is the header of various settings where the user chooses which SIM to use for phone calls, data, and SMS messages [CHAR LIMIT=50] -->
- <string name="sim_pref_divider">Activities</string>
+ <string name="sim_pref_divider">Preferred SIM for</string>
<!-- When a user chooses this "Ask first" preference for the SIM to use for phone calls, they'll be prompted to choose a SIM every time they initiate a call [CHAR LIMIT=50] -->
- <string name="sim_calls_ask_first_prefs_title">Ask first</string>
+ <string name="sim_calls_ask_first_prefs_title">Ask everytime</string>
<!-- When a SIM preference hasn't been selected yet, this string is displayed as the pref summary until the user chooses a SIM subscription from the preference list [CHAR LIMIT=50] -->
<string name="sim_selection_required_pref">Selection required</string>
<!-- Sound & notification > Sound section: Title for the zen mode option. [CHAR LIMIT=60] -->
<string name="zen_mode_option_title">When calls and notifications arrive</string>
- <!-- Sound & notification > Sound section: Title for the zen mode option for devices without voice. [CHAR LIMIT=60] -->
- <string name="zen_mode_option_title_novoice">When notifications arrive</string>
-
<!-- Sound & notification > Sound section: Zen mode option: Off [CHAR LIMIT=60] -->
<string name="zen_mode_option_off">Always interrupt</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Entry conditions option: value when blank -->
<string name="zen_mode_entry_conditions_summary_none">Never</string>
- <!-- [CHAR LIMIT=20] Zen mode settings: Phone calls option -->
- <string name="zen_mode_phone_calls">Calls</string>
+ <!-- [CHAR LIMIT=20] Zen mode settings: Calls option -->
+ <string name="zen_mode_calls">Calls</string>
<!-- [CHAR LIMIT=20] Zen mode settings: Messages option -->
<string name="zen_mode_messages">Messages</string>
<!-- [CHAR LIMIT=28] Screen pinning title -->
<string name="screen_pinning_title">Screen pinning</string>
<!-- [CHAR LIMIT=300] Screen pinning description -->
- <string name="screen_pinning_description">When this setting is turned on, you can put the device in a state that keeps the current screen in view.\n\nTo pin a screen:\n\n1. Turn this setting on.\n\n2. Open an app.\n\n3. Touch the Recents button.\n\n4. Touch the pin icon.</string>
+ <string name="screen_pinning_description">When turned on, you can use screen pinning to keep the current screen in view until you unpin.\n\nTo use screen pinning:\n\n1. Make sure screen pinning is turned on.\n\n2. Open the screen you want to pin.\n\n3. Touch Overview.\n\n4. Touch the pin icon.</string>
<!-- Title for a work profile. [CHAR LIMIT=25] -->
<string name="managed_user_title">Work profile</string>
<!-- [CHAR LIMIT=70] Don't rotate when screen is turned option -->
<string name="display_auto_rotate_stay_in_current">Stay in current orientation</string>
+ <!-- Title and summary for SIM Status -->
+ <!-- Title for IMEI preference [CHAR LIMIT=30] -->
+ <string name="imei_information_title">IMEI information</string>
+ <!-- Description for IMEI preference [CHAR LIMIT=40] -->
+ <string name="imei_information_summary">IMEI relative information</string>
+
+ <!-- Encryption interstitial title [CHAR LIMIT=30] -->
+ <string name="encryption_interstitial_header">Encryption</string>
+
+ <!-- Encryption interstitial button to continue with the shown setting. Appears on screen that asks the user to opt in/out of encrypting device with a pin/pattern/password. [CHAR LIMIT=NONE] -->
+ <string name="encryption_continue_button">Continue</string>
+
+ <!-- Message shown on encryption interstitial to ask the user whether or not they want to use a PIN to encrypt the device. [CHAR LIMIT=NONE] -->
+ <string name="encryption_interstitial_message_pin">
+ You can further protect this device by requiring your PIN before it starts up. Until the device starts up, it can\'t receive calls, messages, or notifications, including alarms.
+ \n\nThis helps protect data on lost or stolen devices.
+ </string>
+ <!-- Message shown on encryption interstitial to ask the user whether or not they want to use a pattern to encrypt the device. [CHAR LIMIT=NONE] -->
+ <string name="encryption_interstitial_message_pattern">
+ You can further protect this device by requiring your pattern before it starts up. Until the device starts up, it can\'t receive calls, messages, or notifications, including alarms.
+ \n\nThis helps protect data on lost or stolen devices.
+ </string>
+ <!-- Message shown on encryption interstitial to ask the user whether or not they want to use a password to encrypt the device. [CHAR LIMIT=NONE] -->
+ <string name="encryption_interstitial_message_password">
+ You can further protect this device by requiring your password before it starts up. Until the device starts up, it can\'t receive calls, messages, or notifications, including alarms.
+ \n\nThis helps protect data on lost or stolen devices.
+ </string>
+
+ <!-- Radio button text that require a PIN to start device [CHAR LIMIT=NONE] -->
+ <string name="encrypt_require_pin">Require PIN to start device</string>
+ <!-- Radio button text that require a pattern to start device [CHAR LIMIT=NONE] -->
+ <string name="encrypt_require_pattern">Require pattern to start device</string>
+ <!-- Radio button text that require a password to start device [CHAR LIMIT=NONE] -->
+ <string name="encrypt_require_password">Require password to start device</string>
+
+ <!-- Radio button text that doesn't require a PIN to decrypt [CHAR LIMIT=NONE] -->
+ <string name="encrypt_dont_require_pin">No thanks</string>
+ <!-- Radio button text that doesn't require a pattern to decrypt [CHAR LIMIT=NONE] -->
+ <string name="encrypt_dont_require_pattern">No thanks</string>
+ <!-- Radio button text that doesn't require a password to decrypt [CHAR LIMIT=NONE] -->
+ <string name="encrypt_dont_require_password">No thanks</string>
+
+ <!-- Title for encryption dialog that disables TalkBack. [CHAR_LIMIT=25] -->
+ <string name="encrypt_talkback_dialog_require_pin">Require PIN?</string>
+
+ <!-- Title for encryption dialog that disables TalkBack. [CHAR_LIMIT=25] -->
+ <string name="encrypt_talkback_dialog_require_pattern">Require pattern?</string>
+
+ <!-- Title for encryption dialog that disables TalkBack. [CHAR_LIMIT=25] -->
+ <string name="encrypt_talkback_dialog_require_password">Require password?</string>
+
+ <!-- Message for encryption dialog telling the user that Talkback and other accessibility services will be disabled. -->
+ <string name="encrypt_talkback_dialog_message_pin">When you enter your PIN to start this device, accessibility services like <xliff:g id="service" example="TalkBack">%1$s</xliff:g> won\'t yet be available.</string>
+
+ <!-- Message for encryption dialog telling the user that Talkback and other accessibility services will be disabled. -->
+ <string name="encrypt_talkback_dialog_message_pattern">When you enter your pattern to start this device, accessibility services like <xliff:g id="service" example="TalkBack">%1$s</xliff:g> won\'t yet be available.</string>
+
+ <!-- Message for encryption dialog telling the user that Talkback and other accessibility services will be disabled. -->
+ <string name="encrypt_talkback_dialog_message_password">When you enter your password to start this device, accessibility services like <xliff:g id="service" example="TalkBack">%1$s</xliff:g> won\'t yet be available.</string>
+
</resources>
</style>
<style name="wifi_item">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">8dip</item>
<item name="android:layout_marginStart">8dip</item>
<item name="android:layout_marginEnd">8dip</item>
</style>
<style name="wifi_item_label">
- <item name="android:layout_width">wrap_content</item>
- <item name="android:layout_height">wrap_content</item>
<item name="android:paddingStart">8dip</item>
<item name="android:textSize">14sp</item>
<item name="android:textAlignment">viewStart</item>
</style>
<style name="wifi_item_content">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
<item name="android:textAlignment">viewStart</item>
<item name="android:textAppearance">@android:style/TextAppearance.Material.Subhead</item>
<item name="android:textColor">@*android:color/primary_text_default_material_light</item>
</style>
<style name="wifi_item_edit_content">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
<item name="android:paddingStart">4dip</item>
<item name="android:layout_marginStart">4dip</item>
<item name="android:textSize">18sp</item>
</style>
<style name="wifi_section">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
<item name="android:orientation">vertical</item>
</style>
android:key="screen_magnification_preference_screen"
android:title="@string/accessibility_screen_magnification_title"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="toggle_large_text_preference"
android:title="@string/accessibility_toggle_large_text_preference_title"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="toggle_high_text_contrast_preference"
android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
android:summary="@string/experimental_preference"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="toggle_power_button_ends_call_preference"
android:title="@string/accessibility_power_button_ends_call_prerefence_title"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="toggle_lock_screen_rotation_preference"
android:title="@string/accelerometer_title"
android:persistent="false"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="toggle_speak_password_preference"
android:title="@string/accessibility_toggle_speak_password_preference_title"
android:persistent="false"/>
android:entries="@array/apn_protocol_entries"
android:entryValues="@array/apn_protocol_values"
/>
- <CheckBoxPreference
+ <SwitchPreference
android:title="@string/carrier_enabled"
android:key="carrier_enabled"
android:enabled="false"
android:title="@string/date_and_time"
settings:keywords="@string/keywords_date_and_time">
- <CheckBoxPreference android:key="auto_time"
+ <SwitchPreference android:key="auto_time"
android:title="@string/date_time_auto"
android:summaryOn="@string/date_time_auto_summaryOn"
android:summaryOff="@string/date_time_auto_summaryOff"
/>
- <CheckBoxPreference android:key="auto_zone"
+ <SwitchPreference android:key="auto_zone"
android:title="@string/zone_auto"
android:summaryOn="@string/zone_auto_summaryOn"
android:summaryOff="@string/zone_auto_summaryOff"
android:summary="GMT-8:00"
/>
- <CheckBoxPreference android:key="24 hour"
+ <SwitchPreference android:key="24 hour"
android:title="@string/date_time_24hour"
/>
android:targetClass="com.android.settings.SetFullBackupPassword" />
</PreferenceScreen>
- <CheckBoxPreference
+ <SwitchPreference
android:key="keep_screen_on"
android:title="@string/keep_screen_on"
android:summary="@string/keep_screen_on_summary"/>
android:entries="@array/hdcp_checking_titles"
android:entryValues="@array/hdcp_checking_values" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="bt_hci_snoop_log"
android:title="@string/bt_hci_snoop_log"
android:summary="@string/bt_hci_snoop_log_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="oem_unlock_enable"
android:title="@string/oem_unlock_enable"
android:summary="@string/oem_unlock_enable_summary"/>
<PreferenceCategory android:key="debug_debugging_category"
android:title="@string/debug_debugging_category">
- <CheckBoxPreference
+ <SwitchPreference
android:key="enable_adb"
android:title="@string/enable_adb"
android:summary="@string/enable_adb_summary"/>
<Preference android:key="clear_adb_keys"
android:title="@string/clear_adb_keys" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="enable_terminal"
android:title="@string/enable_terminal_title"
android:summary="@string/enable_terminal_summary" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="bugreport_in_power"
android:title="@string/bugreport_in_power"
android:summary="@string/bugreport_in_power_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="allow_mock_location"
android:title="@string/allow_mock_location"
android:summary="@string/allow_mock_location_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="debug_view_attributes"
android:title="@string/debug_view_attributes" />
<PreferenceScreen android:key="debug_app"
android:title="@string/debug_app" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="wait_for_debugger"
android:title="@string/wait_for_debugger"
android:summary="@string/wait_for_debugger_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="verify_apps_over_usb"
android:title="@string/verify_apps_over_usb_title"
android:summary="@string/verify_apps_over_usb_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="wifi_display_certification"
android:title="@string/wifi_display_certification"
android:summary="@string/wifi_display_certification_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="wifi_verbose_logging"
android:title="@string/wifi_verbose_logging" />
android:summary="@string/wifi_verbose_logging_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="wifi_aggressive_handover"
android:title="@string/wifi_aggressive_handover" />
android:summary="@string/wifi_aggressive_handover_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="wifi_allow_scan_with_traffic"
android:title="@string/wifi_allow_scan_with_traffic" />
android:summary="@string/wifi_allow_scan_with_traffic_summary"/>
<PreferenceCategory android:key="debug_input_category"
android:title="@string/debug_input_category">
- <CheckBoxPreference
+ <SwitchPreference
android:key="show_touches"
android:title="@string/show_touches"
android:summary="@string/show_touches_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="pointer_location"
android:title="@string/pointer_location"
android:summary="@string/pointer_location_summary"/>
<PreferenceCategory android:key="debug_drawing_category"
android:title="@string/debug_drawing_category">
- <CheckBoxPreference
+ <SwitchPreference
android:key="show_screen_updates"
android:title="@string/show_screen_updates"
android:summary="@string/show_screen_updates_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="debug_layout"
android:title="@string/debug_layout"
android:summary="@string/debug_layout_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="force_rtl_layout_all_locales"
android:title="@string/force_rtl_layout_all_locales"
android:summary="@string/force_rtl_layout_all_locales_summary"/>
<PreferenceCategory android:key="debug_hw_drawing_category"
android:title="@string/debug_hw_drawing_category">
- <CheckBoxPreference
+ <SwitchPreference
android:key="force_hw_ui"
android:title="@string/force_hw_ui"
android:summary="@string/force_hw_ui_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="show_hw_screen_udpates"
android:title="@string/show_hw_screen_updates"
android:summary="@string/show_hw_screen_updates_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="show_hw_layers_udpates"
android:title="@string/show_hw_layers_updates"
android:summary="@string/show_hw_layers_updates_summary"/>
android:entries="@array/show_non_rect_clip_entries"
android:entryValues="@array/show_non_rect_clip_values" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="force_msaa"
android:title="@string/force_msaa"
android:summary="@string/force_msaa_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="disable_overlays"
android:title="@string/disable_overlays"
android:summary="@string/disable_overlays_summary"/>
<PreferenceCategory android:key="media_category"
android:title="@string/media_category">
- <CheckBoxPreference
+ <SwitchPreference
android:key="use_nuplayer"
android:title="@string/use_nuplayer"
android:summary="@string/use_nuplayer_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="usb_audio"
android:title="@string/usb_audio_disable_routing"
android:summary="@string/usb_audio_disable_routing_summary" />
<PreferenceCategory android:key="debug_monitoring_category"
android:title="@string/debug_monitoring_category">
- <CheckBoxPreference
+ <SwitchPreference
android:key="strict_mode"
android:title="@string/strict_mode"
android:summary="@string/strict_mode_summary"/>
- <CheckBoxPreference
+ <SwitchPreference
android:key="show_cpu_usage"
android:title="@string/show_cpu_usage"
android:summary="@string/show_cpu_usage_summary"/>
<PreferenceCategory android:key="debug_applications_category"
android:title="@string/debug_applications_category">
- <CheckBoxPreference
+ <SwitchPreference
android:key="immediately_destroy_activities"
android:title="@string/immediately_destroy_activities"
android:summary="@string/immediately_destroy_activities_summary"/>
android:entries="@array/app_process_limit_entries"
android:entryValues="@array/app_process_limit_values" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="show_all_anrs"
android:title="@string/show_all_anrs"
android:summary="@string/show_all_anrs_summary"/>
- <CheckBoxPreference
- android:key="webview_data_reduction_proxy"
- android:title="@string/webview_data_reduction_proxy"
- android:summary="@string/webview_data_reduction_proxy_summary"/>
</PreferenceCategory>
</PreferenceScreen>
android:title="@string/battery_level_title"
android:summary="@string/device_info_not_available"
android:persistent="false" />
- <Preference android:key="operator_name"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_operator"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="signal_strength"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_signal_strength"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="network_type"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_network_type"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="latest_area_info"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_latest_area_info"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="service_state"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_service_state"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="roaming_state"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_roaming"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="data_state"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_data_state"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="number"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_number"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <!-- This menu item is only for CDMA phone -->
- <Preference android:key="min_number"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_min_number"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <!-- This menu item is only for CDMA phone -->
- <Preference android:key="prl_version"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_prl_version"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <!-- This menu item is only for CDMA phone -->
- <Preference android:key="meid_number"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_meid_number"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="imei"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_imei"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="imei_sv"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_imei_sv"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
- <Preference android:key="icc_id"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/status_icc_id"
- android:summary="@string/device_info_not_available"
- android:persistent="false" />
+ <PreferenceScreen android:key="sim_status"
+ android:title="@string/sim_status_title"
+ android:summary="@string/sim_status_summary"
+ android:persistent="false">
+ <intent android:targetPackage="com.android.settings"
+ android:targetClass="com.android.settings.deviceinfo.SimStatus" />
+ </PreferenceScreen>
+ <PreferenceScreen android:key="imei_info"
+ android:title="@string/imei_information_title"
+ android:summary="@string/imei_information_summary"
+ android:persistent="false">
+ <intent android:targetPackage="com.android.settings"
+ android:targetClass="com.android.settings.deviceinfo.ImeiInformation" />
+ </PreferenceScreen>
<Preference android:key="wifi_ip_address"
style="?android:attr/preferenceInformationStyle"
android:title="@string/wifi_advanced_ip_address_title"
android:key="game_controller_settings_category"
android:title="@string/game_controller_settings_category">
- <CheckBoxPreference
+ <SwitchPreference
android:key="vibrate_input_devices"
android:title="@string/vibrate_input_devices"
android:summaryOn="@string/vibrate_input_devices_summary"
<!-- Media volume -->
<com.android.settings.notification.VolumeSeekBarPreference
android:key="media_volume"
- android:icon="@*android:drawable/ic_audio_vol"
+ android:icon="@drawable/ic_audio_vol_24dp"
android:title="@string/media_volume_option_title" />
<!-- Alarm volume -->
<com.android.settings.notification.VolumeSeekBarPreference
android:key="alarm_volume"
- android:icon="@*android:drawable/ic_audio_alarm"
+ android:icon="@drawable/ic_audio_alarm_24dp"
android:title="@string/alarm_volume_option_title" />
<!-- Ring volume -->
<PreferenceCategory
android:key="sim_activities"
- android:title="@string/sim_pref_divider">
+ android:title="@string/sim_pref_divider" >
- <com.android.settings.notification.DropDownPreference
- android:key="sim_cellular_data"
+ <Preference android:key="sim_cellular_data"
android:title="@string/cellular_data_title" />
- <com.android.settings.notification.DropDownPreference
- android:key="sim_calls"
+ <Preference android:key="sim_calls"
android:title="@string/calls_title" />
- <com.android.settings.notification.DropDownPreference
- android:key="sim_sms"
+ <Preference android:key="sim_sms"
android:title="@string/sms_messages_title" />
</PreferenceCategory>
+
</PreferenceScreen>
android:title="@string/testing_usage_stats">
<intent android:action="android.intent.action.MAIN"
android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.UsageStats" />
+ android:targetClass="com.android.settings.UsageStatsActivity" />
</PreferenceScreen>
<PreferenceScreen
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:title="@string/location_settings_title">
+ android:title="@string/storage_title_usb">
<PreferenceCategory
android:title="@string/usb_connection_category" />
android:targetClass="com.android.settings.wimax.WimaxSettings" />
</PreferenceScreen>
- <CheckBoxPreference
+ <SwitchPreference
android:key="toggle_nsd"
android:title="@string/nsd_quick_toggle_title"
android:summary="@string/nsd_quick_toggle_summary"
android:switchTextOn="" />
<SwitchPreference
- android:key="phone_calls"
- android:title="@string/zen_mode_phone_calls"
+ android:key="calls"
+ android:title="@string/zen_mode_calls"
android:persistent="false"
android:switchTextOff=""
android:switchTextOn="" />
Resources res = packageManager.getResourcesForApplication(
iconResource.packageName);
icon = res.getDrawable(res.getIdentifier(
- iconResource.resourceName, null, null));
+ iconResource.resourceName, null, null), null);
} catch (NameNotFoundException e) {
// Ignore
}
import android.os.Message;
import android.os.SystemProperties;
import android.os.UserHandle;
-import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.SwitchPreference;
import android.provider.Settings;
}
};
- public AirplaneModeEnabler(Context context, SwitchPreference airplaneModeCheckBoxPreference) {
+ public AirplaneModeEnabler(Context context, SwitchPreference airplaneModeSwitchPreference) {
mContext = context;
- mSwitchPref = airplaneModeCheckBoxPreference;
-
- airplaneModeCheckBoxPreference.setPersistent(false);
+ mSwitchPref = airplaneModeSwitchPreference;
+
+ airplaneModeSwitchPreference.setPersistent(false);
mPhoneStateReceiver = new PhoneStateIntentReceiver(mContext, mHandler);
mPhoneStateReceiver.notifyServiceState(EVENT_SERVICE_STATE_CHANGED);
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
+import android.preference.SwitchPreference;
import android.provider.Telephony;
import android.telephony.TelephonyManager;
import android.util.Log;
private EditTextPreference mApnType;
private ListPreference mProtocol;
private ListPreference mRoamingProtocol;
- private CheckBoxPreference mCarrierEnabled;
+ private SwitchPreference mCarrierEnabled;
private ListPreference mBearer;
private ListPreference mMvnoType;
private EditTextPreference mMvnoMatchData;
mRoamingProtocol = (ListPreference) findPreference(KEY_ROAMING_PROTOCOL);
mRoamingProtocol.setOnPreferenceChangeListener(this);
- mCarrierEnabled = (CheckBoxPreference) findPreference(KEY_CARRIER_ENABLED);
+ mCarrierEnabled = (SwitchPreference) findPreference(KEY_CARRIER_ENABLED);
mBearer = (ListPreference) findPreference(KEY_BEARER);
mBearer.setOnPreferenceChangeListener(this);
mProtectFromCheckedChange = true;
rb.setChecked(isChecked);
mProtectFromCheckedChange = false;
+ rb.setVisibility(View.VISIBLE);
} else {
rb.setVisibility(View.GONE);
}
package com.android.settings;
+import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
if (!mRestoreDefaultApnMode) {
fillList();
- } else {
- showDialog(DIALOG_RESTORE_DEFAULTAPN);
}
}
public void handleMessage(Message msg) {
switch (msg.what) {
case EVENT_RESTORE_DEFAULTAPN_COMPLETE:
+ Activity activity = getActivity();
+ if (activity == null) {
+ mRestoreDefaultApnMode = false;
+ return;
+ }
fillList();
getPreferenceScreen().setEnabled(true);
mRestoreDefaultApnMode = false;
removeDialog(DIALOG_RESTORE_DEFAULTAPN);
Toast.makeText(
- getActivity(),
+ activity,
getResources().getString(
R.string.restore_default_apn_completed),
Toast.LENGTH_LONG).show();
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Activity;
+import android.app.ActivityManagerNative;
import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.os.Bundle;
+import android.os.Process;
+import android.os.RemoteException;
+import android.os.UserHandle;
import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import java.util.List;
public class ChooseLockGeneric extends SettingsActivity {
+ public static final String CONFIRM_CREDENTIALS = "confirm_credentials";
@Override
public Intent getIntent() {
private static final String KEY_UNLOCK_SET_PATTERN = "unlock_set_pattern";
private static final int CONFIRM_EXISTING_REQUEST = 100;
private static final int FALLBACK_REQUEST = 101;
+ private static final int ENABLE_ENCRYPTION_REQUEST = 102;
private static final String PASSWORD_CONFIRMED = "password_confirmed";
- private static final String CONFIRM_CREDENTIALS = "confirm_credentials";
+
private static final String WAITING_FOR_CONFIRMATION = "waiting_for_confirmation";
private static final String FINISH_PENDING = "finish_pending";
public static final String MINIMUM_QUALITY_KEY = "minimum_quality";
+ public static final String ENCRYPT_REQUESTED_QUALITY = "encrypt_requested_quality";
+ public static final String ENCRYPT_REQUESTED_DISABLED = "encrypt_requested_disabled";
private static final boolean ALWAY_SHOW_TUTORIAL = true;
private boolean mPasswordConfirmed = false;
private boolean mWaitingForConfirmation = false;
private boolean mFinishPending = false;
+ private int mEncryptionRequestQuality;
+ private boolean mEncryptionRequestDisabled;
+ private boolean mRequirePassword;
+ private LockPatternUtils mLockPatternUtils;
@Override
public void onCreate(Bundle savedInstanceState) {
mDPM = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
mKeyStore = KeyStore.getInstance();
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this.getActivity());
+ mLockPatternUtils = new LockPatternUtils(getActivity());
// Defaults to needing to confirm credentials
final boolean confirmCredentials = getActivity().getIntent()
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
mWaitingForConfirmation = savedInstanceState.getBoolean(WAITING_FOR_CONFIRMATION);
mFinishPending = savedInstanceState.getBoolean(FINISH_PENDING);
+ mEncryptionRequestQuality = savedInstanceState.getInt(ENCRYPT_REQUESTED_QUALITY);
+ mEncryptionRequestDisabled = savedInstanceState.getBoolean(
+ ENCRYPT_REQUESTED_DISABLED);
}
if (mPasswordConfirmed) {
updateUnlockMethodAndFinish(
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, false);
} else if (KEY_UNLOCK_SET_BIOMETRIC_WEAK.equals(key)) {
- updateUnlockMethodAndFinish(
+ maybeEnableEncryption(
DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK, false);
}else if (KEY_UNLOCK_SET_PATTERN.equals(key)) {
- updateUnlockMethodAndFinish(
+ maybeEnableEncryption(
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, false);
} else if (KEY_UNLOCK_SET_PIN.equals(key)) {
- updateUnlockMethodAndFinish(
+ maybeEnableEncryption(
DevicePolicyManager.PASSWORD_QUALITY_NUMERIC, false);
} else if (KEY_UNLOCK_SET_PASSWORD.equals(key)) {
- updateUnlockMethodAndFinish(
+ maybeEnableEncryption(
DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC, false);
} else {
handled = false;
return handled;
}
+ /**
+ * If the device has encryption already enabled, then ask the user if they
+ * also want to encrypt the phone with this password.
+ *
+ * @param quality
+ * @param disabled
+ */
+ private void maybeEnableEncryption(int quality, boolean disabled) {
+ if (Process.myUserHandle().isOwner() && LockPatternUtils.isDeviceEncryptionEnabled()) {
+ mEncryptionRequestQuality = quality;
+ mEncryptionRequestDisabled = disabled;
+ // If accessibility is enabled and the user hasn't seen this dialog before, set the
+ // default state to agree with that which is compatible with accessibility
+ // (password not required).
+ final boolean accEn = AccessibilityManager.getInstance(getActivity()).isEnabled();
+ final boolean required = mLockPatternUtils.isCredentialRequiredToDecrypt(!accEn);
+ Intent intent = EncryptionInterstitial.createStartIntent(
+ getActivity(), quality, required);
+ startActivityForResult(intent, ENABLE_ENCRYPTION_REQUEST);
+ } else {
+ mRequirePassword = false; // device encryption not enabled or not device owner.
+ updateUnlockMethodAndFinish(quality, disabled);
+ }
+ }
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == Activity.RESULT_OK) {
mPasswordConfirmed = true;
updatePreferencesOrFinish();
- } else if(requestCode == FALLBACK_REQUEST) {
+ } else if (requestCode == FALLBACK_REQUEST) {
mChooseLockSettingsHelper.utils().deleteTempGallery();
getActivity().setResult(resultCode);
finish();
+ } else if (requestCode == ENABLE_ENCRYPTION_REQUEST
+ && resultCode == Activity.RESULT_OK) {
+ mRequirePassword = data.getBooleanExtra(
+ EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
+ updateUnlockMethodAndFinish(mEncryptionRequestQuality, mEncryptionRequestDisabled);
} else {
getActivity().setResult(Activity.RESULT_CANCELED);
finish();
outState.putBoolean(PASSWORD_CONFIRMED, mPasswordConfirmed);
outState.putBoolean(WAITING_FOR_CONFIRMATION, mWaitingForConfirmation);
outState.putBoolean(FINISH_PENDING, mFinishPending);
+ outState.putInt(ENCRYPT_REQUESTED_QUALITY, mEncryptionRequestQuality);
+ outState.putBoolean(ENCRYPT_REQUESTED_DISABLED, mEncryptionRequestDisabled);
}
private void updatePreferencesOrFinish() {
}
private void updatePreferenceSummaryIfNeeded() {
+ if (LockPatternUtils.isDeviceEncrypted()) {
+ return;
+ }
+
if (AccessibilityManager.getInstance(getActivity()).getEnabledAccessibilityServiceList(
AccessibilityServiceInfo.FEEDBACK_ALL_MASK).isEmpty()) {
return;
minLength = MIN_PASSWORD_LENGTH;
}
final int maxLength = mDPM.getPasswordMaximumLength(quality);
- Intent intent = new Intent().setClass(getActivity(), ChooseLockPassword.class);
- intent.putExtra(LockPatternUtils.PASSWORD_TYPE_KEY, quality);
- intent.putExtra(ChooseLockPassword.PASSWORD_MIN_KEY, minLength);
- intent.putExtra(ChooseLockPassword.PASSWORD_MAX_KEY, maxLength);
- intent.putExtra(CONFIRM_CREDENTIALS, false);
- intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK,
- isFallback);
+ Intent intent = ChooseLockPassword.createIntent(getActivity(), quality, isFallback,
+ minLength, maxLength, mRequirePassword, false /* confirm credentials */);
if (isFallback) {
startActivityForResult(intent, FALLBACK_REQUEST);
return;
startActivity(intent);
}
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
- Intent intent = new Intent(getActivity(), ChooseLockPattern.class);
- intent.putExtra("key_lock_method", "pattern");
- intent.putExtra(CONFIRM_CREDENTIALS, false);
- intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK,
- isFallback);
+ Intent intent = ChooseLockPattern.createIntent(getActivity(),
+ isFallback, mRequirePassword, false /* confirm credentials */);
if (isFallback) {
startActivityForResult(intent, FALLBACK_REQUEST);
return;
import android.app.Activity;
import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
+import android.content.ContentResolver;
+import android.content.Context;
import android.content.Intent;
import android.inputmethodservice.KeyboardView;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.provider.Settings;
import android.text.Editable;
import android.text.InputType;
import android.text.Selection;
return modIntent;
}
+ public static Intent createIntent(Context context, int quality, final boolean isFallback,
+ int minLength, final int maxLength, boolean requirePasswordToDecrypt,
+ boolean confirmCredentials) {
+ Intent intent = new Intent().setClass(context, ChooseLockPassword.class);
+ intent.putExtra(LockPatternUtils.PASSWORD_TYPE_KEY, quality);
+ intent.putExtra(PASSWORD_MIN_KEY, minLength);
+ intent.putExtra(PASSWORD_MAX_KEY, maxLength);
+ intent.putExtra(ChooseLockGeneric.CONFIRM_CREDENTIALS, confirmCredentials);
+ intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, isFallback);
+ intent.putExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, requirePasswordToDecrypt);
+ return intent;
+ }
+
@Override
protected boolean isValidFragment(String fragmentName) {
if (ChooseLockPasswordFragment.class.getName().equals(fragmentName)) return true;
final boolean isFallback = getActivity().getIntent().getBooleanExtra(
LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
mLockPatternUtils.clearLock(isFallback);
+ final boolean required = getActivity().getIntent().getBooleanExtra(
+ EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
+ mLockPatternUtils.setCredentialRequiredToDecrypt(required);
mLockPatternUtils.saveLockPassword(pin, mRequestedQuality, isFallback);
getActivity().setResult(RESULT_FINISHED);
getActivity().finish();
package com.android.settings;
import com.google.android.collect.Lists;
-
import com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternView;
import android.app.Activity;
import android.app.Fragment;
+import android.content.ContentResolver;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.provider.Settings;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
return modIntent;
}
+ public static Intent createIntent(Context context, final boolean isFallback,
+ boolean requirePassword, boolean confirmCredentials) {
+ Intent intent = new Intent(context, ChooseLockPattern.class);
+ intent.putExtra("key_lock_method", "pattern");
+ intent.putExtra(ChooseLockGeneric.CONFIRM_CREDENTIALS, confirmCredentials);
+ intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, isFallback);
+ intent.putExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, requirePassword);
+ return intent;
+ }
+
@Override
protected boolean isValidFragment(String fragmentName) {
if (ChooseLockPatternFragment.class.getName().equals(fragmentName)) return true;
final boolean isFallback = getActivity().getIntent()
.getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
+
+ final boolean required = getActivity().getIntent().getBooleanExtra(
+ EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
+ utils.setCredentialRequiredToDecrypt(required);
utils.saveLockPattern(mChosenPattern, isFallback);
utils.setLockPatternEnabled(true);
case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
// TODO: update UI layout for ConfirmPassword to show message and details
- launched = confirmPassword(request, returnCredentials);
+ launched = confirmPassword(request, message, returnCredentials);
break;
}
return launched;
/**
* Launch screen to confirm the existing lock password.
+ * @param message shown in header of ConfirmLockPassword if not null
* @param returnCredentials if true, put credentials into intent.
* @see #onActivityResult(int, int, android.content.Intent)
* @return true if we launched an activity to confirm password
*/
- private boolean confirmPassword(int request, boolean returnCredentials) {
+ private boolean confirmPassword(int request, CharSequence message,
+ boolean returnCredentials) {
if (!mLockPatternUtils.isLockPasswordEnabled()) return false;
final Intent intent = new Intent();
+ // supply header text in the intent
+ intent.putExtra(ConfirmLockPattern.HEADER_TEXT, message);
intent.setClassName("com.android.settings",
returnCredentials
? ConfirmLockPassword.InternalActivity.class.getName()
public class ConfirmDeviceCredentialActivity extends Activity {
public static final String TAG = ConfirmDeviceCredentialActivity.class.getSimpleName();
+ public static Intent createIntent(CharSequence title, CharSequence details) {
+ Intent intent = new Intent();
+ intent.setClassName("com.android.settings",
+ ConfirmDeviceCredentialActivity.class.getName());
+ intent.putExtra(KeyguardManager.EXTRA_TITLE, title);
+ intent.putExtra(KeyguardManager.EXTRA_DESCRIPTION, details);
+ return intent;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
package com.android.settings;
+import android.text.TextUtils;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.PasswordEntryKeyboardHelper;
import com.android.internal.widget.PasswordEntryKeyboardView;
public class ConfirmLockPassword extends SettingsActivity {
+ public static final String PACKAGE = "com.android.settings";
+ public static final String HEADER_TEXT = PACKAGE + ".ConfirmLockPattern.header";
+
public static class InternalActivity extends ConfirmLockPassword {
}
mIsAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == storedQuality
|| DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == storedQuality
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == storedQuality;
- mHeaderText.setText(getDefaultHeader());
+
+ Intent intent = getActivity().getIntent();
+ if (intent != null) {
+ CharSequence headerMessage = intent.getCharSequenceExtra(HEADER_TEXT);
+ if (TextUtils.isEmpty(headerMessage)) {
+ headerMessage = getString(getDefaultHeader());
+ }
+ mHeaderText.setText(headerMessage);
+ }
final Activity activity = getActivity();
mKeyboardHelper = new PasswordEntryKeyboardHelper(activity,
try {
final IMountService service = getMountService();
type = service.getPasswordType();
- owner_info = service.getField("OwnerInfo");
- pattern_visible = !("0".equals(service.getField("PatternVisible")));
+ owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
+ pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.Preference;
+import android.telephony.SubInfoRecord;
+import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.format.DateUtils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
+import com.android.settings.sim.SimSettings;
import com.android.settings.widget.ChartDataUsageView;
import com.android.settings.widget.ChartDataUsageView.DataUsageChartListener;
import com.google.android.collect.Lists;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
/**
* Panel showing data usage history across various networks, including options
private MenuItem mMenuSimCards;
private MenuItem mMenuCellularNetworks;
+ private List<SubInfoRecord> mSubInfoList;
+ private Map<Long,String> mMobileTagMap;
+
/** Flag used to ignore listeners during binding. */
private boolean mBinding;
mPolicyEditor = new NetworkPolicyEditor(mPolicyManager);
mPolicyEditor.read();
+ mSubInfoList = SimSettings.getSortedSubInfoList(getActivity());
+ mMobileTagMap = initMobileTabTag(mSubInfoList);
+
try {
if (!mNetworkService.isBandwidthControlEnabled()) {
Log.w(TAG, "No bandwidth control; leaving");
mTabHost.addTab(buildTabSpec(TAB_3G, R.string.data_usage_tab_3g));
mTabHost.addTab(buildTabSpec(TAB_4G, R.string.data_usage_tab_4g));
} else if (hasReadyMobileRadio(context)) {
- mTabHost.addTab(buildTabSpec(TAB_MOBILE, R.string.data_usage_tab_mobile));
+ addMobileTab(context, mSubInfoList);
}
if (mShowWifi && hasWifiRadio(context)) {
mTabHost.addTab(buildTabSpec(TAB_WIFI, R.string.data_usage_tab_wifi));
mEmptyTabContent);
}
+ /**
+ * Build {@link TabSpec} with thin indicator, and empty content.
+ */
+ private TabSpec buildTabSpec(String tag, String title) {
+ return mTabHost.newTabSpec(tag).setIndicator(title).setContent(
+ mEmptyTabContent);
+ }
+
+
private OnTabChangeListener mTabListener = new OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
// TODO: remove mobile tabs when SIM isn't ready
- if (TAB_MOBILE.equals(currentTab)) {
+ if (isMobileTab(currentTab)) {
setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_mobile);
setPreferenceTitle(mDisableAtLimitView, R.string.data_usage_disable_mobile_limit);
- mTemplate = buildTemplateMobileAll(getActiveSubscriberId(context));
-
+ mTemplate = buildTemplateMobileAll(getActiveSubscriberId(context,getSubId(currentTab)));
+ mDataEnabledSupported = isMobileDataAvailable(getSubId(currentTab));
} else if (TAB_3G.equals(currentTab)) {
setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_3g);
setPreferenceTitle(mDisableAtLimitView, R.string.data_usage_disable_3g_limit);
*/
private Boolean mMobileDataEnabled;
- private boolean isMobileDataEnabled() {
+ private boolean isMobileDataEnabled(long subId) {
+ boolean isEnable = false;
if (mMobileDataEnabled != null) {
// TODO: deprecate and remove this once enabled flag is on policy
- return mMobileDataEnabled;
+ // Multiple Subscriptions, the value need to be reseted
+ isEnable = mMobileDataEnabled.booleanValue();
+ mMobileDataEnabled = null;
} else {
- return mTelephonyManager.getDataEnabled();
+ //SUB SELECT
+ isEnable = mTelephonyManager.getDataEnabled() && isMobileDataAvailable(subId);
}
+ return isEnable;
}
private void setMobileDataEnabled(boolean enabled) {
}
// TODO: move enabled state directly into policy
- if (TAB_MOBILE.equals(mCurrentTab)) {
+ if (isMobileTab(mCurrentTab)) {
mBinding = true;
- mDataEnabled.setChecked(isMobileDataEnabled());
+ mDataEnabled.setChecked(isMobileDataEnabled(getSubId(mCurrentTab)));
mBinding = false;
}
final NetworkPolicy policy = mPolicyEditor.getPolicy(mTemplate);
- if (isNetworkPolicyModifiable(policy)) {
+ //SUB SELECT
+ if (isNetworkPolicyModifiable(policy) && isMobileDataAvailable(getSubId(mCurrentTab))) {
mDisableAtLimit.setChecked(policy != null && policy.limitBytes != LIMIT_DISABLED);
if (!isAppDetailMode()) {
mChart.bindNetworkPolicy(policy);
final boolean dataEnabled = !mDataEnabled.isChecked();
final String currentTab = mCurrentTab;
- if (TAB_MOBILE.equals(currentTab)) {
+ if (isMobileTab(currentTab)) {
if (dataEnabled) {
setMobileDataEnabled(true);
} else {
final String totalPhrase = Formatter.formatFileSize(context, totalBytes);
mCycleSummary.setText(totalPhrase);
- if (TAB_MOBILE.equals(mCurrentTab) || TAB_3G.equals(mCurrentTab)
+ if (isMobileTab(mCurrentTab) || TAB_3G.equals(mCurrentTab)
|| TAB_4G.equals(mCurrentTab)) {
if (isAppDetailMode()) {
mDisclaimer.setVisibility(View.GONE);
return SystemProperties.get(TEST_SUBSCRIBER_PROP, actualSubscriberId);
}
+ private static String getActiveSubscriberId(Context context, long subId) {
+ final TelephonyManager tele = TelephonyManager.from(context);
+ return tele.getSubscriberId(subId);
+ }
+
private DataUsageChartListener mChartListener = new DataUsageChartListener() {
@Override
public void onWarningChanged() {
} else if (TAB_4G.equals(currentTab)) {
message = res.getString(R.string.data_usage_limit_dialog_mobile);
limitBytes = Math.max(5 * GB_IN_BYTES, minLimitBytes);
- } else if (TAB_MOBILE.equals(currentTab)) {
+ } else if (isMobileTab(currentTab)) {
message = res.getString(R.string.data_usage_limit_dialog_mobile);
limitBytes = Math.max(5 * GB_IN_BYTES, minLimitBytes);
} else {
*/
private static String computeTabFromIntent(Intent intent) {
final NetworkTemplate template = intent.getParcelableExtra(EXTRA_NETWORK_TEMPLATE);
- if (template == null) return null;
+ if (template == null) {
+ final long subId = intent.getLongExtra(PhoneConstants.SUBSCRIPTION_KEY,
+ SubscriptionManager.INVALID_SUB_ID);
+ if (SubscriptionManager.isValidSubId(subId)) {
+ return TAB_MOBILE + String.valueOf(subId);
+ }
+ return null;
+ }
switch (template.getMatchRule()) {
case MATCH_MOBILE_3G_LOWER:
final ConnectivityManager conn = ConnectivityManager.from(context);
final TelephonyManager tele = TelephonyManager.from(context);
+ final List<SubInfoRecord> subInfoList = SubscriptionManager.getActiveSubInfoList();
+ // No activated Subscription
+ if (subInfoList == null) {
+ return false;
+ }
// require both supported network and ready SIM
- return conn.isNetworkSupported(TYPE_MOBILE) && tele.getSimState() == SIM_STATE_READY;
+ boolean isReady = true;
+ for (SubInfoRecord subInfo : subInfoList) {
+ isReady = isReady & tele.getSimState(subInfo.slotId) == SIM_STATE_READY;
+ }
+ return conn.isNetworkSupported(TYPE_MOBILE) && isReady;
+ }
+
+ /*
+ * TODO: consider adding to TelephonyManager or SubscritpionManager.
+ */
+ public static boolean hasReadyMobileRadio(Context context, long subId) {
+ if (TEST_RADIOS) {
+ return SystemProperties.get(TEST_RADIOS_PROP).contains("mobile");
+ }
+
+ final ConnectivityManager conn = ConnectivityManager.from(context);
+ final TelephonyManager tele = TelephonyManager.from(context);
+ final int slotId = SubscriptionManager.getSlotId(subId);
+ final boolean isReady = tele.getSimState(slotId) == SIM_STATE_READY;
+
+ return conn.isNetworkSupported(TYPE_MOBILE) && isReady;
}
/**
}
};
+ private void addMobileTab(Context context, List<SubInfoRecord> subInfoList) {
+ if (subInfoList != null) {
+ for (SubInfoRecord subInfo : mSubInfoList) {
+ if (hasReadyMobileRadio(context,subInfo.subId)) {
+ mTabHost.addTab(buildTabSpec(mMobileTagMap.get(subInfo.subId),
+ subInfo.displayName));
+ }
+ }
+ }
+ }
+
+ /**
+ * Init a map with subId key and mobile tag name
+ * @param subInfoList The subscription Info List
+ * @return The map or null if no activated subscription
+ */
+ private Map<Long, String> initMobileTabTag(List<SubInfoRecord> subInfoList) {
+ Map<Long,String> map = null;
+ if (subInfoList != null) {
+ String mobileTag;
+ map = new HashMap<Long, String>();
+ for (SubInfoRecord subInfo : subInfoList) {
+ mobileTag = TAB_MOBILE + String.valueOf(subInfo.subId);
+ map.put(subInfo.subId,mobileTag);
+ }
+ }
+ return map;
+ }
+
+ private static boolean isMobileTab(String currentTab) {
+ return currentTab != null ? currentTab.contains(TAB_MOBILE) : false;
+ }
+
+ private long getSubId(String currentTab) {
+ Set<Long> set = mMobileTagMap.keySet();
+ for (Long subId : set) {
+ if (mMobileTagMap.get(subId).equals(currentTab)) {
+ return subId;
+ }
+ }
+ Log.e(TAG, "currentTab = " + currentTab + " non mobile tab called this function");
+ return -1;
+ }
+
+ //SUB SELECT
+ private boolean isMobileDataAvailable(long subId) {
+ long[] subIds = SubscriptionManager.getSubId(PhoneConstants.SUB1);
+ return subIds[0] == subId;
+ }
}
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
+import android.preference.SwitchPreference;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.text.BidiFormatter;
// have we been launched from the setup wizard?
protected static final String EXTRA_IS_FIRST_RUN = "firstRun";
- private CheckBoxPreference mAutoTimePref;
+ private SwitchPreference mAutoTimePref;
private Preference mTimePref;
private Preference mTime24Pref;
- private CheckBoxPreference mAutoTimeZonePref;
+ private SwitchPreference mAutoTimeZonePref;
private Preference mTimeZone;
private Preference mDatePref;
private ListPreference mDateFormat;
boolean autoTimeEnabled = getAutoState(Settings.Global.AUTO_TIME);
boolean autoTimeZoneEnabled = getAutoState(Settings.Global.AUTO_TIME_ZONE);
- mAutoTimePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME);
+ mAutoTimePref = (SwitchPreference) findPreference(KEY_AUTO_TIME);
DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context
.DEVICE_POLICY_SERVICE);
mDummyDate = Calendar.getInstance();
mAutoTimePref.setChecked(autoTimeEnabled);
- mAutoTimeZonePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME_ZONE);
+ mAutoTimeZonePref = (SwitchPreference) findPreference(KEY_AUTO_TIME_ZONE);
// Override auto-timezone if it's a wifi-only device or if we're still in setup wizard.
// TODO: Remove the wifiOnly test when auto-timezone is implemented based on wifi-location.
if (Utils.isWifiOnly(getActivity()) || isFirstRun) {
getPreferenceScreen().getSharedPreferences()
.registerOnSharedPreferenceChangeListener(this);
- ((CheckBoxPreference)mTime24Pref).setChecked(is24Hour());
+ ((SwitchPreference)mTime24Pref).setChecked(is24Hour());
// Register for time ticks and other reasons for time change
IntentFilter filter = new IntentFilter();
removeDialog(DIALOG_TIMEPICKER);
showDialog(DIALOG_TIMEPICKER);
} else if (preference == mTime24Pref) {
- final boolean is24Hour = ((CheckBoxPreference)mTime24Pref).isChecked();
+ final boolean is24Hour = ((SwitchPreference)mTime24Pref).isChecked();
set24Hour(is24Hour);
updateTimeAndDateDisplay(getActivity());
timeUpdated(is24Hour);
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
-import android.database.Cursor;
import android.hardware.usb.IUsbManager;
-import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.BatteryManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
+import android.preference.SwitchPreference;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.IWindowManager;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
-import android.webkit.WebView;
import android.widget.Switch;
import android.widget.TextView;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.widget.SwitchBar;
-import dalvik.system.VMRuntime;
import java.util.ArrayList;
import java.util.Arrays;
private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
- private static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = "webview_data_reduction_proxy";
- // GoogleSetting name for the data reduction proxy setting.
- // Setting type: int ( 0 = disallow, 1 = allow )
- private static final String WEBVIEW_DATA_REDUCTION_PROXY = "use_webview_data_reduction_proxy";
-
private static final String PROCESS_STATS = "proc_stats";
private static final String TAG_CONFIRM_ENFORCE = "confirm_enforce";
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
- // The setting Uri. Used when querying GoogleSettings.
- private static final Uri GOOGLE_SETTINGS_CONTENT_URI = Uri.parse("content://com.google.settings/partner");
- private static final String GOOGLE_SETTINGS_COMPONENT = "com.google.android.gms";
- private static final String GOOGLE_SETTINGS_ACTIVITY = ".app.settings.GoogleSettingsActivity";
-
private static String DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = "262144"; // 256K
private IWindowManager mWindowManager;
private boolean mHaveDebugSettings;
private boolean mDontPokeProperties;
- private CheckBoxPreference mEnableAdb;
+ private SwitchPreference mEnableAdb;
private Preference mClearAdbKeys;
- private CheckBoxPreference mEnableTerminal;
+ private SwitchPreference mEnableTerminal;
private Preference mBugreport;
- private CheckBoxPreference mBugreportInPower;
- private CheckBoxPreference mKeepScreenOn;
- private CheckBoxPreference mBtHciSnoopLog;
- private CheckBoxPreference mEnableOemUnlock;
- private CheckBoxPreference mAllowMockLocation;
- private CheckBoxPreference mDebugViewAttributes;
+ private SwitchPreference mBugreportInPower;
+ private SwitchPreference mKeepScreenOn;
+ private SwitchPreference mBtHciSnoopLog;
+ private SwitchPreference mEnableOemUnlock;
+ private SwitchPreference mAllowMockLocation;
+ private SwitchPreference mDebugViewAttributes;
private PreferenceScreen mPassword;
private String mDebugApp;
private Preference mDebugAppPref;
- private CheckBoxPreference mWaitForDebugger;
- private CheckBoxPreference mVerifyAppsOverUsb;
- private CheckBoxPreference mWifiDisplayCertification;
- private CheckBoxPreference mWifiVerboseLogging;
- private CheckBoxPreference mWifiAggressiveHandover;
-
- private CheckBoxPreference mWifiAllowScansWithTraffic;
- private CheckBoxPreference mStrictMode;
- private CheckBoxPreference mPointerLocation;
- private CheckBoxPreference mShowTouches;
- private CheckBoxPreference mShowScreenUpdates;
- private CheckBoxPreference mDisableOverlays;
- private CheckBoxPreference mShowCpuUsage;
- private CheckBoxPreference mForceHardwareUi;
- private CheckBoxPreference mForceMsaa;
- private CheckBoxPreference mShowHwScreenUpdates;
- private CheckBoxPreference mShowHwLayersUpdates;
- private CheckBoxPreference mDebugLayout;
- private CheckBoxPreference mForceRtlLayout;
+ private SwitchPreference mWaitForDebugger;
+ private SwitchPreference mVerifyAppsOverUsb;
+ private SwitchPreference mWifiDisplayCertification;
+ private SwitchPreference mWifiVerboseLogging;
+ private SwitchPreference mWifiAggressiveHandover;
+
+ private SwitchPreference mWifiAllowScansWithTraffic;
+ private SwitchPreference mStrictMode;
+ private SwitchPreference mPointerLocation;
+ private SwitchPreference mShowTouches;
+ private SwitchPreference mShowScreenUpdates;
+ private SwitchPreference mDisableOverlays;
+ private SwitchPreference mShowCpuUsage;
+ private SwitchPreference mForceHardwareUi;
+ private SwitchPreference mForceMsaa;
+ private SwitchPreference mShowHwScreenUpdates;
+ private SwitchPreference mShowHwLayersUpdates;
+ private SwitchPreference mDebugLayout;
+ private SwitchPreference mForceRtlLayout;
private ListPreference mDebugHwOverdraw;
private ListPreference mLogdSize;
private ListPreference mTrackFrameTime;
private ListPreference mSimulateColorSpace;
- private CheckBoxPreference mUseNuplayer;
- private CheckBoxPreference mUSBAudio;
- private CheckBoxPreference mImmediatelyDestroyActivities;
+ private SwitchPreference mUseNuplayer;
+ private SwitchPreference mUSBAudio;
+ private SwitchPreference mImmediatelyDestroyActivities;
private ListPreference mAppProcessLimit;
- private CheckBoxPreference mShowAllANRs;
-
- private CheckBoxPreference mWebViewDataReductionProxy;
+ private SwitchPreference mShowAllANRs;
private PreferenceScreen mProcessStats;
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
- private final ArrayList<CheckBoxPreference> mResetCbPrefs
- = new ArrayList<CheckBoxPreference>();
+ private final ArrayList<SwitchPreference> mResetSwitchPrefs
+ = new ArrayList<SwitchPreference>();
private final HashSet<Preference> mDisabledPrefs = new HashSet<Preference>();
// To track whether a confirmation dialog was clicked.
final PreferenceGroup debugDebuggingCategory = (PreferenceGroup)
findPreference(DEBUG_DEBUGGING_CATEGORY_KEY);
- mEnableAdb = findAndInitCheckboxPref(ENABLE_ADB);
+ mEnableAdb = findAndInitSwitchPref(ENABLE_ADB);
mClearAdbKeys = findPreference(CLEAR_ADB_KEYS);
if (!SystemProperties.getBoolean("ro.adb.secure", false)) {
if (debugDebuggingCategory != null) {
}
}
mAllPrefs.add(mClearAdbKeys);
- mEnableTerminal = findAndInitCheckboxPref(ENABLE_TERMINAL);
+ mEnableTerminal = findAndInitSwitchPref(ENABLE_TERMINAL);
if (!isPackageInstalled(getActivity(), TERMINAL_APP_PACKAGE)) {
debugDebuggingCategory.removePreference(mEnableTerminal);
mEnableTerminal = null;
}
mBugreport = findPreference(BUGREPORT);
- mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY);
- mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON);
- mBtHciSnoopLog = findAndInitCheckboxPref(BT_HCI_SNOOP_LOG);
- mEnableOemUnlock = findAndInitCheckboxPref(ENABLE_OEM_UNLOCK);
+ mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
+ mKeepScreenOn = findAndInitSwitchPref(KEEP_SCREEN_ON);
+ mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
+ mEnableOemUnlock = findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
if (!showEnableOemUnlockPreference()) {
removePreference(mEnableOemUnlock);
mEnableOemUnlock = null;
}
- mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION);
- mDebugViewAttributes = findAndInitCheckboxPref(DEBUG_VIEW_ATTRIBUTES);
+ mAllowMockLocation = findAndInitSwitchPref(ALLOW_MOCK_LOCATION);
+ mDebugViewAttributes = findAndInitSwitchPref(DEBUG_VIEW_ATTRIBUTES);
mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
mAllPrefs.add(mPassword);
mDebugAppPref = findPreference(DEBUG_APP_KEY);
mAllPrefs.add(mDebugAppPref);
- mWaitForDebugger = findAndInitCheckboxPref(WAIT_FOR_DEBUGGER_KEY);
- mVerifyAppsOverUsb = findAndInitCheckboxPref(VERIFY_APPS_OVER_USB_KEY);
+ mWaitForDebugger = findAndInitSwitchPref(WAIT_FOR_DEBUGGER_KEY);
+ mVerifyAppsOverUsb = findAndInitSwitchPref(VERIFY_APPS_OVER_USB_KEY);
if (!showVerifierSetting()) {
if (debugDebuggingCategory != null) {
debugDebuggingCategory.removePreference(mVerifyAppsOverUsb);
mVerifyAppsOverUsb.setEnabled(false);
}
}
- mStrictMode = findAndInitCheckboxPref(STRICT_MODE_KEY);
- mPointerLocation = findAndInitCheckboxPref(POINTER_LOCATION_KEY);
- mShowTouches = findAndInitCheckboxPref(SHOW_TOUCHES_KEY);
- mShowScreenUpdates = findAndInitCheckboxPref(SHOW_SCREEN_UPDATES_KEY);
- mDisableOverlays = findAndInitCheckboxPref(DISABLE_OVERLAYS_KEY);
- mShowCpuUsage = findAndInitCheckboxPref(SHOW_CPU_USAGE_KEY);
- mForceHardwareUi = findAndInitCheckboxPref(FORCE_HARDWARE_UI_KEY);
- mForceMsaa = findAndInitCheckboxPref(FORCE_MSAA_KEY);
+ mStrictMode = findAndInitSwitchPref(STRICT_MODE_KEY);
+ mPointerLocation = findAndInitSwitchPref(POINTER_LOCATION_KEY);
+ mShowTouches = findAndInitSwitchPref(SHOW_TOUCHES_KEY);
+ mShowScreenUpdates = findAndInitSwitchPref(SHOW_SCREEN_UPDATES_KEY);
+ mDisableOverlays = findAndInitSwitchPref(DISABLE_OVERLAYS_KEY);
+ mShowCpuUsage = findAndInitSwitchPref(SHOW_CPU_USAGE_KEY);
+ mForceHardwareUi = findAndInitSwitchPref(FORCE_HARDWARE_UI_KEY);
+ mForceMsaa = findAndInitSwitchPref(FORCE_MSAA_KEY);
mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
mShowNonRectClip = addListPreference(SHOW_NON_RECTANGULAR_CLIP_KEY);
- mShowHwScreenUpdates = findAndInitCheckboxPref(SHOW_HW_SCREEN_UPDATES_KEY);
- mShowHwLayersUpdates = findAndInitCheckboxPref(SHOW_HW_LAYERS_UPDATES_KEY);
- mDebugLayout = findAndInitCheckboxPref(DEBUG_LAYOUT_KEY);
- mForceRtlLayout = findAndInitCheckboxPref(FORCE_RTL_LAYOUT_KEY);
+ mShowHwScreenUpdates = findAndInitSwitchPref(SHOW_HW_SCREEN_UPDATES_KEY);
+ mShowHwLayersUpdates = findAndInitSwitchPref(SHOW_HW_LAYERS_UPDATES_KEY);
+ mDebugLayout = findAndInitSwitchPref(DEBUG_LAYOUT_KEY);
+ mForceRtlLayout = findAndInitSwitchPref(FORCE_RTL_LAYOUT_KEY);
mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
- mWifiDisplayCertification = findAndInitCheckboxPref(WIFI_DISPLAY_CERTIFICATION_KEY);
- mWifiVerboseLogging = findAndInitCheckboxPref(WIFI_VERBOSE_LOGGING_KEY);
- mWifiAggressiveHandover = findAndInitCheckboxPref(WIFI_AGGRESSIVE_HANDOVER_KEY);
- mWifiAllowScansWithTraffic = findAndInitCheckboxPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
+ mWifiDisplayCertification = findAndInitSwitchPref(WIFI_DISPLAY_CERTIFICATION_KEY);
+ mWifiVerboseLogging = findAndInitSwitchPref(WIFI_VERBOSE_LOGGING_KEY);
+ mWifiAggressiveHandover = findAndInitSwitchPref(WIFI_AGGRESSIVE_HANDOVER_KEY);
+ mWifiAllowScansWithTraffic = findAndInitSwitchPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
- mUseNuplayer = findAndInitCheckboxPref(USE_NUPLAYER_KEY);
- mUSBAudio = findAndInitCheckboxPref(USB_AUDIO_KEY);
+ mUseNuplayer = findAndInitSwitchPref(USE_NUPLAYER_KEY);
+ mUSBAudio = findAndInitSwitchPref(USB_AUDIO_KEY);
- mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
+ mImmediatelyDestroyActivities = (SwitchPreference) findPreference(
IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
mAllPrefs.add(mImmediatelyDestroyActivities);
- mResetCbPrefs.add(mImmediatelyDestroyActivities);
+ mResetSwitchPrefs.add(mImmediatelyDestroyActivities);
mAppProcessLimit = addListPreference(APP_PROCESS_LIMIT_KEY);
- mShowAllANRs = (CheckBoxPreference) findPreference(
+ mShowAllANRs = (SwitchPreference) findPreference(
SHOW_ALL_ANRS_KEY);
mAllPrefs.add(mShowAllANRs);
- mResetCbPrefs.add(mShowAllANRs);
+ mResetSwitchPrefs.add(mShowAllANRs);
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mProcessStats = (PreferenceScreen) findPreference(PROCESS_STATS);
mAllPrefs.add(mProcessStats);
-
- mWebViewDataReductionProxy = findAndInitCheckboxPref(WEBVIEW_DATA_REDUCTION_PROXY_KEY);
- mWebViewDataReductionProxy.setOnPreferenceChangeListener(
- new Preference.OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- return handleDataReductionProxyPreferenceChange();
- }
- });
}
private ListPreference addListPreference(String prefKey) {
}
}
- private CheckBoxPreference findAndInitCheckboxPref(String key) {
- CheckBoxPreference pref = (CheckBoxPreference) findPreference(key);
+ private SwitchPreference findAndInitSwitchPref(String key) {
+ SwitchPreference pref = (SwitchPreference) findPreference(key);
if (pref == null) {
throw new IllegalArgumentException("Cannot find preference with key = " + key);
}
mAllPrefs.add(pref);
- mResetCbPrefs.add(pref);
+ mResetSwitchPrefs.add(pref);
return pref;
}
mSwitchBar.hide();
}
- void updateCheckBox(CheckBoxPreference checkBox, boolean value) {
- checkBox.setChecked(value);
+ void updateSwitchPreference(SwitchPreference switchPreference, boolean value) {
+ switchPreference.setChecked(value);
mHaveDebugSettings |= value;
}
final Context context = getActivity();
final ContentResolver cr = context.getContentResolver();
mHaveDebugSettings = false;
- updateCheckBox(mEnableAdb, Settings.Global.getInt(cr,
+ updateSwitchPreference(mEnableAdb, Settings.Global.getInt(cr,
Settings.Global.ADB_ENABLED, 0) != 0);
if (mEnableTerminal != null) {
- updateCheckBox(mEnableTerminal,
+ updateSwitchPreference(mEnableTerminal,
context.getPackageManager().getApplicationEnabledSetting(TERMINAL_APP_PACKAGE)
- == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+ == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
}
- updateCheckBox(mBugreportInPower, Settings.Secure.getInt(cr,
+ updateSwitchPreference(mBugreportInPower, Settings.Secure.getInt(cr,
Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
- updateCheckBox(mKeepScreenOn, Settings.Global.getInt(cr,
+ updateSwitchPreference(mKeepScreenOn, Settings.Global.getInt(cr,
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
- updateCheckBox(mBtHciSnoopLog, Settings.Secure.getInt(cr,
+ updateSwitchPreference(mBtHciSnoopLog, Settings.Secure.getInt(cr,
Settings.Secure.BLUETOOTH_HCI_LOG, 0) != 0);
if (mEnableOemUnlock != null) {
- updateCheckBox(mEnableOemUnlock, Utils.isOemUnlockEnabled(getActivity()));
+ updateSwitchPreference(mEnableOemUnlock, Utils.isOemUnlockEnabled(getActivity()));
}
- updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
+ updateSwitchPreference(mAllowMockLocation, Settings.Secure.getInt(cr,
Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
- updateCheckBox(mDebugViewAttributes, Settings.Global.getInt(cr,
+ updateSwitchPreference(mDebugViewAttributes, Settings.Global.getInt(cr,
Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0) != 0);
updateHdcpValues();
updatePasswordSummary();
updateImmediatelyDestroyActivitiesOptions();
updateAppProcessLimitOptions();
updateShowAllANRsOptions();
- updateWebViewDataReductionProxyOptions();
updateVerifyAppsOverUsbOptions();
updateBugreportOptions();
updateForceRtlOptions();
private void resetDangerousOptions() {
mDontPokeProperties = true;
- for (int i=0; i<mResetCbPrefs.size(); i++) {
- CheckBoxPreference cb = mResetCbPrefs.get(i);
+ for (int i=0; i< mResetSwitchPrefs.size(); i++) {
+ SwitchPreference cb = mResetSwitchPrefs.get(i);
if (cb.isChecked()) {
cb.setChecked(false);
onPreferenceTreeClick(null, cb);
private void updateDebuggerOptions() {
mDebugApp = Settings.Global.getString(
getActivity().getContentResolver(), Settings.Global.DEBUG_APP);
- updateCheckBox(mWaitForDebugger, Settings.Global.getInt(
+ updateSwitchPreference(mWaitForDebugger, Settings.Global.getInt(
getActivity().getContentResolver(), Settings.Global.WAIT_FOR_DEBUGGER, 0) != 0);
if (mDebugApp != null && mDebugApp.length() > 0) {
String label;
}
private void updateVerifyAppsOverUsbOptions() {
- updateCheckBox(mVerifyAppsOverUsb, Settings.Global.getInt(getActivity().getContentResolver(),
+ updateSwitchPreference(mVerifyAppsOverUsb, Settings.Global.getInt(getActivity().getContentResolver(),
Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1) != 0);
mVerifyAppsOverUsb.setEnabled(enableVerifierSetting());
}
}
private void updateStrictModeVisualOptions() {
- updateCheckBox(mStrictMode, currentStrictModeActiveIndex() == 1);
+ updateSwitchPreference(mStrictMode, currentStrictModeActiveIndex() == 1);
}
private void writePointerLocationOptions() {
}
private void updatePointerLocationOptions() {
- updateCheckBox(mPointerLocation, Settings.System.getInt(getActivity().getContentResolver(),
+ updateSwitchPreference(mPointerLocation, Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.POINTER_LOCATION, 0) != 0);
}
}
private void updateShowTouchesOptions() {
- updateCheckBox(mShowTouches, Settings.System.getInt(getActivity().getContentResolver(),
+ updateSwitchPreference(mShowTouches, Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.SHOW_TOUCHES, 0) != 0);
}
@SuppressWarnings("unused")
int enableGL = reply.readInt();
int showUpdates = reply.readInt();
- updateCheckBox(mShowScreenUpdates, showUpdates != 0);
+ updateSwitchPreference(mShowScreenUpdates, showUpdates != 0);
@SuppressWarnings("unused")
int showBackground = reply.readInt();
int disableOverlays = reply.readInt();
- updateCheckBox(mDisableOverlays, disableOverlays != 0);
+ updateSwitchPreference(mDisableOverlays, disableOverlays != 0);
reply.recycle();
data.recycle();
}
}
private void updateHardwareUiOptions() {
- updateCheckBox(mForceHardwareUi, SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
+ updateSwitchPreference(mForceHardwareUi, SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
}
private void writeHardwareUiOptions() {
}
private void updateMsaaOptions() {
- updateCheckBox(mForceMsaa, SystemProperties.getBoolean(MSAA_PROPERTY, false));
+ updateSwitchPreference(mForceMsaa, SystemProperties.getBoolean(MSAA_PROPERTY, false));
}
private void writeMsaaOptions() {
}
private void updateShowHwScreenUpdatesOptions() {
- updateCheckBox(mShowHwScreenUpdates,
+ updateSwitchPreference(mShowHwScreenUpdates,
SystemProperties.getBoolean(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false));
}
}
private void updateShowHwLayersUpdatesOptions() {
- updateCheckBox(mShowHwLayersUpdates, SystemProperties.getBoolean(
+ updateSwitchPreference(mShowHwLayersUpdates, SystemProperties.getBoolean(
HardwareRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, false));
}
}
private void updateDebugLayoutOptions() {
- updateCheckBox(mDebugLayout,
+ updateSwitchPreference(mDebugLayout,
SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false));
}
}
private void updateUseNuplayerOptions() {
- updateCheckBox(
+ updateSwitchPreference(
mUseNuplayer, !SystemProperties.getBoolean(USE_AWESOMEPLAYER_PROPERTY, false));
}
}
private void updateUSBAudioOptions() {
- updateCheckBox(mUSBAudio, Settings.Secure.getInt(getContentResolver(),
+ updateSwitchPreference(mUSBAudio, Settings.Secure.getInt(getContentResolver(),
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 0) != 0);
}
}
private void updateForceRtlOptions() {
- updateCheckBox(mForceRtlLayout, Settings.Global.getInt(getActivity().getContentResolver(),
+ updateSwitchPreference(mForceRtlLayout, Settings.Global.getInt(getActivity().getContentResolver(),
Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0);
}
}
private void updateWifiDisplayCertificationOptions() {
- updateCheckBox(mWifiDisplayCertification, Settings.Global.getInt(
+ updateSwitchPreference(mWifiDisplayCertification, Settings.Global.getInt(
getActivity().getContentResolver(),
Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0);
}
private void updateWifiVerboseLoggingOptions() {
boolean enabled = mWifiManager.getVerboseLoggingLevel() > 0;
- updateCheckBox(mWifiVerboseLogging, enabled);
+ updateSwitchPreference(mWifiVerboseLogging, enabled);
}
private void writeWifiVerboseLoggingOptions() {
private void updateWifiAggressiveHandoverOptions() {
boolean enabled = mWifiManager.getAggressiveHandover() > 0;
- updateCheckBox(mWifiAggressiveHandover, enabled);
+ updateSwitchPreference(mWifiAggressiveHandover, enabled);
}
private void writeWifiAggressiveHandoverOptions() {
private void updateWifiAllowScansWithTrafficOptions() {
boolean enabled = mWifiManager.getAllowScansWithTraffic() > 0;
- updateCheckBox(mWifiAllowScansWithTraffic, enabled);
+ updateSwitchPreference(mWifiAllowScansWithTraffic, enabled);
}
private void writeWifiAllowScansWithTrafficOptions() {
}
private void updateCpuUsageOptions() {
- updateCheckBox(mShowCpuUsage, Settings.Global.getInt(getActivity().getContentResolver(),
+ updateSwitchPreference(mShowCpuUsage, Settings.Global.getInt(getActivity().getContentResolver(),
Settings.Global.SHOW_PROCESSES, 0) != 0);
}
}
private void updateImmediatelyDestroyActivitiesOptions() {
- updateCheckBox(mImmediatelyDestroyActivities, Settings.Global.getInt(
- getActivity().getContentResolver(), Settings.Global.ALWAYS_FINISH_ACTIVITIES, 0) != 0);
+ updateSwitchPreference(mImmediatelyDestroyActivities, Settings.Global.getInt(
+ getActivity().getContentResolver(), Settings.Global.ALWAYS_FINISH_ACTIVITIES, 0) != 0);
}
private void updateAnimationScaleValue(int which, ListPreference pref) {
}
private void updateShowAllANRsOptions() {
- updateCheckBox(mShowAllANRs, Settings.Secure.getInt(
- getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
- }
-
- // Reads the googlesetting and converts to an int. Throws an exception if GoogleSettings
- // provider does not exist or if the setting name cannot be found.
- private int getGoogleSettingValue(String name) throws Exception {
- String value = null;
- Cursor c = null;
- try {
- ContentResolver resolver = getActivity().getContentResolver();
- c = resolver.query(GOOGLE_SETTINGS_CONTENT_URI, new String[] { "value" },
- "name=?", new String[]{ name }, null);
- if (c != null && c.moveToNext()) value = c.getString(0);
- } finally {
- if (c != null) c.close();
- }
- // Throw an exception if value is null. This will indicate that setting is not found.
- return Integer.parseInt(value);
- }
-
- private boolean handleDataReductionProxyPreferenceChange() {
- int val;
- try {
- val = getGoogleSettingValue(WEBVIEW_DATA_REDUCTION_PROXY);
- } catch (Exception e) {
- // Accessing GoogleSettings failed. Use the developer setting.
- return true;
- }
-
- Intent i = new Intent();
- i.setClassName(GOOGLE_SETTINGS_COMPONENT,
- GOOGLE_SETTINGS_COMPONENT + GOOGLE_SETTINGS_ACTIVITY);
- try {
- startActivity(i);
- } catch (android.content.ActivityNotFoundException ex) {
- // We found the GoogleSetting but for some reason activity not found.
- // Do our best and put an alert dialog
- new AlertDialog.Builder(getActivity()).setMessage(
- getActivity().getResources().getString(
- R.string.dev_settings_use_google_settings))
- .setPositiveButton(android.R.string.ok, this)
- .show();
- }
- // Use GoogleSettings to set.
- return false;
- }
-
- private void writeWebViewDataReductionProxyOptions() {
- Settings.Secure.putInt(getActivity().getContentResolver(),
- Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY,
- mWebViewDataReductionProxy.isChecked() ? 1 : 0);
- Intent intent = new Intent(WebView.DATA_REDUCTION_PROXY_SETTING_CHANGED);
- // Broadcast to all apps running as current user.
- getActivity().sendBroadcastAsUser(intent, UserHandle.CURRENT);
- }
-
- private void updateWebViewDataReductionProxyOptions() {
- int val = -1;
- try {
- val = getGoogleSettingValue(WEBVIEW_DATA_REDUCTION_PROXY);
- } catch (Exception e) {
- // Accessing GoogleSettings failed. Use the developer setting
- }
- if (val == -1) {
- val = Settings.Secure.getInt(getActivity().getContentResolver(),
- Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY, 0);
- }
- updateCheckBox(mWebViewDataReductionProxy, val != 0);
+ updateSwitchPreference(mShowAllANRs, Settings.Secure.getInt(
+ getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
}
@Override
writeImmediatelyDestroyActivitiesOptions();
} else if (preference == mShowAllANRs) {
writeShowAllANRsOptions();
- } else if (preference == mWebViewDataReductionProxy) {
- writeWebViewDataReductionProxyOptions();
} else if (preference == mForceHardwareUi) {
writeHardwareUiOptions();
} else if (preference == mForceMsaa) {
--- /dev/null
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.settings;
+
+import com.android.internal.widget.LockPatternUtils;
+import com.android.settings.R;
+import com.android.settings.SettingsActivity;
+import com.android.settings.SettingsPreferenceFragment;
+
+import java.util.List;
+
+import android.accessibilityservice.AccessibilityServiceInfo;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.admin.DevicePolicyManager;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityManager;
+import android.widget.RadioButton;
+import android.widget.TextView;
+
+public class EncryptionInterstitial extends SettingsActivity {
+
+ private static final String EXTRA_PASSWORD_QUALITY = "extra_password_quality";
+ public static final String EXTRA_REQUIRE_PASSWORD = "extra_require_password";
+
+ @Override
+ public Intent getIntent() {
+ Intent modIntent = new Intent(super.getIntent());
+ modIntent.putExtra(EXTRA_SHOW_FRAGMENT, EncryptionInterstitialFragment.class.getName());
+ return modIntent;
+ }
+
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return EncryptionInterstitialFragment.class.getName().equals(fragmentName);
+ }
+
+ public static Intent createStartIntent(Context ctx, int quality,
+ boolean requirePasswordDefault) {
+ return new Intent(ctx, EncryptionInterstitial.class)
+ .putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, true)
+ .putExtra(EXTRA_PREFS_SET_BACK_TEXT, (String) null)
+ .putExtra(EXTRA_PREFS_SET_NEXT_TEXT, ctx.getString(
+ R.string.encryption_continue_button))
+ .putExtra(EXTRA_PASSWORD_QUALITY, quality)
+ .putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.encryption_interstitial_header)
+ .putExtra(EXTRA_REQUIRE_PASSWORD, requirePasswordDefault);
+ }
+
+ public static class EncryptionInterstitialFragment extends SettingsPreferenceFragment
+ implements View.OnClickListener, OnClickListener {
+
+ private static final int ACCESSIBILITY_WARNING_DIALOG = 1;
+ private RadioButton mRequirePasswordToDecryptButton;
+ private RadioButton mDontRequirePasswordToDecryptButton;
+ private TextView mEncryptionMessage;
+ private boolean mPasswordRequired;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ final int layoutId = R.layout.encryption_interstitial;
+ View view = inflater.inflate(layoutId, container, false);
+ mRequirePasswordToDecryptButton =
+ (RadioButton) view.findViewById(R.id.encrypt_require_password);
+ mDontRequirePasswordToDecryptButton =
+ (RadioButton) view.findViewById(R.id.encrypt_dont_require_password);
+ mEncryptionMessage =
+ (TextView) view.findViewById(R.id.encryption_message);
+ int quality = getActivity().getIntent().getIntExtra(EXTRA_PASSWORD_QUALITY, 0);
+ final int msgId;
+ final int enableId;
+ final int disableId;
+ switch (quality) {
+ case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
+ msgId = R.string.encryption_interstitial_message_pattern;
+ enableId = R.string.encrypt_require_pattern;
+ disableId = R.string.encrypt_dont_require_pattern;
+ break;
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
+ msgId = R.string.encryption_interstitial_message_pin;
+ enableId = R.string.encrypt_require_pin;
+ disableId = R.string.encrypt_dont_require_pin;
+ break;
+ default:
+ msgId = R.string.encryption_interstitial_message_password;
+ enableId = R.string.encrypt_require_password;
+ disableId = R.string.encrypt_dont_require_password;
+ break;
+ }
+ mEncryptionMessage.setText(msgId);
+
+ mRequirePasswordToDecryptButton.setOnClickListener(this);
+ mRequirePasswordToDecryptButton.setText(enableId);
+
+ mDontRequirePasswordToDecryptButton.setOnClickListener(this);
+ mDontRequirePasswordToDecryptButton.setText(disableId);
+
+ setRequirePasswordState(getActivity().getIntent().getBooleanExtra(
+ EXTRA_REQUIRE_PASSWORD, true));
+ return view;
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == mRequirePasswordToDecryptButton) {
+ final boolean accEn = AccessibilityManager.getInstance(getActivity()).isEnabled();
+ if (accEn && !mPasswordRequired) {
+ setRequirePasswordState(false); // clear the UI state
+ showDialog(ACCESSIBILITY_WARNING_DIALOG);
+ } else {
+ setRequirePasswordState(true);
+ }
+ } else {
+ setRequirePasswordState(false);
+ }
+ }
+
+ @Override
+ public Dialog onCreateDialog(int dialogId) {
+ switch(dialogId) {
+ case ACCESSIBILITY_WARNING_DIALOG: {
+ final int quality = new LockPatternUtils(getActivity())
+ .getKeyguardStoredPasswordQuality();
+ final int titleId;
+ final int messageId;
+ switch (quality) {
+ case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
+ titleId = R.string.encrypt_talkback_dialog_require_pattern;
+ messageId = R.string.encrypt_talkback_dialog_message_pattern;
+ break;
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
+ titleId = R.string.encrypt_talkback_dialog_require_pin;
+ messageId = R.string.encrypt_talkback_dialog_message_pin;
+ break;
+ default:
+ titleId = R.string.encrypt_talkback_dialog_require_password;
+ messageId = R.string.encrypt_talkback_dialog_message_password;
+ break;
+ }
+
+
+ List<AccessibilityServiceInfo> list =
+ AccessibilityManager.getInstance(getActivity())
+ .getEnabledAccessibilityServiceList(
+ AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
+ final CharSequence exampleAccessibility;
+ if (list.isEmpty()) {
+ // This should never happen. But we shouldn't crash
+ exampleAccessibility = "";
+ } else {
+ exampleAccessibility = list.get(0).getResolveInfo()
+ .loadLabel(getPackageManager());
+ }
+ return new AlertDialog.Builder(getActivity())
+ .setTitle(titleId)
+ .setMessage(getString(messageId, exampleAccessibility))
+ .setCancelable(true)
+ .setPositiveButton(android.R.string.ok, this)
+ .setNegativeButton(android.R.string.cancel, this)
+ .create();
+ }
+ default: throw new IllegalArgumentException();
+ }
+ }
+
+ private void setRequirePasswordState(boolean required) {
+ mPasswordRequired = required;
+ mRequirePasswordToDecryptButton.setChecked(required);
+ mDontRequirePasswordToDecryptButton.setChecked(!required);
+
+ // Updates value returned by SettingsActivity.onActivityResult().
+ SettingsActivity sa = (SettingsActivity)getActivity();
+ Intent resultIntentData = sa.getResultIntentData();
+ if (resultIntentData == null) {
+ resultIntentData = new Intent();
+ sa.setResultIntentData(resultIntentData);
+ }
+ resultIntentData.putExtra(EXTRA_REQUIRE_PASSWORD, mPasswordRequired);
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ setRequirePasswordState(true);
+ } else if (which == DialogInterface.BUTTON_NEGATIVE) {
+ setRequirePasswordState(false);
+ }
+ }
+ }
+}
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
-import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RadioButton;
}
private boolean versionNumberAtLeastL(int versionNumber) {
- return versionNumber >= Build.VERSION_CODES.L;
+ return versionNumber >= Build.VERSION_CODES.LOLLIPOP;
}
@Override
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Environment;
+import android.os.Process;
import android.os.SystemProperties;
import android.os.UserManager;
import android.preference.Preference;
try {
if (desc.iconId != 0) {
Context authContext = context.createPackageContext(desc.packageName, 0);
- icon = authContext.getResources().getDrawable(desc.iconId);
+ icon = authContext.getDrawable(desc.iconId);
}
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "No icon for account type " + desc.type);
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- if (UserManager.get(getActivity()).hasUserRestriction(
+ if (!Process.myUserHandle().isOwner()
+ || UserManager.get(getActivity()).hasUserRestriction(
UserManager.DISALLOW_FACTORY_RESET)) {
return inflater.inflate(R.layout.master_clear_disallowed_screen, null);
}
import android.content.Intent;
import android.content.IntentFilter;
import android.net.nsd.NsdManager;
-import android.preference.CheckBoxPreference;
import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import com.android.settings.R;
+import android.preference.SwitchPreference;
/**
* NsdEnabler is a helper to manage network service discovery on/off checkbox state.
*/
public class NsdEnabler implements Preference.OnPreferenceChangeListener {
private final Context mContext;
- private final CheckBoxPreference mCheckbox;
+ private final SwitchPreference mSwitchPreference;
private final IntentFilter mIntentFilter;
private NsdManager mNsdManager;
}
};
- public NsdEnabler(Context context, CheckBoxPreference checkBoxPreference) {
+ public NsdEnabler(Context context, SwitchPreference pref) {
mContext = context;
- mCheckbox = checkBoxPreference;
+ mSwitchPreference = pref;
mNsdManager = (NsdManager) mContext.getSystemService(Context.NSD_SERVICE);
mIntentFilter = new IntentFilter(NsdManager.ACTION_NSD_STATE_CHANGED);
}
public void resume() {
mContext.registerReceiver(mReceiver, mIntentFilter);
- mCheckbox.setOnPreferenceChangeListener(this);
+ mSwitchPreference.setOnPreferenceChangeListener(this);
}
public void pause() {
mContext.unregisterReceiver(mReceiver);
- mCheckbox.setOnPreferenceChangeListener(null);
+ mSwitchPreference.setOnPreferenceChangeListener(null);
}
public boolean onPreferenceChange(Preference preference, Object value) {
final boolean desiredState = (Boolean) value;
- mCheckbox.setEnabled(false);
+ mSwitchPreference.setEnabled(false);
mNsdManager.setEnabled(desiredState);
return false;
}
private void handleNsdStateChanged(int newState) {
switch (newState) {
case NsdManager.NSD_STATE_DISABLED:
- mCheckbox.setChecked(false);
- mCheckbox.setEnabled(true);
+ mSwitchPreference.setChecked(false);
+ mSwitchPreference.setEnabled(true);
break;
case NsdManager.NSD_STATE_ENABLED:
- mCheckbox.setChecked(true);
- mCheckbox.setEnabled(true);
+ mSwitchPreference.setChecked(true);
+ mSwitchPreference.setEnabled(true);
break;
}
}
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
+import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.UserHandle;
import android.os.UserManager;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
+import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable.SearchIndexProvider;
+
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Gesture lock pattern settings.
*/
private SwitchPreference mAutoRestore;
private Dialog mConfirmDialog;
private PreferenceScreen mConfigure;
+ private boolean mEnabled;
private static final int DIALOG_ERASE_BACKUP = 2;
private int mDialogType;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ // Don't allow any access if this is a secondary user
+ mEnabled = Process.myUserHandle().isOwner();
+ if (!mEnabled) {
+ return;
+ }
+
addPreferencesFromResource(R.xml.privacy_settings);
final PreferenceScreen screen = getPreferenceScreen();
-
mBackupManager = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
super.onResume();
// Refresh UI
- updateToggles();
+ if (mEnabled) {
+ updateToggles();
+ }
}
@Override
protected int getHelpResource() {
return R.string.help_url_backup_reset;
}
+
+ /**
+ * For Search.
+ */
+ public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new PrivacySearchIndexProvider();
+
+ private static class PrivacySearchIndexProvider extends BaseSearchIndexProvider {
+
+ boolean mIsPrimary;
+
+ public PrivacySearchIndexProvider() {
+ super();
+
+ mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER;
+ }
+
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+
+ List<SearchIndexableResource> result = new ArrayList<SearchIndexableResource>();
+
+ // For non-primary user, no backup or reset is available
+ if (!mIsPrimary) {
+ return result;
+ }
+
+ SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.privacy_settings;
+ result.add(sir);
+
+ return result;
+ }
+ }
+
}
\ No newline at end of file
int resId = getResourceId();
if (resId != 0) {
try {
- Drawable d = resources.getDrawable(resId);
+ Drawable d = getDrawable(resId);
// set to false if the width or height is <= 2
// (missing PNG can return an empty 2x2 pixel Drawable)
regulatoryInfoDrawableExists = (d.getIntrinsicWidth() > 2
package com.android.settings;
-import java.util.HashSet;
-
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.os.UserManager;
-import android.preference.CheckBoxPreference;
-import android.preference.Preference;
/**
* Base class for settings screens that should be pin protected when in restricted mode.
+++ /dev/null
-/*
- * Copyright (C) 2008 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.
- */
-
-package com.android.settings;
-
-import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
-
-import com.android.internal.telephony.TelephonyIntents;
-
-import android.app.Dialog;
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.media.AudioManager;
-import android.media.AudioSystem;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.preference.SeekBarVolumizer;
-import android.preference.VolumePreference;
-import android.provider.Settings;
-import android.provider.Settings.System;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-/**
- * Special preference type that allows configuration of both the ring volume and
- * notification volume.
- */
-public class RingerVolumePreference extends VolumePreference {
- private static final String TAG = "RingerVolumePreference";
- private static final int MSG_RINGER_MODE_CHANGED = 101;
-
- private SeekBarVolumizer [] mSeekBarVolumizer;
-
- // These arrays must all match in length and order
- private static final int[] SEEKBAR_ID = new int[] {
- R.id.media_volume_seekbar,
- R.id.ringer_volume_seekbar,
- R.id.notification_volume_seekbar,
- R.id.alarm_volume_seekbar
- };
-
- private static final int[] SEEKBAR_TYPE = new int[] {
- AudioManager.STREAM_MUSIC,
- AudioManager.STREAM_RING,
- AudioManager.STREAM_NOTIFICATION,
- AudioManager.STREAM_ALARM
- };
-
- private static final int[] CHECKBOX_VIEW_ID = new int[] {
- R.id.media_mute_button,
- R.id.ringer_mute_button,
- R.id.notification_mute_button,
- R.id.alarm_mute_button
- };
-
- private static final int[] SEEKBAR_SECTION_ID = new int[] {
- R.id.media_section,
- R.id.ringer_section,
- R.id.notification_section,
- R.id.alarm_section
- };
-
- private static final int[] SEEKBAR_MUTED_RES_ID = new int[] {
- com.android.internal.R.drawable.ic_audio_vol_mute,
- com.android.internal.R.drawable.ic_audio_ring_notif_mute,
- com.android.internal.R.drawable.ic_audio_notification_mute,
- com.android.internal.R.drawable.ic_audio_alarm_mute
- };
-
- private static final int[] SEEKBAR_UNMUTED_RES_ID = new int[] {
- com.android.internal.R.drawable.ic_audio_vol,
- com.android.internal.R.drawable.ic_audio_ring_notif,
- com.android.internal.R.drawable.ic_audio_notification,
- com.android.internal.R.drawable.ic_audio_alarm
- };
-
- private ImageView[] mCheckBoxes = new ImageView[SEEKBAR_MUTED_RES_ID.length];
- private SeekBar[] mSeekBars = new SeekBar[SEEKBAR_ID.length];
-
- private Handler mHandler = new Handler() {
- public void handleMessage(Message msg) {
- updateSlidersAndMutedStates();
- }
- };
-
- @Override
- public void createActionButtons() {
- setPositiveButtonText(android.R.string.ok);
- setNegativeButtonText(null);
- }
-
- private void updateSlidersAndMutedStates() {
- for (int i = 0; i < SEEKBAR_TYPE.length; i++) {
- int streamType = SEEKBAR_TYPE[i];
- boolean muted = mAudioManager.isStreamMute(streamType);
-
- if (mCheckBoxes[i] != null) {
- if (((streamType == AudioManager.STREAM_RING) ||
- (streamType == AudioManager.STREAM_NOTIFICATION)) &&
- (mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE)) {
- mCheckBoxes[i].setImageResource(
- com.android.internal.R.drawable.ic_audio_ring_notif_vibrate);
- } else {
- mCheckBoxes[i].setImageResource(
- muted ? SEEKBAR_MUTED_RES_ID[i] : SEEKBAR_UNMUTED_RES_ID[i]);
- }
- }
- if (mSeekBars[i] != null) {
- final int volume = mAudioManager.getStreamVolume(streamType);
- mSeekBars[i].setProgress(volume);
- if (streamType != mAudioManager.getMasterStreamType() && muted) {
- mSeekBars[i].setEnabled(false);
- } else {
- mSeekBars[i].setEnabled(true);
- }
- }
- }
- }
-
- private BroadcastReceiver mRingModeChangedReceiver;
- private AudioManager mAudioManager;
-
- //private SeekBarVolumizer mNotificationSeekBarVolumizer;
- //private TextView mNotificationVolumeTitle;
-
- public RingerVolumePreference(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- // The always visible seekbar is for ring volume
- setStreamType(AudioManager.STREAM_RING);
-
- setDialogLayoutResource(R.layout.preference_dialog_ringervolume);
- //setDialogIcon(R.drawable.ic_settings_sound);
-
- mSeekBarVolumizer = new SeekBarVolumizer[SEEKBAR_ID.length];
-
- mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- for (int i = 0; i < SEEKBAR_ID.length; i++) {
- SeekBar seekBar = (SeekBar) view.findViewById(SEEKBAR_ID[i]);
- mSeekBars[i] = seekBar;
- if (SEEKBAR_TYPE[i] == AudioManager.STREAM_MUSIC) {
- mSeekBarVolumizer[i] = new SeekBarVolumizer(getContext(),
- SEEKBAR_TYPE[i], getMediaVolumeUri(getContext()), this);
- mSeekBarVolumizer[i].setSeekBar(seekBar);
- } else {
- mSeekBarVolumizer[i] = new SeekBarVolumizer(getContext(),
- SEEKBAR_TYPE[i], null, this);
- mSeekBarVolumizer[i].setSeekBar(seekBar);
- }
- }
-
- // Register callbacks for mute/unmute buttons
- for (int i = 0; i < mCheckBoxes.length; i++) {
- ImageView checkbox = (ImageView) view.findViewById(CHECKBOX_VIEW_ID[i]);
- mCheckBoxes[i] = checkbox;
- }
-
- // Load initial states from AudioManager
- updateSlidersAndMutedStates();
-
- // Listen for updates from AudioManager
- if (mRingModeChangedReceiver == null) {
- final IntentFilter filter = new IntentFilter();
- filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
- mRingModeChangedReceiver = new BroadcastReceiver() {
- public void onReceive(Context context, Intent intent) {
- final String action = intent.getAction();
- if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(action)) {
- mHandler.sendMessage(mHandler.obtainMessage(MSG_RINGER_MODE_CHANGED, intent
- .getIntExtra(AudioManager.EXTRA_RINGER_MODE, -1), 0));
- }
- }
- };
- getContext().registerReceiver(mRingModeChangedReceiver, filter);
- }
-
- boolean useMasterVolume = getContext().getResources().
- getBoolean(com.android.internal.R.bool.config_useMasterVolume);
- if (useMasterVolume) {
- // If config_useMasterVolume is true, all streams are treated as STREAM_MASTER.
- // So hide all except a stream.
- int id;
- if (Utils.isVoiceCapable(getContext())) {
- id = R.id.ringer_section;
- } else {
- id = R.id.media_section;
- }
- for (int i = 0; i < SEEKBAR_SECTION_ID.length; i++) {
- if (SEEKBAR_SECTION_ID[i] != id) {
- view.findViewById(SEEKBAR_SECTION_ID[i]).setVisibility(View.GONE);
- }
- }
- } else {
- // Disable either ringer+notifications or notifications
- int id;
- if (!Utils.isVoiceCapable(getContext())) {
- id = R.id.ringer_section;
- } else {
- id = R.id.notification_section;
- }
- View hideSection = view.findViewById(id);
- hideSection.setVisibility(View.GONE);
- }
- }
-
- private Uri getMediaVolumeUri(Context context) {
- return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"
- + context.getPackageName()
- + "/" + R.raw.media_volume);
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (!positiveResult) {
- for (SeekBarVolumizer vol : mSeekBarVolumizer) {
- if (vol != null) vol.revertVolume();
- }
- }
- cleanup();
- }
-
- @Override
- public void onActivityStop() {
- super.onActivityStop();
-
- for (SeekBarVolumizer vol : mSeekBarVolumizer) {
- if (vol != null) vol.stopSample();
- }
- }
-
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- boolean isdown = (event.getAction() == KeyEvent.ACTION_DOWN);
- switch (keyCode) {
- case KeyEvent.KEYCODE_VOLUME_DOWN:
- case KeyEvent.KEYCODE_VOLUME_UP:
- case KeyEvent.KEYCODE_VOLUME_MUTE:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void onSampleStarting(SeekBarVolumizer volumizer) {
- super.onSampleStarting(volumizer);
- for (SeekBarVolumizer vol : mSeekBarVolumizer) {
- if (vol != null && vol != volumizer) vol.stopSample();
- }
- }
-
- private void cleanup() {
- for (int i = 0; i < SEEKBAR_ID.length; i++) {
- if (mSeekBarVolumizer[i] != null) {
- Dialog dialog = getDialog();
- if (dialog != null && dialog.isShowing()) {
- // Stopped while dialog was showing, revert changes
- mSeekBarVolumizer[i].revertVolume();
- }
- mSeekBarVolumizer[i].stop();
- mSeekBarVolumizer[i] = null;
- }
- }
- if (mRingModeChangedReceiver != null) {
- getContext().unregisterReceiver(mRingModeChangedReceiver);
- mRingModeChangedReceiver = null;
- }
- }
-
- @Override
- protected Parcelable onSaveInstanceState() {
- final Parcelable superState = super.onSaveInstanceState();
- if (isPersistent()) {
- // No need to save instance state since it's persistent
- return superState;
- }
-
- final SavedState myState = new SavedState(superState);
- VolumeStore[] volumeStore = myState.getVolumeStore(SEEKBAR_ID.length);
- for (int i = 0; i < SEEKBAR_ID.length; i++) {
- SeekBarVolumizer vol = mSeekBarVolumizer[i];
- if (vol != null) {
- vol.onSaveInstanceState(volumeStore[i]);
- }
- }
- return myState;
- }
-
- @Override
- protected void onRestoreInstanceState(Parcelable state) {
- if (state == null || !state.getClass().equals(SavedState.class)) {
- // Didn't save state for us in onSaveInstanceState
- super.onRestoreInstanceState(state);
- return;
- }
-
- SavedState myState = (SavedState) state;
- super.onRestoreInstanceState(myState.getSuperState());
- VolumeStore[] volumeStore = myState.getVolumeStore(SEEKBAR_ID.length);
- for (int i = 0; i < SEEKBAR_ID.length; i++) {
- SeekBarVolumizer vol = mSeekBarVolumizer[i];
- if (vol != null) {
- vol.onRestoreInstanceState(volumeStore[i]);
- }
- }
- }
-
- private static class SavedState extends BaseSavedState {
- VolumeStore [] mVolumeStore;
-
- public SavedState(Parcel source) {
- super(source);
- mVolumeStore = new VolumeStore[SEEKBAR_ID.length];
- for (int i = 0; i < SEEKBAR_ID.length; i++) {
- mVolumeStore[i] = new VolumeStore();
- mVolumeStore[i].volume = source.readInt();
- mVolumeStore[i].originalVolume = source.readInt();
- }
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- super.writeToParcel(dest, flags);
- for (int i = 0; i < SEEKBAR_ID.length; i++) {
- dest.writeInt(mVolumeStore[i].volume);
- dest.writeInt(mVolumeStore[i].originalVolume);
- }
- }
-
- VolumeStore[] getVolumeStore(int count) {
- if (mVolumeStore == null || mVolumeStore.length != count) {
- mVolumeStore = new VolumeStore[count];
- for (int i = 0; i < count; i++) {
- mVolumeStore[i] = new VolumeStore();
- }
- }
- return mVolumeStore;
- }
-
- public SavedState(Parcelable superState) {
- super(superState);
- }
-
- public static final Parcelable.Creator<SavedState> CREATOR =
- new Parcelable.Creator<SavedState>() {
- public SavedState createFromParcel(Parcel in) {
- return new SavedState(in);
- }
-
- public SavedState[] newArray(int size) {
- return new SavedState[size];
- }
- };
- }
-}
import android.security.KeyStore;
import android.service.trust.TrustAgentService;
import android.telephony.TelephonyManager;
+import android.telephony.SubscriptionManager;
+import android.telephony.SubInfoRecord;
import android.text.TextUtils;
import android.util.Log;
}
if (mIsPrimary) {
- switch (mDPM.getStorageEncryptionStatus()) {
- case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
+ if (LockPatternUtils.isDeviceEncryptionEnabled()) {
// The device is currently encrypted.
addPreferencesFromResource(R.xml.security_settings_encrypted);
- break;
- case DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE:
+ } else {
// This device supports encryption but isn't encrypted.
addPreferencesFromResource(R.xml.security_settings_unencrypted);
- break;
}
}
if (!mIsPrimary || !tm.hasIccCard()) {
root.removePreference(root.findPreference(KEY_SIM_LOCK));
} else {
- // Disable SIM lock if sim card is missing or unknown
- if ((TelephonyManager.getDefault().getSimState() ==
- TelephonyManager.SIM_STATE_ABSENT) ||
- (TelephonyManager.getDefault().getSimState() ==
- TelephonyManager.SIM_STATE_UNKNOWN)) {
- root.findPreference(KEY_SIM_LOCK).setEnabled(false);
- }
+ // Disable SIM lock if there is no ready SIM card.
+ root.findPreference(KEY_SIM_LOCK).setEnabled(isSimReady());
}
if (Settings.System.getInt(getContentResolver(),
Settings.System.LOCK_TO_APP_ENABLED, 0) != 0) {
return root;
}
+ /* Return true if a SIM is ready for locking.
+ * TODO: consider adding to TelephonyManager or SubscritpionManasger.
+ */
+ private static boolean isSimReady() {
+ int simState = TelephonyManager.SIM_STATE_UNKNOWN;
+ final List<SubInfoRecord> subInfoList = SubscriptionManager.getActiveSubInfoList();
+ if (subInfoList != null) {
+ for (SubInfoRecord subInfo : subInfoList) {
+ simState = TelephonyManager.getDefault().getSimState(subInfo.slotId);
+ if((simState != TelephonyManager.SIM_STATE_ABSENT) &&
+ (simState != TelephonyManager.SIM_STATE_UNKNOWN)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
private static ArrayList<TrustAgentComponentInfo> getActiveTrustAgents(
PackageManager pm, LockPatternUtils utils) {
ArrayList<TrustAgentComponentInfo> result = new ArrayList<TrustAgentComponentInfo>();
private boolean mNeedToRevertToInitialFragment = false;
private int mHomeActivitiesCount = 1;
+ private Intent mResultIntentData;
+
public SwitchBar getSwitchBar() {
return mSwitchBar;
}
Button backButton = (Button)findViewById(R.id.back_button);
backButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- setResult(RESULT_CANCELED);
+ setResult(RESULT_CANCELED, getResultIntentData());
finish();
}
});
Button skipButton = (Button)findViewById(R.id.skip_button);
skipButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- setResult(RESULT_OK);
+ setResult(RESULT_OK, getResultIntentData());
finish();
}
});
mNextButton = (Button)findViewById(R.id.next_button);
mNextButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- setResult(RESULT_OK);
+ setResult(RESULT_OK, getResultIntentData());
finish();
}
});
mSearchMenuItem.collapseActionView();
}
}
+
+ public Intent getResultIntentData() {
+ return mResultIntentData;
+ }
+
+ public void setResultIntentData(Intent resultIntentData) {
+ mResultIntentData = resultIntentData;
+ }
}
import android.widget.BaseAdapter;
import android.widget.BaseExpandableListAdapter;
import android.widget.Button;
-import android.widget.CheckBox;
import android.widget.ExpandableListView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Spinner;
+import android.widget.Switch;
import android.widget.TabHost;
import android.widget.TextView;
private final int mProgress;
private final int mList;
private final int mExpandableList;
- private final boolean mCheckbox;
+ private final boolean mSwitch;
private Tab(String tag, int label, int view, int progress, int list, int expandableList,
- boolean checkbox) {
+ boolean withSwitch) {
mTag = tag;
mLabel = label;
mView = view;
mProgress = progress;
mList = list;
mExpandableList = expandableList;
- mCheckbox = checkbox;
+ mSwitch = withSwitch;
}
private List<ParcelableString> getAliases(IKeyChainService service) throws RemoteException {
}
private void postOperationUpdate(boolean ok, CertHolder certHolder) {
if (ok) {
- if (certHolder.mTab.mCheckbox) {
+ if (certHolder.mTab.mSwitch) {
certHolder.mDeleted = !certHolder.mDeleted;
} else {
certHolder.mAdapter.remove(certHolder);
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
final UserHandle profile = getGroup(groupPosition);
final UserInfo userInfo = mUserManager.getUserInfo(profile.getIdentifier());
- title.setText(userInfo.name);
+ if (userInfo.isManagedProfile()) {
+ title.setText(R.string.category_work);
+ } else {
+ title.setText(R.string.category_personal);
+ }
title.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_END);
return convertView;
}
public void remove(CertHolder certHolder) {
- final int n = mCertHoldersByUserId.size();
- for (int i = 0; i < n; ++i) {
- mCertHoldersByUserId.valueAt(i).remove(certHolder);
+ if (mCertHoldersByUserId != null) {
+ final List<CertHolder> certs = mCertHoldersByUserId.get(certHolder.mProfileId);
+ if (certs != null) {
+ certs.remove(certHolder);
+ }
}
}
}
convertView.findViewById(R.id.trusted_credential_subject_primary);
holder.mSubjectSecondaryView = (TextView)
convertView.findViewById(R.id.trusted_credential_subject_secondary);
- holder.mCheckBox = (CheckBox) convertView.findViewById(
+ holder.mSwitch = (Switch) convertView.findViewById(
R.id.trusted_credential_status);
convertView.setTag(holder);
} else {
}
holder.mSubjectPrimaryView.setText(certHolder.mSubjectPrimary);
holder.mSubjectSecondaryView.setText(certHolder.mSubjectSecondary);
- if (mTab.mCheckbox) {
- holder.mCheckBox.setChecked(!certHolder.mDeleted);
- holder.mCheckBox.setVisibility(View.VISIBLE);
+ if (mTab.mSwitch) {
+ holder.mSwitch.setChecked(!certHolder.mDeleted);
+ holder.mSwitch.setVisibility(View.VISIBLE);
}
return convertView;
}
private static class ViewHolder {
private TextView mSubjectPrimaryView;
private TextView mSubjectSecondaryView;
- private CheckBox mCheckBox;
+ private Switch mSwitch;
}
private void showCertDialog(final CertHolder certHolder) {
UserInfo userInfo = um.getUserInfo(mUserHandle.getIdentifier());
if (userInfo.isManagedProfile()) {
name = context.getString(R.string.managed_user_title);
- icon = Resources.getSystem().getDrawable(
+ icon = context.getDrawable(
com.android.internal.R.drawable.ic_corp_icon);
} else {
name = userInfo.name;
Bundle metaData = resolveInfo.activityInfo.metaData;
if (res != null && metaData != null) {
- icon = res.getDrawable(metaData.getInt(META_DATA_PREFERENCE_ICON));
+ icon = res.getDrawable(
+ metaData.getInt(META_DATA_PREFERENCE_ICON), null);
title = res.getString(metaData.getInt(META_DATA_PREFERENCE_TITLE));
summary = res.getString(metaData.getInt(META_DATA_PREFERENCE_SUMMARY));
}
/** Formats a double from 0.0..1.0 as a percentage. */
private static String formatPercentage(double percentage) {
- BidiFormatter bf = BidiFormatter.getInstance();
- return bf.unicodeWrap(NumberFormat.getPercentInstance().format(percentage));
+ return NumberFormat.getPercentInstance().format(percentage);
}
public static boolean isBatteryPresent(Intent batteryChangedIntent) {
final TelephonyManager tm =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
- // TODO: Uncomment to re-enable SimSettings.
- // return tm.getSimCount() > 0;
- return false;
+ return tm.getSimCount() > 0;
}
/**
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.admin.DevicePolicyManager;
+import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
+import android.net.Uri;
import android.nfc.NfcAdapter;
import android.nfc.NfcManager;
import android.os.Bundle;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceScreen;
}
private String mManageMobilePlanMessage;
- private static final String CONNECTED_TO_PROVISIONING_NETWORK_ACTION
- = "com.android.server.connectivityservice.CONNECTED_TO_PROVISIONING_NETWORK_ACTION";
public void onManageMobilePlanClick() {
log("onManageMobilePlanClick:");
mManageMobilePlanMessage = null;
// Get provisioning URL
String url = mCm.getMobileProvisioningUrl();
if (!TextUtils.isEmpty(url)) {
- Intent intent = new Intent(CONNECTED_TO_PROVISIONING_NETWORK_ACTION);
- intent.putExtra("EXTRA_URL", url);
- Context context = getActivity().getBaseContext();
- context.sendBroadcast(intent);
- mManageMobilePlanMessage = null;
+ Intent intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
+ Intent.CATEGORY_APP_BROWSER);
+ intent.setData(Uri.parse(url));
+ intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT |
+ Intent.FLAG_ACTIVITY_NEW_TASK);
+ try {
+ startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "onManageMobilePlanClick: startActivity failed" + e);
+ }
} else {
// No provisioning URL
String operatorName = mTm.getSimOperatorName();
mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE);
SwitchPreference nfc = (SwitchPreference) findPreference(KEY_TOGGLE_NFC);
PreferenceScreen androidBeam = (PreferenceScreen) findPreference(KEY_ANDROID_BEAM_SETTINGS);
- CheckBoxPreference nsd = (CheckBoxPreference) findPreference(KEY_TOGGLE_NSD);
+ SwitchPreference nsd = (SwitchPreference) findPreference(KEY_TOGGLE_NSD);
mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference);
mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam);
import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
private PreferenceCategory mServicesCategory;
private PreferenceCategory mSystemsCategory;
- private CheckBoxPreference mToggleLargeTextPreference;
- private CheckBoxPreference mToggleHighTextContrastPreference;
- private CheckBoxPreference mTogglePowerButtonEndsCallPreference;
- private CheckBoxPreference mToggleLockScreenRotationPreference;
- private CheckBoxPreference mToggleSpeakPasswordPreference;
+ private SwitchPreference mToggleLargeTextPreference;
+ private SwitchPreference mToggleHighTextContrastPreference;
+ private SwitchPreference mTogglePowerButtonEndsCallPreference;
+ private SwitchPreference mToggleLockScreenRotationPreference;
+ private SwitchPreference mToggleSpeakPasswordPreference;
private ListPreference mSelectLongPressTimeoutPreference;
private Preference mNoServicesMessagePreference;
private PreferenceScreen mCaptioningPreferenceScreen;
// Large text.
mToggleLargeTextPreference =
- (CheckBoxPreference) findPreference(TOGGLE_LARGE_TEXT_PREFERENCE);
+ (SwitchPreference) findPreference(TOGGLE_LARGE_TEXT_PREFERENCE);
// Text contrast.
mToggleHighTextContrastPreference =
- (CheckBoxPreference) findPreference(TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE);
+ (SwitchPreference) findPreference(TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE);
// Display inversion.
mToggleInversionPreference = (SwitchPreference) findPreference(TOGGLE_INVERSION_PREFERENCE);
// Power button ends calls.
mTogglePowerButtonEndsCallPreference =
- (CheckBoxPreference) findPreference(TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE);
+ (SwitchPreference) findPreference(TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE);
if (!KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER)
|| !Utils.isVoiceCapable(getActivity())) {
mSystemsCategory.removePreference(mTogglePowerButtonEndsCallPreference);
// Lock screen rotation.
mToggleLockScreenRotationPreference =
- (CheckBoxPreference) findPreference(TOGGLE_LOCK_SCREEN_ROTATION_PREFERENCE);
+ (SwitchPreference) findPreference(TOGGLE_LOCK_SCREEN_ROTATION_PREFERENCE);
if (!RotationPolicy.isRotationSupported(getActivity())) {
mSystemsCategory.removePreference(mToggleLockScreenRotationPreference);
}
// Speak passwords.
mToggleSpeakPasswordPreference =
- (CheckBoxPreference) findPreference(TOGGLE_SPEAK_PASSWORD_PREFERENCE);
+ (SwitchPreference) findPreference(TOGGLE_SPEAK_PASSWORD_PREFERENCE);
// Long press timeout.
mSelectLongPressTimeoutPreference =
package com.android.settings.accessibility;
import android.accessibilityservice.AccessibilityServiceInfo;
+import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.widget.TextView;
import com.android.internal.widget.LockPatternUtils;
+import com.android.settings.ConfirmDeviceCredentialActivity;
import com.android.settings.R;
import com.android.settings.widget.ToggleSwitch;
import com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener;
private static final int DIALOG_ID_ENABLE_WARNING = 1;
private static final int DIALOG_ID_DISABLE_WARNING = 2;
+ public static final int ACTIVITY_REQUEST_CONFIRM_CREDENTIAL_FOR_WEAKER_ENCRYPTION = 1;
+
+ private LockPatternUtils mLockPatternUtils;
+
private final SettingsContentObserver mSettingsContentObserver =
new SettingsContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange, Uri uri) {
- String settingValue = Settings.Secure.getString(getContentResolver(),
- Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
- final boolean enabled = settingValue.contains(mComponentName.flattenToString());
- mSwitchBar.setCheckedInternal(enabled);
+ updateSwitchBarToggleSwitch();
}
};
private int mShownDialogId;
@Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mLockPatternUtils = new LockPatternUtils(getActivity());
+ }
+
+ @Override
public void onResume() {
mSettingsContentObserver.register(getContentResolver());
+ updateSwitchBarToggleSwitch();
super.onResume();
}
}
}
+ private void updateSwitchBarToggleSwitch() {
+ final String settingValue = Settings.Secure.getString(getContentResolver(),
+ Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
+ final boolean checked = settingValue != null
+ && settingValue.contains(mComponentName.flattenToString());
+ mSwitchBar.setCheckedInternal(checked);
+ }
+
private View createEnableDialogContentView(AccessibilityServiceInfo info) {
LayoutInflater inflater = (LayoutInflater) getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
ImageView imageView = (ImageView) capabilityView.findViewById(
com.android.internal.R.id.perm_icon);
- imageView.setImageDrawable(getResources().getDrawable(
+ imageView.setImageDrawable(getActivity().getDrawable(
com.android.internal.R.drawable.ic_text_dot));
TextView labelView = (TextView) capabilityView.findViewById(
imageView = (ImageView) capabilityView.findViewById(
com.android.internal.R.id.perm_icon);
- imageView.setImageDrawable(getResources().getDrawable(
+ imageView.setImageDrawable(getActivity().getDrawable(
com.android.internal.R.drawable.ic_text_dot));
labelView = (TextView) capabilityView.findViewById(
}
@Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == ACTIVITY_REQUEST_CONFIRM_CREDENTIAL_FOR_WEAKER_ENCRYPTION) {
+ if (resultCode == Activity.RESULT_OK) {
+ handleConfirmServiceEnabled(true);
+ // The user confirmed that they accept weaker encryption when
+ // enabling the accessibility service, so change encryption.
+ // Since we came here asynchronously, check encryption again.
+ if (LockPatternUtils.isDeviceEncrypted()) {
+ mLockPatternUtils.clearEncryptionPassword();
+ Settings.Global.putInt(getContentResolver(),
+ Settings.Global.REQUIRE_PASSWORD_TO_DECRYPT, 0);
+ }
+ } else {
+ handleConfirmServiceEnabled(false);
+ }
+ }
+ }
+
+ @Override
public void onClick(DialogInterface dialog, int which) {
final boolean checked;
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
- checked = (mShownDialogId == DIALOG_ID_ENABLE_WARNING);
- mSwitchBar.setCheckedInternal(checked);
- getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
- onPreferenceToggled(mPreferenceKey, checked);
+ if (mShownDialogId == DIALOG_ID_ENABLE_WARNING) {
+ if (LockPatternUtils.isDeviceEncrypted()) {
+ String title = createConfirmCredentialReasonMessage();
+ Intent intent = ConfirmDeviceCredentialActivity.createIntent(title, null);
+ startActivityForResult(intent,
+ ACTIVITY_REQUEST_CONFIRM_CREDENTIAL_FOR_WEAKER_ENCRYPTION);
+ } else {
+ handleConfirmServiceEnabled(true);
+ }
+ } else {
+ handleConfirmServiceEnabled(false);
+ }
break;
case DialogInterface.BUTTON_NEGATIVE:
checked = (mShownDialogId == DIALOG_ID_DISABLE_WARNING);
- mSwitchBar.setCheckedInternal(checked);
- getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
- onPreferenceToggled(mPreferenceKey, checked);
+ handleConfirmServiceEnabled(checked);
break;
default:
throw new IllegalArgumentException();
}
}
+ private void handleConfirmServiceEnabled(boolean confirmed) {
+ mSwitchBar.setCheckedInternal(confirmed);
+ getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, confirmed);
+ onPreferenceToggled(mPreferenceKey, confirmed);
+ }
+
+ private String createConfirmCredentialReasonMessage() {
+ int resId = R.string.enable_service_password_reason;
+ switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
+ case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: {
+ resId = R.string.enable_service_pattern_reason;
+ } break;
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX: {
+ resId = R.string.enable_service_pin_reason;
+ } break;
+ }
+ return getString(resId, getAccessibilityServiceInfo().getResolveInfo()
+ .loadLabel(getPackageManager()));
+ }
+
@Override
protected void onInstallSwitchBarToggleSwitch() {
super.onInstallSwitchBarToggleSwitch();
private ImageView mProviderIcon;
private TextView mErrorInfoView;
private Account mAccount;
- private ArrayList<SyncStateCheckBoxPreference> mCheckBoxes =
- new ArrayList<SyncStateCheckBoxPreference>();
+ private ArrayList<SyncStateSwitchPreference> mSwitches =
+ new ArrayList<SyncStateSwitchPreference>();
private ArrayList<SyncAdapterType> mInvisibleAdapters = Lists.newArrayList();
@Override
mAuthenticatorHelper.stopListeningToAccountUpdates();
}
- private void addSyncStateCheckBox(Account account, String authority) {
- SyncStateCheckBoxPreference item =
- new SyncStateCheckBoxPreference(getActivity(), account, authority);
+ private void addSyncStateSwitch(Account account, String authority) {
+ SyncStateSwitchPreference item =
+ new SyncStateSwitchPreference(getActivity(), account, authority);
item.setPersistent(false);
final ProviderInfo providerInfo = getPackageManager().resolveContentProviderAsUser(
authority, 0, mUserHandle.getIdentifier());
String title = getString(R.string.sync_item_title, providerLabel);
item.setTitle(title);
item.setKey(authority);
- mCheckBoxes.add(item);
+ mSwitches.add(item);
}
@Override
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferences, Preference preference) {
- if (preference instanceof SyncStateCheckBoxPreference) {
- SyncStateCheckBoxPreference syncPref = (SyncStateCheckBoxPreference) preference;
+ if (preference instanceof SyncStateSwitchPreference) {
+ SyncStateSwitchPreference syncPref = (SyncStateSwitchPreference) preference;
String authority = syncPref.getAuthority();
Account account = syncPref.getAccount();
final int userId = mUserHandle.getIdentifier();
int count = getPreferenceScreen().getPreferenceCount();
for (int i = 0; i < count; i++) {
Preference pref = getPreferenceScreen().getPreference(i);
- if (! (pref instanceof SyncStateCheckBoxPreference)) {
+ if (! (pref instanceof SyncStateSwitchPreference)) {
continue;
}
- SyncStateCheckBoxPreference syncPref = (SyncStateCheckBoxPreference) pref;
+ SyncStateSwitchPreference syncPref = (SyncStateSwitchPreference) pref;
if (!syncPref.isChecked()) {
continue;
}
List<SyncInfo> currentSyncs = ContentResolver.getCurrentSyncsAsUser(userId);
boolean syncIsFailing = false;
- // Refresh the sync status checkboxes - some syncs may have become active.
- updateAccountCheckboxes();
+ // Refresh the sync status switches - some syncs may have become active.
+ updateAccountSwitches();
for (int i = 0, count = getPreferenceScreen().getPreferenceCount(); i < count; i++) {
Preference pref = getPreferenceScreen().getPreference(i);
- if (! (pref instanceof SyncStateCheckBoxPreference)) {
+ if (! (pref instanceof SyncStateSwitchPreference)) {
continue;
}
- SyncStateCheckBoxPreference syncPref = (SyncStateCheckBoxPreference) pref;
+ SyncStateSwitchPreference syncPref = (SyncStateSwitchPreference) pref;
String authority = syncPref.getAuthority();
Account account = syncPref.getAccount();
finish();
return;
}
- updateAccountCheckboxes();
+ updateAccountSwitches();
onSyncStateUpdated();
}
return false;
}
- private void updateAccountCheckboxes() {
+ private void updateAccountSwitches() {
mInvisibleAdapters.clear();
SyncAdapterType[] syncAdapters = ContentResolver.getSyncAdapterTypesAsUser(
if (!sa.accountType.equals(mAccount.type)) continue;
if (sa.isUserVisible()) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "updateAccountCheckboxes: added authority " + sa.authority
+ Log.d(TAG, "updateAccountSwitches: added authority " + sa.authority
+ " to accountType " + sa.accountType);
}
authorities.add(sa.authority);
}
}
- for (int i = 0, n = mCheckBoxes.size(); i < n; i++) {
- getPreferenceScreen().removePreference(mCheckBoxes.get(i));
+ for (int i = 0, n = mSwitches.size(); i < n; i++) {
+ getPreferenceScreen().removePreference(mSwitches.get(i));
}
- mCheckBoxes.clear();
+ mSwitches.clear();
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.d(TAG, "looking for sync adapters that match account " + mAccount);
Log.d(TAG, " found authority " + authority + " " + syncState);
}
if (syncState > 0) {
- addSyncStateCheckBox(mAccount, authority);
+ addSyncStateSwitch(mAccount, authority);
}
}
- Collections.sort(mCheckBoxes);
- for (int i = 0, n = mCheckBoxes.size(); i < n; i++) {
- getPreferenceScreen().addPreference(mCheckBoxes.get(i));
+ Collections.sort(mSwitches);
+ for (int i = 0, n = mSwitches.size(); i < n; i++) {
+ getPreferenceScreen().addPreference(mSwitches.get(i));
}
}
Context authContext = context.createPackageContextAsUser(desc.packageName, 0,
mUserHandle);
icon = mContext.getPackageManager().getUserBadgedIcon(
- authContext.getResources().getDrawable(desc.iconId), mUserHandle);
+ authContext.getDrawable(desc.iconId), mUserHandle);
synchronized (mAccTypeIconCache) {
mAccTypeIconCache.put(accountType, icon);
}
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
Context authContext = createPackageContextAsUser(desc.packageName, 0, mUserHandle);
icon = getPackageManager().getUserBadgedIcon(
- authContext.getResources().getDrawable(desc.iconId), mUserHandle);
+ authContext.getDrawable(desc.iconId), mUserHandle);
} catch (PackageManager.NameNotFoundException e) {
// TODO: place holder icon for missing account icons?
Log.w(TAG, "No icon name for account type " + accountType);
import android.accounts.Account;
import android.app.ActivityManager;
import android.content.Context;
-import android.preference.CheckBoxPreference;
+import android.preference.SwitchPreference;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import com.android.settings.R;
import com.android.settings.widget.AnimatedImageView;
-public class SyncStateCheckBoxPreference extends CheckBoxPreference {
+public class SyncStateSwitchPreference extends SwitchPreference {
private boolean mIsActive = false;
private boolean mIsPending = false;
*/
private boolean mOneTimeSyncMode = false;
- public SyncStateCheckBoxPreference(Context context, AttributeSet attrs) {
+ public SyncStateSwitchPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setWidgetLayoutResource(R.layout.preference_widget_sync_toggle);
mAccount = null;
mAuthority = null;
}
- public SyncStateCheckBoxPreference(Context context, Account account, String authority) {
+ public SyncStateSwitchPreference(Context context, Account account, String authority) {
super(context, null);
mAccount = account;
mAuthority = authority;
final boolean failedVisible = mFailed && !activeVisible;
syncFailedView.setVisibility(failedVisible ? View.VISIBLE : View.GONE);
- View checkBox = view.findViewById(android.R.id.checkbox);
+ View switchView = view.findViewById(com.android.internal.R.id.switchWidget);
if (mOneTimeSyncMode) {
- checkBox.setVisibility(View.GONE);
+ switchView.setVisibility(View.GONE);
/*
* Override the summary. Fill in the %1$s with the existing summary
TextView summary = (TextView) view.findViewById(android.R.id.summary);
summary.setText(getContext().getString(R.string.sync_one_time_sync, getSummary()));
} else {
- checkBox.setVisibility(View.VISIBLE);
+ switchView.setVisibility(View.VISIBLE);
}
}
@Override
protected void onClick() {
// When we're in one-time sync mode, we don't want a click to change the
- // checkbox state
+ // Switch state
if (!mOneTimeSyncMode) {
if (ActivityManager.isUserAMonkey()) {
Log.d("SyncState", "ignoring monkey's attempt to flip sync state");
return mIcon;
}
- return mState.mContext.getResources().getDrawable(
+ return mState.mContext.getDrawable(
android.R.drawable.sym_def_app_icon);
}
return true;
} else {
this.mounted = false;
- this.icon = context.getResources().getDrawable(
+ this.icon = context.getDrawable(
com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
}
} else if (!this.mounted) {
private View mListContainer;
- private ViewGroup mPinnedHeader;
-
// ListView used to display list
private ListView mListView;
// Custom view used to display running processes
if (mRootView != null) {
return mRootView;
}
-
mInflater = inflater;
mRootView = inflater.inflate(mListType == LIST_TYPE_RUNNING
? R.layout.manage_applications_running
: R.layout.manage_applications_apps, null);
- mPinnedHeader = (ViewGroup) mRootView.findViewById(R.id.pinned_header);
- if (mOwner.mProfileSpinnerAdapter != null) {
- Spinner spinner = (Spinner) inflater.inflate(R.layout.spinner_view, null);
- spinner.setAdapter(mOwner.mProfileSpinnerAdapter);
- spinner.setOnItemSelectedListener(mOwner);
- mPinnedHeader.addView(spinner);
- mPinnedHeader.setVisibility(View.VISIBLE);
- }
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
mLoadingContainer.setVisibility(View.VISIBLE);
mListContainer = mRootView.findViewById(R.id.list_container);
private ViewGroup mContentContainer;
private View mRootView;
private ViewPager mViewPager;
+ private ViewGroup mPinnedHeader;
private UserSpinnerAdapter mProfileSpinnerAdapter;
+ private Spinner mSpinner;
private Context mContext;
AlertDialog mResetDialog;
container, false);
mContentContainer = container;
mRootView = rootView;
-
+ mPinnedHeader = (ViewGroup) mRootView.findViewById(R.id.pinned_header);
+ if (mProfileSpinnerAdapter != null) {
+ mSpinner = (Spinner) inflater.inflate(R.layout.spinner_view, null);
+ mSpinner.setAdapter(mProfileSpinnerAdapter);
+ mSpinner.setOnItemSelectedListener(this);
+ mPinnedHeader.addView(mSpinner);
+ mPinnedHeader.setVisibility(View.VISIBLE);
+ }
mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
MyPagerAdapter adapter = new MyPagerAdapter();
mViewPager.setAdapter(adapter);
int currentTab = mViewPager.getCurrentItem();
intent.putExtra(EXTRA_LIST_TYPE, mTabs.get(currentTab).mListType);
mContext.startActivityAsUser(intent, selectedUser);
+ // Go back to default selection, which is the first one; this makes sure that pressing
+ // the back button takes you into a consistent state
+ mSpinner.setSelection(0);
}
}
return constState.newDrawable();
}
}
- return context.getResources().getDrawable(
+ return context.getDrawable(
com.android.internal.R.drawable.ic_menu_cc);
}
}
}
public void setupSwitchBar() {
- mSwitchBar.addOnSwitchChangeListener(this);
mSwitchBar.show();
}
public void teardownSwitchBar() {
- mSwitchBar.removeOnSwitchChangeListener(this);
mSwitchBar.hide();
}
// Bluetooth state is not sticky, so set it manually
handleStateChanged(mLocalAdapter.getBluetoothState());
+ mSwitchBar.addOnSwitchChangeListener(this);
mContext.registerReceiver(mReceiver, mIntentFilter);
mValidListener = true;
}
return;
}
+ mSwitchBar.removeOnSwitchChangeListener(this);
mContext.unregisterReceiver(mReceiver);
mValidListener = false;
}
int iconResource = profile.getDrawableResource(mCachedDevice.getBtClass());
if (iconResource != 0) {
- pref.setIcon(getResources().getDrawable(iconResource));
+ pref.setIcon(getActivity().getDrawable(iconResource));
}
refreshProfilePreference(pref, profile);
import android.os.UserHandle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
-import android.telephony.CellBroadcastMessage;
-import android.telephony.PhoneNumberUtils;
-import android.telephony.PhoneStateListener;
-import android.telephony.ServiceState;
-import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.Toast;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.PhoneStateIntentReceiver;
import com.android.internal.util.ArrayUtils;
import com.android.settings.R;
import com.android.settings.Utils;
/**
* Display the following information
- * # Phone Number
- * # Network
- * # Roaming
- * # Device Id (IMEI in GSM and MEID in CDMA)
- * # Network type
- * # Operator info (area info cell broadcast for Brazil)
- * # Signal Strength
* # Battery Strength : TODO
* # Uptime
* # Awake Time
*/
public class Status extends PreferenceActivity {
- private static final String KEY_DATA_STATE = "data_state";
- private static final String KEY_SERVICE_STATE = "service_state";
- private static final String KEY_OPERATOR_NAME = "operator_name";
- private static final String KEY_ROAMING_STATE = "roaming_state";
- private static final String KEY_NETWORK_TYPE = "network_type";
- private static final String KEY_LATEST_AREA_INFO = "latest_area_info";
- private static final String KEY_PHONE_NUMBER = "number";
- private static final String KEY_IMEI_SV = "imei_sv";
- private static final String KEY_IMEI = "imei";
- private static final String KEY_PRL_VERSION = "prl_version";
- private static final String KEY_MIN_NUMBER = "min_number";
- private static final String KEY_MEID_NUMBER = "meid_number";
- private static final String KEY_SIGNAL_STRENGTH = "signal_strength";
private static final String KEY_BATTERY_STATUS = "battery_status";
private static final String KEY_BATTERY_LEVEL = "battery_level";
private static final String KEY_IP_ADDRESS = "wifi_ip_address";
private static final String KEY_WIFI_MAC_ADDRESS = "wifi_mac_address";
private static final String KEY_BT_ADDRESS = "bt_address";
private static final String KEY_SERIAL_NUMBER = "serial_number";
- private static final String KEY_ICC_ID = "icc_id";
private static final String KEY_WIMAX_MAC_ADDRESS = "wimax_mac_address";
- private static final String[] PHONE_RELATED_ENTRIES = {
- KEY_DATA_STATE,
- KEY_SERVICE_STATE,
- KEY_OPERATOR_NAME,
- KEY_ROAMING_STATE,
- KEY_NETWORK_TYPE,
- KEY_LATEST_AREA_INFO,
- KEY_PHONE_NUMBER,
- KEY_IMEI,
- KEY_IMEI_SV,
- KEY_PRL_VERSION,
- KEY_MIN_NUMBER,
- KEY_MEID_NUMBER,
- KEY_SIGNAL_STRENGTH,
- KEY_ICC_ID
- };
-
- static final String CB_AREA_INFO_RECEIVED_ACTION =
- "android.cellbroadcastreceiver.CB_AREA_INFO_RECEIVED";
-
- static final String GET_LATEST_CB_AREA_INFO_ACTION =
- "android.cellbroadcastreceiver.GET_LATEST_CB_AREA_INFO";
-
- // Require the sender to have this permission to prevent third-party spoofing.
- static final String CB_AREA_INFO_SENDER_PERMISSION =
- "android.permission.RECEIVE_EMERGENCY_BROADCAST";
+ private static final String KEY_SIM_STATUS = "sim_status";
// Broadcasts to listen to for connectivity changes.
private static final String[] CONNECTIVITY_INTENTS = {
WifiManager.NETWORK_STATE_CHANGED_ACTION,
};
- private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 200;
- private static final int EVENT_SERVICE_STATE_CHANGED = 300;
-
private static final int EVENT_UPDATE_STATS = 500;
private static final int EVENT_UPDATE_CONNECTIVITY = 600;
private ConnectivityManager mCM;
- private TelephonyManager mTelephonyManager;
private WifiManager mWifiManager;
- private Phone mPhone = null;
- private PhoneStateIntentReceiver mPhoneStateReceiver;
private Resources mRes;
- private boolean mShowLatestAreaInfo;
private String mUnknown;
private String mUnavailable;
- private Preference mSignalStrength;
private Preference mUptime;
private Preference mBatteryStatus;
private Preference mBatteryLevel;
}
switch (msg.what) {
- case EVENT_SIGNAL_STRENGTH_CHANGED:
- status.updateSignalStrength();
- break;
-
- case EVENT_SERVICE_STATE_CHANGED:
- ServiceState serviceState = status.mPhoneStateReceiver.getServiceState();
- status.updateServiceState(serviceState);
- break;
-
case EVENT_UPDATE_STATS:
status.updateTimes();
sendEmptyMessageDelayed(EVENT_UPDATE_STATS, 1000);
}
};
- private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
- @Override
- public void onDataConnectionStateChanged(int state) {
- updateDataState();
- updateNetworkType();
- }
- };
-
- private BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (CB_AREA_INFO_RECEIVED_ACTION.equals(action)) {
- Bundle extras = intent.getExtras();
- if (extras == null) {
- return;
- }
- CellBroadcastMessage cbMessage = (CellBroadcastMessage) extras.get("message");
- if (cbMessage != null && cbMessage.getServiceCategory() == 50) {
- String latestAreaInfo = cbMessage.getMessageBody();
- updateAreaInfo(latestAreaInfo);
- }
- }
- }
- };
-
private IntentFilter mConnectivityIntentFilter;
private final BroadcastReceiver mConnectivityReceiver = new BroadcastReceiver() {
@Override
mHandler = new MyHandler(this);
mCM = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
- mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
addPreferencesFromResource(R.xml.device_info_status);
mUnknown = mRes.getString(R.string.device_info_default);
mUnavailable = mRes.getString(R.string.status_unavailable);
- if (UserHandle.myUserId() == UserHandle.USER_OWNER) {
- mPhone = PhoneFactory.getDefaultPhone();
- }
// Note - missing in zaku build, be careful later...
- mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH);
mUptime = findPreference("up_time");
- if (mPhone == null || Utils.isWifiOnly(getApplicationContext())) {
- for (String key : PHONE_RELATED_ENTRIES) {
- removePreferenceFromScreen(key);
- }
- } else {
- // NOTE "imei" is the "Device ID" since it represents
- // the IMEI in GSM and the MEID in CDMA
- if (mPhone.getPhoneName().equals("CDMA")) {
- setSummaryText(KEY_MEID_NUMBER, mPhone.getMeid());
- setSummaryText(KEY_MIN_NUMBER, mPhone.getCdmaMin());
- if (getResources().getBoolean(R.bool.config_msid_enable)) {
- findPreference(KEY_MIN_NUMBER).setTitle(R.string.status_msid_number);
- }
- setSummaryText(KEY_PRL_VERSION, mPhone.getCdmaPrlVersion());
- removePreferenceFromScreen(KEY_IMEI_SV);
-
- if (mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
- // Show ICC ID and IMEI for LTE device
- setSummaryText(KEY_ICC_ID, mPhone.getIccSerialNumber());
- setSummaryText(KEY_IMEI, mPhone.getImei());
- } else {
- // device is not GSM/UMTS, do not display GSM/UMTS features
- // check Null in case no specified preference in overlay xml
- removePreferenceFromScreen(KEY_IMEI);
- removePreferenceFromScreen(KEY_ICC_ID);
- }
- } else {
- setSummaryText(KEY_IMEI, mPhone.getDeviceId());
-
- setSummaryText(KEY_IMEI_SV,
- ((TelephonyManager) getSystemService(TELEPHONY_SERVICE))
- .getDeviceSoftwareVersion());
-
- // device is not CDMA, do not display CDMA features
- // check Null in case no specified preference in overlay xml
- removePreferenceFromScreen(KEY_PRL_VERSION);
- removePreferenceFromScreen(KEY_MEID_NUMBER);
- removePreferenceFromScreen(KEY_MIN_NUMBER);
- removePreferenceFromScreen(KEY_ICC_ID);
-
- // only show area info when SIM country is Brazil
- if ("br".equals(mTelephonyManager.getSimCountryIso())) {
- mShowLatestAreaInfo = true;
- }
- }
-
- String rawNumber = mTelephonyManager.getLine1Number(); // may be null or empty
- String formattedNumber = null;
- if (!TextUtils.isEmpty(rawNumber)) {
- formattedNumber = PhoneNumberUtils.formatNumber(rawNumber);
- }
- // If formattedNumber is null or empty, it'll display as "Unknown".
- setSummaryText(KEY_PHONE_NUMBER, formattedNumber);
-
- mPhoneStateReceiver = new PhoneStateIntentReceiver(this, mHandler);
- mPhoneStateReceiver.notifySignalStrength(EVENT_SIGNAL_STRENGTH_CHANGED);
- mPhoneStateReceiver.notifyServiceState(EVENT_SERVICE_STATE_CHANGED);
-
- if (!mShowLatestAreaInfo) {
- removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
- }
- }
-
if (!hasBluetooth()) {
getPreferenceScreen().removePreference(mBtAddress);
mBtAddress = null;
@Override
protected void onResume() {
super.onResume();
-
- if (mPhone != null && !Utils.isWifiOnly(getApplicationContext())) {
- mPhoneStateReceiver.registerIntent();
-
- updateSignalStrength();
- updateServiceState(mPhone.getServiceState());
- updateDataState();
- mTelephonyManager.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
- if (mShowLatestAreaInfo) {
- registerReceiver(mAreaInfoReceiver, new IntentFilter(CB_AREA_INFO_RECEIVED_ACTION),
- CB_AREA_INFO_SENDER_PERMISSION, null);
- // Ask CellBroadcastReceiver to broadcast the latest area info received
- Intent getLatestIntent = new Intent(GET_LATEST_CB_AREA_INFO_ACTION);
- sendBroadcastAsUser(getLatestIntent, UserHandle.ALL,
- CB_AREA_INFO_SENDER_PERMISSION);
- }
- }
registerReceiver(mConnectivityReceiver, mConnectivityIntentFilter,
android.Manifest.permission.CHANGE_NETWORK_STATE, null);
registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
public void onPause() {
super.onPause();
- if (mPhone != null && !Utils.isWifiOnly(getApplicationContext())) {
- mPhoneStateReceiver.unregisterIntent();
- mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
- }
- if (mShowLatestAreaInfo) {
- unregisterReceiver(mAreaInfoReceiver);
- }
unregisterReceiver(mBatteryInfoReceiver);
unregisterReceiver(mConnectivityReceiver);
mHandler.removeMessages(EVENT_UPDATE_STATS);
}
}
- private void updateNetworkType() {
- // Whether EDGE, UMTS, etc...
- String networktype = null;
- if (TelephonyManager.NETWORK_TYPE_UNKNOWN != mTelephonyManager.getNetworkType()) {
- networktype = mTelephonyManager.getNetworkTypeName();
- }
- setSummaryText(KEY_NETWORK_TYPE, networktype);
- }
-
- private void updateDataState() {
- int state = mTelephonyManager.getDataState();
- String display = mRes.getString(R.string.radioInfo_unknown);
-
- switch (state) {
- case TelephonyManager.DATA_CONNECTED:
- display = mRes.getString(R.string.radioInfo_data_connected);
- break;
- case TelephonyManager.DATA_SUSPENDED:
- display = mRes.getString(R.string.radioInfo_data_suspended);
- break;
- case TelephonyManager.DATA_CONNECTING:
- display = mRes.getString(R.string.radioInfo_data_connecting);
- break;
- case TelephonyManager.DATA_DISCONNECTED:
- display = mRes.getString(R.string.radioInfo_data_disconnected);
- break;
- }
-
- setSummaryText(KEY_DATA_STATE, display);
- }
-
- private void updateServiceState(ServiceState serviceState) {
- int state = serviceState.getState();
- String display = mRes.getString(R.string.radioInfo_unknown);
-
- switch (state) {
- case ServiceState.STATE_IN_SERVICE:
- display = mRes.getString(R.string.radioInfo_service_in);
- break;
- case ServiceState.STATE_OUT_OF_SERVICE:
- case ServiceState.STATE_EMERGENCY_ONLY:
- display = mRes.getString(R.string.radioInfo_service_out);
- break;
- case ServiceState.STATE_POWER_OFF:
- display = mRes.getString(R.string.radioInfo_service_off);
- break;
- }
-
- setSummaryText(KEY_SERVICE_STATE, display);
-
- if (serviceState.getRoaming()) {
- setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in));
- } else {
- setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_not));
- }
- setSummaryText(KEY_OPERATOR_NAME, serviceState.getOperatorAlphaLong());
- }
-
- private void updateAreaInfo(String areaInfo) {
- if (areaInfo != null) {
- setSummaryText(KEY_LATEST_AREA_INFO, areaInfo);
- }
- }
-
- void updateSignalStrength() {
- // TODO PhoneStateIntentReceiver is deprecated and PhoneStateListener
- // should probably used instead.
-
- // not loaded in some versions of the code (e.g., zaku)
- if (mSignalStrength != null) {
- int state =
- mPhoneStateReceiver.getServiceState().getState();
- Resources r = getResources();
-
- if ((ServiceState.STATE_OUT_OF_SERVICE == state) ||
- (ServiceState.STATE_POWER_OFF == state)) {
- mSignalStrength.setSummary("0");
- }
-
- int signalDbm = mPhoneStateReceiver.getSignalStrengthDbm();
-
- if (-1 == signalDbm) signalDbm = 0;
-
- int signalAsu = mPhoneStateReceiver.getSignalStrengthLevelAsu();
-
- if (-1 == signalAsu) signalAsu = 0;
-
- mSignalStrength.setSummary(String.valueOf(signalDbm) + " "
- + r.getString(R.string.radioInfo_display_dbm) + " "
- + String.valueOf(signalAsu) + " "
- + r.getString(R.string.radioInfo_display_asu));
- }
- }
-
private void setWimaxStatus() {
if (mWimaxMacAddress != null) {
String macAddress = SystemProperties.get("net.wimax.mac.address", mUnavailable);
break;
}
if (iconId > 0) {
- icon = context.getResources().getDrawable(iconId);
+ icon = context.getDrawable(iconId);
}
if ((name == null || iconId == 0) && this.sipper.uidObj != null) {
getQuickNameIconForUid(this.sipper.uidObj);
name = context.getResources().getString(R.string.process_mediaserver_label);
}
iconId = R.drawable.ic_power_system;
- icon = context.getResources().getDrawable(iconId);
+ icon = context.getDrawable(iconId);
return;
} else {
//name = packages[0];
mMinPercentLabelString = Utils.formatPercentage(0);
mBatteryLevel = com.android.settings.Utils.getBatteryLevel(mBatteryBroadcast);
+ String batteryPercentString = Utils.formatPercentage(mBatteryLevel);
long remainingTimeUs = 0;
mDischarging = true;
if (mBatteryBroadcast.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) == 0) {
String timeString = Formatter.formatShortElapsedTime(getContext(),
drainTime / 1000);
mChargeLabelString = getContext().getResources().getString(
- R.string.power_discharging_duration, mBatteryLevel, timeString);
+ R.string.power_discharging_duration, batteryPercentString, timeString);
} else {
- mChargeLabelString = Utils.formatPercentage(mBatteryLevel);
+ mChargeLabelString = batteryPercentString;
}
} else {
final long chargeTime = mStats.computeChargeTimeRemaining(elapsedRealtimeUs);
resId = R.string.power_charging_duration;
}
mChargeLabelString = getContext().getResources().getString(
- resId, mBatteryLevel, timeString);
+ resId, batteryPercentString, timeString);
} else {
mChargeLabelString = getContext().getResources().getString(
- R.string.power_charging, mBatteryLevel, statusLabel);
+ R.string.power_charging, batteryPercentString, statusLabel);
}
}
mDrainString = "";
if (mLargeMode) {
if (DEBUG) Log.d(TAG, "Drawing large mode labels");
+ Paint.Align align = mTextPaint.getTextAlign();
+ mTextPaint.setTextAlign(textAlignLeft); // large-mode labels always aligned to start
if (mHavePhoneSignal) {
canvas.drawText(mPhoneSignalLabel, textStartX,
height - mPhoneSignalOffset - mTextDescent, mTextPaint);
height - mChargingOffset - mTextDescent, mTextPaint);
canvas.drawText(mScreenOnLabel, textStartX,
height - mScreenOnOffset - mTextDescent, mTextPaint);
+ mTextPaint.setTextAlign(align);
}
canvas.drawLine(mLevelLeft-mThinLineWidth, mLevelTop, mLevelLeft-mThinLineWidth,
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
import com.android.settings.notification.SettingPref;
import com.android.settings.widget.SwitchBar;
@Override
protected String getCaption(Resources res, int value) {
if (value > 0 && value < 100) {
- return res.getString(R.string.battery_saver_turn_on_automatically_pct, value);
+ return res.getString(R.string.battery_saver_turn_on_automatically_pct,
+ Utils.formatPercentage(value));
}
return res.getString(R.string.battery_saver_turn_on_automatically_never);
}
// Use default icon
}
} else if (iconId != 0) {
- mAppIcon = getActivity().getResources().getDrawable(iconId);
+ mAppIcon = getActivity().getDrawable(iconId);
}
if (mAppIcon == null) {
mAppIcon = getActivity().getPackageManager().getDefaultActivityIcon();
import android.content.IntentFilter;
import android.graphics.drawable.Drawable;
import android.os.BatteryStats;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
if (percentOfTotal < 10) {
continue;
}
+ if ("user".equals(Build.TYPE)) {
+ continue;
+ }
}
if (sipper.drainType == BatterySipper.DrainType.UNACCOUNTED) {
// Don't show over-counted unless it is at least 1/2 the size of
if (percentOfTotal < 5) {
continue;
}
+ if ("user".equals(Build.TYPE)) {
+ continue;
+ }
}
final UserHandle userHandle = new UserHandle(UserHandle.getUserId(sipper.getUid()));
final BatteryEntry entry = new BatteryEntry(getActivity(), mHandler, mUm, sipper);
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.res.Configuration;
-import android.content.res.Resources;
import android.database.ContentObserver;
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.InputManager;
import android.hardware.input.KeyboardLayout;
import android.os.Bundle;
import android.os.Handler;
-import android.os.UserHandle;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
+import android.preference.SwitchPreference;
import android.provider.Settings;
import android.provider.Settings.System;
-import android.speech.RecognitionService;
import android.speech.tts.TtsEngines;
import android.text.TextUtils;
import android.view.InputDevice;
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
}
- } else if (preference instanceof CheckBoxPreference) {
- final CheckBoxPreference chkPref = (CheckBoxPreference) preference;
- if (chkPref == mGameControllerCategory.findPreference("vibrate_input_devices")) {
+ } else if (preference instanceof SwitchPreference) {
+ final SwitchPreference pref = (SwitchPreference) preference;
+ if (pref == mGameControllerCategory.findPreference("vibrate_input_devices")) {
System.putInt(getContentResolver(), Settings.System.VIBRATE_INPUT_DEVICES,
- chkPref.isChecked() ? 1 : 0);
+ pref.isChecked() ? 1 : 0);
return true;
}
}
if (haveInputDeviceWithVibrator()) {
getPreferenceScreen().addPreference(mGameControllerCategory);
- CheckBoxPreference chkPref = (CheckBoxPreference)
+ SwitchPreference pref = (SwitchPreference)
mGameControllerCategory.findPreference("vibrate_input_devices");
- chkPref.setChecked(System.getInt(getContentResolver(),
+ pref.setChecked(System.getInt(getContentResolver(),
Settings.System.VIBRATE_INPUT_DEVICES, 1) > 0);
} else {
getPreferenceScreen().removePreference(mGameControllerCategory);
if (info != null) {
if (info.isManagedProfile()) {
detail.label = res.getString(R.string.managed_user_title);
- detail.icon = Resources.getSystem().getDrawable(
+ detail.icon = mContext.getDrawable(
com.android.internal.R.drawable.ic_corp_icon);
} else {
detail.label = res.getString(R.string.running_process_item_user_label,
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
+import android.preference.SwitchPreference;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
emptyImage.setVisibility(View.VISIBLE);
getListView().setVisibility(View.GONE);
} else {
- CheckBoxPreference foreground = new CheckBoxPreference(getActivity());
+ SwitchPreference foreground = new SwitchPreference(getActivity());
boolean foregroundMode = mPaymentBackend.isForegroundMode();
foreground.setPersistent(false);
foreground.setTitle(getString(R.string.nfc_payment_favor_foreground));
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
- if (preference instanceof CheckBoxPreference) {
+ if (preference instanceof SwitchPreference) {
mPaymentBackend.setForegroundMode(((Boolean) newValue).booleanValue());
return true;
} else {
private Parcelable mListViewState;
private Backend mBackend = new Backend();
private UserSpinnerAdapter mProfileSpinnerAdapter;
+ private Spinner mSpinner;
private PackageManager mPM;
private UserManager mUM;
super.onViewCreated(view, savedInstanceState);
mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(mUM, mContext);
if (mProfileSpinnerAdapter != null) {
- Spinner spinner = (Spinner) getActivity().getLayoutInflater().inflate(
+ mSpinner = (Spinner) getActivity().getLayoutInflater().inflate(
R.layout.spinner_view, null);
- spinner.setAdapter(mProfileSpinnerAdapter);
- spinner.setOnItemSelectedListener(this);
- setPinnedHeaderView(spinner);
+ mSpinner.setAdapter(mProfileSpinnerAdapter);
+ mSpinner.setOnItemSelectedListener(this);
+ setPinnedHeaderView(mSpinner);
}
}
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
mContext.startActivityAsUser(intent, selectedUser);
+ // Go back to default selection, which is the first one; this makes sure that pressing
+ // the back button takes you into a consistent state
+ mSpinner.setSelection(0);
}
}
}
try {
- return r.getDrawable(resId);
+ return r.getDrawable(resId, null);
} catch (RuntimeException e) {
Log.w(TAG, "Icon not found in "
+ (pkg != null ? resId : "<system>")
}
};
}
+ mVolumizer.start();
mVolumizer.setSeekBar(mSeekBar);
mIconView = (ImageView) view.findViewById(com.android.internal.R.id.icon);
mCallback.onStreamValueChanged(mStream, mSeekBar.getProgress());
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.Utils;
-import com.android.settings.notification.DropDownPreference.Callback;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
private static final String KEY_ZEN_MODE = "zen_mode";
private static final String KEY_IMPORTANT = "important";
- private static final String KEY_CALLS = "phone_calls";
+ private static final String KEY_CALLS = "calls";
private static final String KEY_MESSAGES = "messages";
private static final String KEY_STARRED = "starred";
private static final String KEY_EVENTS = "events";
private static SparseArray<String> allKeyTitles(Context context) {
final SparseArray<String> rt = new SparseArray<String>();
rt.put(R.string.zen_mode_important_category, KEY_IMPORTANT);
- if (Utils.isVoiceCapable(context)) {
- rt.put(R.string.zen_mode_phone_calls, KEY_CALLS);
- rt.put(R.string.zen_mode_option_title, KEY_ZEN_MODE);
- } else {
- rt.put(R.string.zen_mode_option_title_novoice, KEY_ZEN_MODE);
- }
+ rt.put(R.string.zen_mode_calls, KEY_CALLS);
+ rt.put(R.string.zen_mode_option_title, KEY_ZEN_MODE);
rt.put(R.string.zen_mode_messages, KEY_MESSAGES);
rt.put(R.string.zen_mode_from_starred, KEY_STARRED);
rt.put(R.string.zen_mode_events, KEY_EVENTS);
mConfig = getZenModeConfig();
if (DEBUG) Log.d(TAG, "Loaded mConfig=" + mConfig);
- final Preference zenMode = PREF_ZEN_MODE.init(this);
+ PREF_ZEN_MODE.init(this);
PREF_ZEN_MODE.setCallback(new SettingPrefWithCallback.Callback() {
@Override
public void onSettingSelected(int value) {
}
}
});
- if (!Utils.isVoiceCapable(mContext)) {
- zenMode.setTitle(R.string.zen_mode_option_title_novoice);
- }
final PreferenceCategory important =
(PreferenceCategory) root.findPreference(KEY_IMPORTANT);
mCalls = (SwitchPreference) important.findPreference(KEY_CALLS);
- if (Utils.isVoiceCapable(mContext)) {
- mCalls.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- if (mDisableListeners) return true;
- final boolean val = (Boolean) newValue;
- if (val == mConfig.allowCalls) return true;
- if (DEBUG) Log.d(TAG, "onPrefChange allowCalls=" + val);
- final ZenModeConfig newConfig = mConfig.copy();
- newConfig.allowCalls = val;
- return setZenModeConfig(newConfig);
- }
- });
- } else {
- important.removePreference(mCalls);
- mCalls = null;
- }
+ mCalls.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (mDisableListeners) return true;
+ final boolean val = (Boolean) newValue;
+ if (val == mConfig.allowCalls) return true;
+ if (DEBUG) Log.d(TAG, "onPrefChange allowCalls=" + val);
+ final ZenModeConfig newConfig = mConfig.copy();
+ newConfig.allowCalls = val;
+ return setZenModeConfig(newConfig);
+ }
+ });
mMessages = (SwitchPreference) important.findPreference(KEY_MESSAGES);
mMessages.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
}
return result;
}
-
- public List<String> getNonIndexableKeys(Context context) {
- final ArrayList<String> rt = new ArrayList<String>();
- if (!Utils.isVoiceCapable(context)) {
- rt.add(KEY_CALLS);
- }
- return rt;
- }
};
private static class SettingPrefWithCallback extends SettingPref {
private PrintJobsController mPrintJobsController;
private UserSpinnerAdapter mProfileSpinnerAdapter;
+ private Spinner mSpinner;
@Override
public void onCreate(Bundle icicle) {
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(um, getActivity());
if (mProfileSpinnerAdapter != null) {
- Spinner spinner = (Spinner) getActivity().getLayoutInflater().inflate(
+ mSpinner = (Spinner) getActivity().getLayoutInflater().inflate(
R.layout.spinner_view, null);
- spinner.setAdapter(mProfileSpinnerAdapter);
- spinner.setOnItemSelectedListener(this);
- setPinnedHeaderView(spinner);
+ mSpinner.setAdapter(mProfileSpinnerAdapter);
+ mSpinner.setOnItemSelectedListener(this);
+ setPinnedHeaderView(mSpinner);
}
}
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
getActivity().startActivityAsUser(intent, selectedUser);
+ // Go back to default selection, which is the first one
+ mSpinner.setSelection(0);
}
}
import com.android.settings.accessibility.AccessibilitySettings;
import com.android.settings.bluetooth.BluetoothSettings;
import com.android.settings.deviceinfo.Memory;
+import com.android.settings.deviceinfo.UsbSettings;
import com.android.settings.fuelgauge.BatterySaverSettings;
import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
public static final int RANK_DISPLAY = 7;
public static final int RANK_WALLPAPER = 8;
public static final int RANK_NOTIFICATIONS = 9;
- public static final int RANK_MEMORY = 10;
+ public static final int RANK_STORAGE = 10;
public static final int RANK_POWER_USAGE = 11;
public static final int RANK_USERS = 12;
public static final int RANK_LOCATION = 13;
sRankMap.put(OtherSoundSettings.class.getName(), RANK_NOTIFICATIONS);
sRankMap.put(ZenModeSettings.class.getName(), RANK_NOTIFICATIONS);
- // Memory
- sRankMap.put(Memory.class.getName(), RANK_MEMORY);
+ // Storage
+ sRankMap.put(Memory.class.getName(), RANK_STORAGE);
+ sRankMap.put(UsbSettings.class.getName(), RANK_STORAGE);
// Battery
sRankMap.put(PowerUsageSummary.class.getName(), RANK_POWER_USAGE);
import com.android.settings.accessibility.AccessibilitySettings;
import com.android.settings.bluetooth.BluetoothSettings;
import com.android.settings.deviceinfo.Memory;
+import com.android.settings.deviceinfo.UsbSettings;
import com.android.settings.fuelgauge.BatterySaverSettings;
import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
Memory.class.getName(),
R.drawable.ic_settings_storage));
+ sResMap.put(UsbSettings.class.getName(),
+ new SearchIndexableResource(
+ Ranking.getRankForClassName(UsbSettings.class.getName()),
+ R.xml.usb_settings,
+ UsbSettings.class.getName(),
+ R.drawable.ic_settings_storage));
+
sResMap.put(PowerUsageSummary.class.getName(),
new SearchIndexableResource(
Ranking.getRankForClassName(PowerUsageSummary.class.getName()),
sResMap.put(PrivacySettings.class.getName(),
new SearchIndexableResource(
Ranking.getRankForClassName(PrivacySettings.class.getName()),
- R.xml.privacy_settings,
+ NO_DATA_RES_ID,
PrivacySettings.class.getName(),
R.drawable.ic_settings_backup));
import com.android.settings.R;
import android.app.AlertDialog;
+import android.app.Fragment;
import android.content.BroadcastReceiver;
import android.content.Context;
+import android.content.ContentUris;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.DialogInterface;
import android.content.res.Resources;
+import android.database.Cursor;
+import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
import android.preference.ListPreference;
import android.preference.Preference;
+import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceScreen;
+import android.provider.Telephony;
import android.telephony.SubInfoRecord;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import android.telephony.PhoneNumberUtils;
import android.telecom.PhoneAccount;
import android.telephony.CellInfo;
import android.text.TextUtils;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ListAdapter;
import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.TelephonyIntents;
import com.android.settings.RestrictedSettingsFragment;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.search.SearchIndexableRaw;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
public class SimSettings extends RestrictedSettingsFragment implements Indexable {
private static final String KEY_CALLS = "sim_calls";
private static final String KEY_SMS = "sim_sms";
private static final String KEY_ACTIVITIES = "activities";
+ private static final int ID_INDEX = 0;
+ private static final int NAME_INDEX = 1;
+ private static final int APN_INDEX = 2;
+ private static final int PROXY_INDEX = 3;
+ private static final int PORT_INDEX = 4;
+ private static final int USER_INDEX = 5;
+ private static final int SERVER_INDEX = 6;
+ private static final int PASSWORD_INDEX = 7;
+ private static final int MMSC_INDEX = 8;
+ private static final int MCC_INDEX = 9;
+ private static final int MNC_INDEX = 10;
+ private static final int NUMERIC_INDEX = 11;
+ private static final int MMSPROXY_INDEX = 12;
+ private static final int MMSPORT_INDEX = 13;
+ private static final int AUTH_TYPE_INDEX = 14;
+ private static final int TYPE_INDEX = 15;
+ private static final int PROTOCOL_INDEX = 16;
+ private static final int CARRIER_ENABLED_INDEX = 17;
+ private static final int BEARER_INDEX = 18;
+ private static final int ROAMING_PROTOCOL_INDEX = 19;
+ private static final int MVNO_TYPE_INDEX = 20;
+ private static final int MVNO_MATCH_DATA_INDEX = 21;
+ private static final int DATA_PICK = 0;
+ private static final int CALLS_PICK = 1;
+ private static final int SMS_PICK = 2;
/**
- * By UX design we have use only one Subscription Information(SubInfo) record per SIM slot.
+ * By UX design we use only one Subscription Information(SubInfo) record per SIM slot.
* mAvalableSubInfos is the list of SubInfos we present to the user.
* mSubInfoList is the list of all SubInfos.
*/
private SubInfoRecord mCalls = null;
private SubInfoRecord mSMS = null;
+ private PreferenceCategory mSimCards = null;
+
private int mNumSims;
+ /**
+ * Standard projection for the interesting columns of a normal note.
+ */
+ private static final String[] sProjection = new String[] {
+ Telephony.Carriers._ID, // 0
+ Telephony.Carriers.NAME, // 1
+ Telephony.Carriers.APN, // 2
+ Telephony.Carriers.PROXY, // 3
+ Telephony.Carriers.PORT, // 4
+ Telephony.Carriers.USER, // 5
+ Telephony.Carriers.SERVER, // 6
+ Telephony.Carriers.PASSWORD, // 7
+ Telephony.Carriers.MMSC, // 8
+ Telephony.Carriers.MCC, // 9
+ Telephony.Carriers.MNC, // 10
+ Telephony.Carriers.NUMERIC, // 11
+ Telephony.Carriers.MMSPROXY,// 12
+ Telephony.Carriers.MMSPORT, // 13
+ Telephony.Carriers.AUTH_TYPE, // 14
+ Telephony.Carriers.TYPE, // 15
+ Telephony.Carriers.PROTOCOL, // 16
+ Telephony.Carriers.CARRIER_ENABLED, // 17
+ Telephony.Carriers.BEARER, // 18
+ Telephony.Carriers.ROAMING_PROTOCOL, // 19
+ Telephony.Carriers.MVNO_TYPE, // 20
+ Telephony.Carriers.MVNO_MATCH_DATA // 21
+ };
public SimSettings() {
super(DISALLOW_CONFIG_SIM);
addPreferencesFromResource(R.xml.sim_settings);
- final PreferenceCategory simCards = (PreferenceCategory)findPreference(SIM_CARD_CATEGORY);
+ mSimCards = (PreferenceCategory)findPreference(SIM_CARD_CATEGORY);
final int numSlots = tm.getSimCount();
mAvailableSubInfos = new ArrayList<SubInfoRecord>(numSlots);
mNumSims = 0;
for (int i = 0; i < numSlots; ++i) {
final SubInfoRecord sir = findRecordBySlotId(i);
- simCards.addPreference(new SimPreference(getActivity(), sir, i));
+ mSimCards.addPreference(new SimPreference(getActivity(), sir, i));
mAvailableSubInfos.add(sir);
if (sir != null) {
mNumSims++;
updateActivitesCategory();
}
+ private void updateAvailableSubInfos(){
+ final TelephonyManager tm =
+ (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
+ final int numSlots = tm.getSimCount();
+
+ mNumSims = 0;
+ mAvailableSubInfos = new ArrayList<SubInfoRecord>(numSlots);
+ for (int i = 0; i < numSlots; ++i) {
+ final SubInfoRecord sir = findRecordBySlotId(i);
+ mAvailableSubInfos.add(sir);
+ if (sir != null) {
+ mNumSims++;
+ }
+ }
+ }
+
private void updateAllOptions() {
updateSimSlotValues();
updateActivitesCategory();
private void updateSimSlotValues() {
SubscriptionManager.getAllSubInfoList();
- final PreferenceCategory simCards = (PreferenceCategory)findPreference(SIM_CARD_CATEGORY);
- final PreferenceScreen prefScreen = getPreferenceScreen();
- final int prefSize = prefScreen.getPreferenceCount();
+ final int prefSize = mSimCards.getPreferenceCount();
for (int i = 0; i < prefSize; ++i) {
- Preference pref = prefScreen.getPreference(i);
+ Preference pref = mSimCards.getPreference(i);
if (pref instanceof SimPreference) {
((SimPreference)pref).update();
}
}
private void updateActivitesCategory() {
- createDropDown((DropDownPreference) findPreference(KEY_CELLULAR_DATA));
- createDropDown((DropDownPreference) findPreference(KEY_CALLS));
- createDropDown((DropDownPreference) findPreference(KEY_SMS));
-
updateCellularDataValues();
updateCallValues();
updateSmsValues();
}
private void updateSmsValues() {
- final DropDownPreference simPref = (DropDownPreference) findPreference(KEY_SMS);
+ final Preference simPref = (Preference) findPreference(KEY_SMS);
final SubInfoRecord sir = findRecordBySubId(SubscriptionManager.getDefaultSmsSubId());
- if (sir != null) {
- simPref.setSelectedItem(sir.slotId + 1);
+ simPref.setTitle(R.string.sms_messages_title);
+ if (mSubInfoList.size() == 1) {
+ simPref.setSummary(mSubInfoList.get(0).displayName);
+ } else if (sir != null) {
+ simPref.setSummary(sir.displayName);
+ } else if (sir == null) {
+ simPref.setSummary(R.string.sim_selection_required_pref);
}
- simPref.setEnabled(mNumSims > 1);
+ simPref.setEnabled(mNumSims >= 1);
}
private void updateCellularDataValues() {
- final DropDownPreference simPref = (DropDownPreference) findPreference(KEY_CELLULAR_DATA);
+ final Preference simPref = (Preference) findPreference(KEY_CELLULAR_DATA);
final SubInfoRecord sir = findRecordBySubId(SubscriptionManager.getDefaultDataSubId());
- if (sir != null) {
- simPref.setSelectedItem(sir.slotId);
+ simPref.setTitle(R.string.cellular_data_title);
+ if (mSubInfoList.size() == 1) {
+ simPref.setSummary(mSubInfoList.get(0).displayName);
+ } else if (sir != null) {
+ simPref.setSummary(sir.displayName);
+ } else if (sir == null) {
+ simPref.setSummary(R.string.sim_selection_required_pref);
}
- simPref.setEnabled(mNumSims > 1);
+ simPref.setEnabled(mNumSims >= 1);
}
private void updateCallValues() {
- final DropDownPreference simPref = (DropDownPreference) findPreference(KEY_CALLS);
+ final Preference simPref = (Preference) findPreference(KEY_CALLS);
final SubInfoRecord sir = findRecordBySubId(SubscriptionManager.getDefaultVoiceSubId());
- if (sir != null) {
- simPref.setSelectedItem(sir.slotId + 1);
+ simPref.setTitle(R.string.calls_title);
+ if (mSubInfoList.size() == 1) {
+ simPref.setSummary(mSubInfoList.get(0).displayName);
+ } else if (sir != null) {
+ simPref.setSummary(sir.displayName);
+ } else if (sir == null) {
+ simPref.setSummary(R.string.sim_calls_ask_first_prefs_title);
}
- simPref.setEnabled(mNumSims > 1);
+ simPref.setEnabled(mNumSims >= 1);
}
@Override
public void onResume() {
super.onResume();
+
+ mSubInfoList = SubscriptionManager.getActiveSubInfoList();
+ updateAvailableSubInfos();
updateAllOptions();
}
final Preference preference) {
if (preference instanceof SimPreference) {
((SimPreference)preference).createEditDialog((SimPreference)preference);
+ } else if ((Preference) findPreference(KEY_CELLULAR_DATA) == preference) {
+ showDialog(DATA_PICK);
+ } else if ((Preference) findPreference(KEY_CALLS) == preference) {
+ showDialog(CALLS_PICK);
+ } else if ((Preference) findPreference(KEY_SMS) == preference) {
+ showDialog(SMS_PICK);
}
return true;
}
- public void createDropDown(DropDownPreference preference) {
- final DropDownPreference simPref = preference;
- final String keyPref = simPref.getKey();
- final boolean askFirst = keyPref.equals(KEY_CALLS) || keyPref.equals(KEY_SMS);
+ @Override
+ public Dialog onCreateDialog(final int id) {
+ final ArrayList<String> list = new ArrayList<String>();
+ final int availableSubInfoLength = mAvailableSubInfos.size();
- simPref.clearItems();
+ final DialogInterface.OnClickListener selectionListener =
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int value) {
+
+ final SubInfoRecord sir;
+
+ if (id == DATA_PICK) {
+ sir = mAvailableSubInfos.get(value);
+ SubscriptionManager.setDefaultDataSubId(sir.subId);
+ } else if (id == CALLS_PICK) {
+ if (value != 0) {
+ sir = mAvailableSubInfos.get(value -1);
+ SubscriptionManager.setDefaultVoiceSubId(sir.subId);
+ } else {
+ SubscriptionManager
+ .setDefaultVoiceSubId(SubscriptionManager.ASK_USER_SUB_ID);
+ }
+ } else if (id == SMS_PICK) {
+ sir = mAvailableSubInfos.get(value);
+ SubscriptionManager.setDefaultSmsSubId(sir.subId);
+ }
+
+ updateActivitesCategory();
+ }
+ };
- if (askFirst) {
- simPref.addItem(getResources().getString(
- R.string.sim_calls_ask_first_prefs_title), null);
+ if (id == CALLS_PICK) {
+ list.add(getResources().getString(R.string.sim_calls_ask_first_prefs_title));
}
-
- final int subAvailableSize = mAvailableSubInfos.size();
- for (int i = 0; i < subAvailableSize; ++i) {
+ for (int i = 0; i < availableSubInfoLength; ++i) {
final SubInfoRecord sir = mAvailableSubInfos.get(i);
- if(sir != null){
- simPref.addItem(sir.displayName, sir);
- }
+ list.add(sir.displayName);
}
- simPref.setCallback(new DropDownPreference.Callback() {
- @Override
- public boolean onItemSelected(int pos, Object value) {
- final long subId = value == null ? 0 : ((SubInfoRecord)value).subId;
-
- if (simPref.getKey().equals(KEY_CELLULAR_DATA)) {
- SubscriptionManager.setDefaultDataSubId(subId);
- } else if (simPref.getKey().equals(KEY_CALLS)) {
- SubscriptionManager.setDefaultVoiceSubId(subId);
- } else if (simPref.getKey().equals(KEY_SMS)) {
- // TODO: uncomment once implemented. Bug: 16520931
- // SubscriptionManager.setDefaultSMSSubId(subId);
- }
+ String[] arr = new String[availableSubInfoLength];
+ arr = list.toArray(arr);
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+ ListAdapter adapter = new SelectAccountListAdapter(
+ builder.getContext(),
+ R.layout.select_account_list_item,
+ arr);
+
+ if (id == DATA_PICK) {
+ builder.setTitle(R.string.select_sim_for_data);
+ } else if (id == CALLS_PICK) {
+ builder.setTitle(R.string.select_sim_for_calls);
+ } else if (id == SMS_PICK) {
+ builder.setTitle(R.string.sim_card_select_title);
+ }
+
+ return builder.setAdapter(adapter, selectionListener)
+ .create();
+ }
- return true;
+ private class SelectAccountListAdapter extends ArrayAdapter<String> {
+ private Context mContext;
+ private int mResId;
+
+ public SelectAccountListAdapter(
+ Context context, int resource, String[] arr) {
+ super(context, resource, arr);
+ mContext = context;
+ mResId = resource;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ LayoutInflater inflater = (LayoutInflater)
+ mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ View rowView;
+ final ViewHolder holder;
+
+ if (convertView == null) {
+ // Cache views for faster scrolling
+ rowView = inflater.inflate(mResId, null);
+ holder = new ViewHolder();
+ holder.textView = (TextView) rowView.findViewById(R.id.text);
+ holder.imageView = (ImageView) rowView.findViewById(R.id.icon);
+ rowView.setTag(holder);
+ }
+ else {
+ rowView = convertView;
+ holder = (ViewHolder) rowView.getTag();
}
- });
+
+ holder.textView.setText(getItem(position));
+ holder.imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_sim_sd));
+ return rowView;
+ }
+
+ private class ViewHolder {
+ TextView textView;
+ ImageView imageView;
+ }
}
private void setActivity(Preference preference, SubInfoRecord sir) {
public void update() {
final Resources res = getResources();
- setTitle(res.getString(R.string.sim_card_number_title, mSlotId + 1));
if (mSubInfoRecord != null) {
- setSummary(res.getString(R.string.sim_settings_summary,
- mSubInfoRecord.displayName, mSubInfoRecord.number));
+ if(TextUtils.isEmpty(mSubInfoRecord.displayName)) {
+ setTitle(getCarrierName());
+ mSubInfoRecord.displayName = getCarrierName();
+ SubscriptionManager.setDisplayName(getCarrierName(), mSubInfoRecord.subId);
+ } else {
+ setTitle(mSubInfoRecord.displayName);
+ }
+ setSummary(mSubInfoRecord.number.toString());
setEnabled(true);
} else {
setSummary(R.string.sim_slot_empty);
}
}
+ public String getCarrierName() {
+ Uri mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, mSubInfoRecord.subId);
+ Cursor mCursor = getActivity().managedQuery(mUri, sProjection, null, null);
+ mCursor.moveToFirst();
+ return mCursor.getString(1);
+ }
+
+ public String getFormattedPhoneNumber() {
+ try{
+ final String rawNumber = PhoneFactory.getPhone(mSlotId).getLine1Number();
+ String formattedNumber = null;
+ if (!TextUtils.isEmpty(rawNumber)) {
+ formattedNumber = PhoneNumberUtils.formatNumber(rawNumber);
+ }
+
+ return formattedNumber;
+ } catch (java.lang.IllegalStateException ise){
+ return "Unknown";
+ }
+ }
+
+ public SubInfoRecord getSubInfoRecord() {
+ return mSubInfoRecord;
+ }
+
public void createEditDialog(SimPreference simPref) {
+ final Resources res = getResources();
+
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final View dialogLayout = getActivity().getLayoutInflater().inflate(
nameText.setText(mSubInfoRecord.displayName);
TextView numberView = (TextView)dialogLayout.findViewById(R.id.number);
- numberView.setText(mSubInfoRecord.number);
+ numberView.setText(simPref.getFormattedPhoneNumber());
TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier);
- carrierView.setText(mSubInfoRecord.displayName);
+ carrierView.setText(getCarrierName());
- builder.setTitle(R.string.sim_editor_title);
+ builder.setTitle(String.format(res.getString(R.string.sim_editor_title),
+ (mSubInfoRecord.slotId + 1)));
builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
final EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name);
- final Spinner displayNumbers =
- (Spinner)dialogLayout.findViewById(R.id.display_numbers);
-
- SubscriptionManager.setDisplayNumberFormat(
- displayNumbers.getSelectedItemPosition() == 0
- ? SubscriptionManager.DISPLAY_NUMBER_LAST
- : SubscriptionManager.DISPLAY_NUMBER_FIRST, mSubInfoRecord.subId);
mSubInfoRecord.displayName = nameText.getText().toString();
SubscriptionManager.setDisplayName(mSubInfoRecord.displayName,
mSubInfoRecord.subId);
+ findRecordBySubId(mSubInfoRecord.subId).displayName =
+ nameText.getText().toString();
+
updateAllOptions();
update();
}
}
/**
+ * Sort Subscription List in SIM Id, Subscription Id
+ * @param context The Context
+ * @return Sorted Subscription List or NULL if no activated Subscription
+ */
+ public static List<SubInfoRecord> getSortedSubInfoList(Context context) {
+ List<SubInfoRecord> infoList = SubscriptionManager.getActiveSubInfoList();
+ if (infoList != null) {
+ Collections.sort(infoList, new Comparator<SubInfoRecord>() {
+
+ @Override
+ public int compare(SubInfoRecord arg0, SubInfoRecord arg1) {
+ int flag = arg0.slotId - arg1.slotId;
+ if (flag == 0) {
+ return (int) (arg0.subId - arg1.subId);
+ }
+ return flag;
+ }
+ });
+ }
+ return infoList;
+ }
+
+ /**
* For search
*/
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
-import android.graphics.ColorFilter;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.MultiSelectListPreference;
import android.preference.Preference;
Preference p = null;
switch (entry.getType()) {
case RestrictionEntry.TYPE_BOOLEAN:
- p = new CheckBoxPreference(context);
+ p = new SwitchPreference(context);
p.setTitle(entry.getTitle());
p.setSummary(entry.getDescription());
- ((CheckBoxPreference)p).setChecked(entry.getSelectedState());
+ ((SwitchPreference)p).setChecked(entry.getSelectedState());
break;
case RestrictionEntry.TYPE_CHOICE:
case RestrictionEntry.TYPE_CHOICE_LEVEL:
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
+import java.util.List;
+
/**
* Settings screen for configuring a specific user. It can contain user restrictions
* and deletion controls. It is shown when you tap on the settings icon in the
// SMS is always disabled for guest
mDefaultGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
mUserManager.setDefaultGuestRestrictions(mDefaultGuestRestrictions);
+ // Update the guest's restrictions, if there is a guest
+ List<UserInfo> users = mUserManager.getUsers(true);
+ for (UserInfo user: users) {
+ if (user.isGuest()) {
+ UserHandle userHandle = new UserHandle(user.id);
+ Bundle userRestrictions = mUserManager.getUserRestrictions(userHandle);
+ userRestrictions.putAll(mDefaultGuestRestrictions);
+ mUserManager.setUserRestrictions(userRestrictions, userHandle);
+ }
+ }
} else {
// TODO: Show confirmation dialog: b/15761405
UserHandle userHandle = new UserHandle(mUserInfo.id);
}
private UserInfo createLimitedUser() {
- UserInfo newUserInfo = mUserManager.createUser(
+ UserInfo newUserInfo = mUserManager.createSecondaryUser(
getResources().getString(R.string.user_new_profile_name),
UserInfo.FLAG_RESTRICTED);
int userId = newUserInfo.id;
}
private UserInfo createTrustedUser() {
- UserInfo newUserInfo = mUserManager.createUser(
+ UserInfo newUserInfo = mUserManager.createSecondaryUser(
getResources().getString(R.string.user_new_user_name), 0);
if (newUserInfo != null) {
assignDefaultPhoto(newUserInfo);
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
+import android.preference.SwitchPreference;
import android.provider.Settings;
import android.util.Slog;
import android.util.TypedValue;
}
// switch for Listen Mode
- CheckBoxPreference cbp = new CheckBoxPreference(getActivity()) {
+ SwitchPreference pref = new SwitchPreference(getActivity()) {
@Override
protected void onClick() {
mListen = !mListen;
setChecked(mListen);
}
};
- cbp.setTitle(R.string.wifi_display_listen_mode);
- cbp.setChecked(mListen);
- mCertCategory.addPreference(cbp);
+ pref.setTitle(R.string.wifi_display_listen_mode);
+ pref.setChecked(mListen);
+ mCertCategory.addPreference(pref);
// switch for Autonomous GO
- cbp = new CheckBoxPreference(getActivity()) {
+ pref = new SwitchPreference(getActivity()) {
@Override
protected void onClick() {
mAutoGO = !mAutoGO;
setChecked(mAutoGO);
}
};
- cbp.setTitle(R.string.wifi_display_autonomous_go);
- cbp.setChecked(mAutoGO);
- mCertCategory.addPreference(cbp);
+ pref.setTitle(R.string.wifi_display_autonomous_go);
+ pref.setChecked(mAutoGO);
+ mCertCategory.addPreference(pref);
// Drop down list for choosing WPS method (PBC/KEYPAD/DISPLAY)
ListPreference lp = new ListPreference(getActivity()) {
import android.net.wifi.WifiManager;
import android.net.wifi.WpsInfo;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
final int configsSize = configs.size();
for (int i = 0; i < configsSize; ++i){
- AccessPoint accessPoint = new AccessPoint(context, configs.get(i));
+ WifiConfiguration config = configs.get(i);
+ if (config.selfAdded && config.numAssociation == 0) {
+ continue;
+ }
+ AccessPoint accessPoint = new AccessPoint(context, config);
final List<ScanResult> results = resultsMap.get(accessPoint.ssid);
accessPoint.setShowSummary(false);
break;
case WifiManager.WIFI_AP_STATE_DISABLING:
mSwitch.setSummary(R.string.wifi_tether_stopping);
+ mSwitch.setChecked(false);
mSwitch.setEnabled(false);
break;
case WifiManager.WIFI_AP_STATE_DISABLED: