diff options
Diffstat (limited to 'packages/SettingsProvider')
29 files changed, 1153 insertions, 590 deletions
diff --git a/packages/SettingsProvider/Android.mk b/packages/SettingsProvider/Android.mk index 724e988..bf4ab1b 100644 --- a/packages/SettingsProvider/Android.mk +++ b/packages/SettingsProvider/Android.mk @@ -1,7 +1,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE_TAGS := user +LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(call all-subdir-java-files) diff --git a/packages/SettingsProvider/AndroidManifest.xml b/packages/SettingsProvider/AndroidManifest.xml index 1e1d729..d057ab7 100644 --- a/packages/SettingsProvider/AndroidManifest.xml +++ b/packages/SettingsProvider/AndroidManifest.xml @@ -2,8 +2,6 @@ package="com.android.providers.settings" android:sharedUserId="android.uid.system"> - <uses-permission android:name="android.permission.BACKUP_DATA" /> - <application android:allowClearUserData="false" android:label="@string/app_label" android:process="system" diff --git a/packages/SettingsProvider/etc/Android.mk b/packages/SettingsProvider/etc/Android.mk deleted file mode 100644 index 81ca4b1..0000000 --- a/packages/SettingsProvider/etc/Android.mk +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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. -# - -LOCAL_PATH := $(my-dir) - -######################## -include $(CLEAR_VARS) - -LOCAL_MODULE := bookmarks.xml - -LOCAL_MODULE_TAGS := user - -# This will install the file in /system/etc -# -LOCAL_MODULE_CLASS := ETC - -LOCAL_SRC_FILES := $(LOCAL_MODULE) - -include $(BUILD_PREBUILT) - diff --git a/packages/SettingsProvider/res/values-cs/strings.xml b/packages/SettingsProvider/res/values-cs/strings.xml index 2b089d9..a28ffa1 100644 --- a/packages/SettingsProvider/res/values-cs/strings.xml +++ b/packages/SettingsProvider/res/values-cs/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Paměť pro nastavení"</string> diff --git a/packages/SettingsProvider/res/values-da/strings.xml b/packages/SettingsProvider/res/values-da/strings.xml index bc160f3..ed450d5 100644 --- a/packages/SettingsProvider/res/values-da/strings.xml +++ b/packages/SettingsProvider/res/values-da/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Lagring af indstillinger"</string> diff --git a/packages/SettingsProvider/res/values-de/strings.xml b/packages/SettingsProvider/res/values-de/strings.xml index a293522..6effbae 100644 --- a/packages/SettingsProvider/res/values-de/strings.xml +++ b/packages/SettingsProvider/res/values-de/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Einstellungsspeicher"</string> diff --git a/packages/SettingsProvider/res/values-el/strings.xml b/packages/SettingsProvider/res/values-el/strings.xml index 1cac86d..5bd1fa6 100644 --- a/packages/SettingsProvider/res/values-el/strings.xml +++ b/packages/SettingsProvider/res/values-el/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Αποθηκευτικός χώρος ρυθμίσεων"</string> diff --git a/packages/SettingsProvider/res/values-es-rUS/strings.xml b/packages/SettingsProvider/res/values-es-rUS/strings.xml index de3958b..7a15d8b 100644 --- a/packages/SettingsProvider/res/values-es-rUS/strings.xml +++ b/packages/SettingsProvider/res/values-es-rUS/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Almacenamiento de configuración"</string> diff --git a/packages/SettingsProvider/res/values-es/strings.xml b/packages/SettingsProvider/res/values-es/strings.xml index de3958b..7a15d8b 100644 --- a/packages/SettingsProvider/res/values-es/strings.xml +++ b/packages/SettingsProvider/res/values-es/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Almacenamiento de configuración"</string> diff --git a/packages/SettingsProvider/res/values-fr/strings.xml b/packages/SettingsProvider/res/values-fr/strings.xml index 7a1386a..c90eb09 100644 --- a/packages/SettingsProvider/res/values-fr/strings.xml +++ b/packages/SettingsProvider/res/values-fr/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Stockage des paramètres"</string> diff --git a/packages/SettingsProvider/res/values-it/strings.xml b/packages/SettingsProvider/res/values-it/strings.xml index f88a654..40735cc 100644 --- a/packages/SettingsProvider/res/values-it/strings.xml +++ b/packages/SettingsProvider/res/values-it/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Archiviazione impostazioni"</string> diff --git a/packages/SettingsProvider/res/values-ja/strings.xml b/packages/SettingsProvider/res/values-ja/strings.xml index ffd57e6..d222ca9 100644 --- a/packages/SettingsProvider/res/values-ja/strings.xml +++ b/packages/SettingsProvider/res/values-ja/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"ストレージの設定"</string> diff --git a/packages/SettingsProvider/res/values-ko/strings.xml b/packages/SettingsProvider/res/values-ko/strings.xml index aab51d6..8e0cc75 100644 --- a/packages/SettingsProvider/res/values-ko/strings.xml +++ b/packages/SettingsProvider/res/values-ko/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"설정 저장소"</string> diff --git a/packages/SettingsProvider/res/values-nb/strings.xml b/packages/SettingsProvider/res/values-nb/strings.xml index c96b1eb..ad18f94 100644 --- a/packages/SettingsProvider/res/values-nb/strings.xml +++ b/packages/SettingsProvider/res/values-nb/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Lagring av innstillinger"</string> diff --git a/packages/SettingsProvider/res/values-nl/strings.xml b/packages/SettingsProvider/res/values-nl/strings.xml index 7a0e416..010fdb5 100644 --- a/packages/SettingsProvider/res/values-nl/strings.xml +++ b/packages/SettingsProvider/res/values-nl/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Opslagruimte voor instellingen"</string> diff --git a/packages/SettingsProvider/res/values-pl/strings.xml b/packages/SettingsProvider/res/values-pl/strings.xml index ccff82e3..9f81e63 100644 --- a/packages/SettingsProvider/res/values-pl/strings.xml +++ b/packages/SettingsProvider/res/values-pl/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Pamięć ustawień"</string> diff --git a/packages/SettingsProvider/res/values-pt-rPT/strings.xml b/packages/SettingsProvider/res/values-pt-rPT/strings.xml index 1e1dccb..6bd62e3 100644 --- a/packages/SettingsProvider/res/values-pt-rPT/strings.xml +++ b/packages/SettingsProvider/res/values-pt-rPT/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Armazenamento de Definições"</string> diff --git a/packages/SettingsProvider/res/values-pt/strings.xml b/packages/SettingsProvider/res/values-pt/strings.xml index c4af964..ade1746 100644 --- a/packages/SettingsProvider/res/values-pt/strings.xml +++ b/packages/SettingsProvider/res/values-pt/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Armazenamento de configurações"</string> diff --git a/packages/SettingsProvider/res/values-ru/strings.xml b/packages/SettingsProvider/res/values-ru/strings.xml index bcf92fa..4c15984 100644 --- a/packages/SettingsProvider/res/values-ru/strings.xml +++ b/packages/SettingsProvider/res/values-ru/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Хранилище настроек"</string> diff --git a/packages/SettingsProvider/res/values-sv/strings.xml b/packages/SettingsProvider/res/values-sv/strings.xml index fa3f5cb..b6de084 100644 --- a/packages/SettingsProvider/res/values-sv/strings.xml +++ b/packages/SettingsProvider/res/values-sv/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Lagring av inställningar"</string> diff --git a/packages/SettingsProvider/res/values-tr/strings.xml b/packages/SettingsProvider/res/values-tr/strings.xml index dc36cda..e99e99b 100644 --- a/packages/SettingsProvider/res/values-tr/strings.xml +++ b/packages/SettingsProvider/res/values-tr/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"Ayarlar Deposu"</string> diff --git a/packages/SettingsProvider/res/values-zh-rCN/strings.xml b/packages/SettingsProvider/res/values-zh-rCN/strings.xml index daf1254..11c5d6c 100644 --- a/packages/SettingsProvider/res/values-zh-rCN/strings.xml +++ b/packages/SettingsProvider/res/values-zh-rCN/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"设置存储"</string> diff --git a/packages/SettingsProvider/res/values-zh-rTW/strings.xml b/packages/SettingsProvider/res/values-zh-rTW/strings.xml index 0700a76..977c9b9 100644 --- a/packages/SettingsProvider/res/values-zh-rTW/strings.xml +++ b/packages/SettingsProvider/res/values-zh-rTW/strings.xml @@ -1,18 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- +/** + * Copyright (c) 2007, 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. + */ + --> - 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. ---> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_label" msgid="4567566098528588863">"設定儲存空間"</string> diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index ab93d8c..185d72a 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -51,4 +51,24 @@ <!-- Default value for whether or not to pulse the notification LED when there is a pending notification --> <bool name="def_notification_pulse">true</bool> + + <bool name="def_mount_play_notification_snd">true</bool> + <bool name="def_mount_ums_autostart">false</bool> + <bool name="def_mount_ums_prompt">true</bool> + <bool name="def_mount_ums_notify_enabled">true</bool> + + <!-- user interface sound effects --> + <integer name="def_power_sounds_enabled">1</integer> + <string name="def_low_battery_sound" translatable="false">/system/media/audio/ui/LowBattery.ogg</string> + <integer name="def_dock_sounds_enabled">0</integer> + <string name="def_desk_dock_sound" translatable="false">/system/media/audio/ui/Dock.ogg</string> + <string name="def_desk_undock_sound" translatable="false">/system/media/audio/ui/Undock.ogg</string> + <string name="def_car_dock_sound" translatable="false">/system/media/audio/ui/Dock.ogg</string> + <string name="def_car_undock_sound" translatable="false">/system/media/audio/ui/Undock.ogg</string> + <integer name="def_lockscreen_sounds_enabled">0</integer> + <string name="def_lock_sound" translatable="false">/system/media/audio/ui/Lock.ogg</string> + <string name="def_unlock_sound" translatable="false">/system/media/audio/ui/Unlock.ogg</string> + + <!-- Default for Settings.System.VIBRATE_IN_SILENT --> + <bool name="def_vibrate_in_silent">true</bool> </resources> diff --git a/packages/SettingsProvider/etc/bookmarks.xml b/packages/SettingsProvider/res/xml/bookmarks.xml index 734e0cd..dfaeeaf 100644 --- a/packages/SettingsProvider/etc/bookmarks.xml +++ b/packages/SettingsProvider/res/xml/bookmarks.xml @@ -32,8 +32,8 @@ class="com.google.android.gm.ConversationListActivityGmail" shortcut="g" /> <bookmark - package="com.android.providers.im" - class="com.android.providers.im.LandingPage" + package="com.android.im" + class="com.android.im.app.LandingPage" shortcut="i" /> <bookmark package="com.android.calendar" @@ -53,8 +53,4 @@ package="com.android.mms" class="com.android.mms.ui.ConversationList" shortcut="s" /> - <bookmark - package="com.google.android.youtube" - class="com.google.android.youtube.HomeActivity" - shortcut="y" /> </bookmarks> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 1a64e20..2b4714d 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -21,36 +21,33 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; +import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.content.res.Resources; +import android.content.res.XmlResourceParser; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteDoneException; -import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteStatement; import android.media.AudioManager; import android.media.AudioService; import android.net.ConnectivityManager; -import android.os.Environment; import android.os.SystemProperties; import android.provider.Settings; +import android.provider.Settings.Secure; import android.text.TextUtils; +import android.util.AttributeSet; import android.util.Config; import android.util.Log; import android.util.Xml; -import com.android.internal.util.XmlUtils; -import com.android.internal.telephony.RILConstants; +import com.android.internal.content.PackageHelper; +import com.android.internal.telephony.RILConstants; +import com.android.internal.util.XmlUtils; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternView; - import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; import java.util.List; @@ -59,11 +56,6 @@ import java.util.List; * Mostly just has a bit {@link #onCreate} to initialize the database. */ public class DatabaseHelper extends SQLiteOpenHelper { - /** - * Path to file containing default bookmarks, relative to ANDROID_ROOT. - */ - private static final String DEFAULT_BOOKMARKS_PATH = "etc/bookmarks.xml"; - private static final String TAG = "SettingsProvider"; private static final String DATABASE_NAME = "settings.db"; @@ -71,7 +63,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion' // is properly propagated through your change. Not doing so will result in a loss of user // settings. - private static final int DATABASE_VERSION = 43; + private static final int DATABASE_VERSION = 56; private Context mContext; @@ -100,13 +92,6 @@ public class DatabaseHelper extends SQLiteOpenHelper { createSecureTable(db); - db.execSQL("CREATE TABLE gservices (" + - "_id INTEGER PRIMARY KEY AUTOINCREMENT," + - "name TEXT UNIQUE ON CONFLICT REPLACE," + - "value TEXT" + - ");"); - db.execSQL("CREATE INDEX gservicesIndex1 ON gservices (name);"); - db.execSQL("CREATE TABLE bluetooth_devices (" + "_id INTEGER PRIMARY KEY," + "name TEXT," + @@ -159,7 +144,6 @@ public class DatabaseHelper extends SQLiteOpenHelper { * notification vibrate to on. */ loadVibrateSetting(db, true); - if (Config.LOGD) Log.d(TAG, "Reset system vibrate setting"); upgradeVersion = 21; } @@ -234,18 +218,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { } if (upgradeVersion == 27) { - // Copy settings values from 'system' to 'secure' and delete them from 'system' - SQLiteStatement insertStmt = null; - SQLiteStatement deleteStmt = null; - - db.beginTransaction(); - try { - insertStmt = - db.compileStatement("INSERT INTO secure (name,value) SELECT name,value FROM " - + "system WHERE name=?"); - deleteStmt = db.compileStatement("DELETE FROM system WHERE name=?"); - - String[] settingsToMove = { + String[] settingsToMove = { Settings.Secure.ADB_ENABLED, Settings.Secure.ANDROID_ID, Settings.Secure.BLUETOOTH_ON, @@ -278,24 +251,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { Settings.Secure.WIFI_WATCHDOG_PING_DELAY_MS, Settings.Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS, }; - - for (String setting : settingsToMove) { - insertStmt.bindString(1, setting); - insertStmt.execute(); - - deleteStmt.bindString(1, setting); - deleteStmt.execute(); - } - db.setTransactionSuccessful(); - } finally { - db.endTransaction(); - if (insertStmt != null) { - insertStmt.close(); - } - if (deleteStmt != null) { - deleteStmt.close(); - } - } + moveFromSystemToSecure(db, settingsToMove); upgradeVersion = 28; } @@ -347,18 +303,19 @@ public class DatabaseHelper extends SQLiteOpenHelper { * enabled or disabled based on product resources. */ db.beginTransaction(); + SQLiteStatement stmt = null; try { db.execSQL("DELETE FROM system WHERE name='" + Settings.System.WINDOW_ANIMATION_SCALE + "'"); db.execSQL("DELETE FROM system WHERE name='" + Settings.System.TRANSITION_ANIMATION_SCALE + "'"); - SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)" + stmt = db.compileStatement("INSERT INTO system(name,value)" + " VALUES(?,?);"); loadDefaultAnimationSettings(stmt); - stmt.close(); db.setTransactionSuccessful(); } finally { db.endTransaction(); + if (stmt != null) stmt.close(); } upgradeVersion = 32; } @@ -395,14 +352,15 @@ public class DatabaseHelper extends SQLiteOpenHelper { if (upgradeVersion == 34) { db.beginTransaction(); + SQLiteStatement stmt = null; try { - SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" + stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" + " VALUES(?,?);"); loadSecure35Settings(stmt); - stmt.close(); db.setTransactionSuccessful(); } finally { db.endTransaction(); + if (stmt != null) stmt.close(); } upgradeVersion = 35; } @@ -437,15 +395,16 @@ public class DatabaseHelper extends SQLiteOpenHelper { if (upgradeVersion == 37) { db.beginTransaction(); + SQLiteStatement stmt = null; try { - SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + " VALUES(?,?);"); loadStringSetting(stmt, Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS, R.string.airplane_mode_toggleable_radios); - stmt.close(); db.setTransactionSuccessful(); } finally { db.endTransaction(); + if (stmt != null) stmt.close(); } upgradeVersion = 38; } @@ -486,18 +445,19 @@ public class DatabaseHelper extends SQLiteOpenHelper { * All animations are now turned on by default! */ db.beginTransaction(); + SQLiteStatement stmt = null; try { db.execSQL("DELETE FROM system WHERE name='" + Settings.System.WINDOW_ANIMATION_SCALE + "'"); db.execSQL("DELETE FROM system WHERE name='" + Settings.System.TRANSITION_ANIMATION_SCALE + "'"); - SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)" + stmt = db.compileStatement("INSERT INTO system(name,value)" + " VALUES(?,?);"); loadDefaultAnimationSettings(stmt); - stmt.close(); db.setTransactionSuccessful(); } finally { db.endTransaction(); + if (stmt != null) stmt.close(); } upgradeVersion = 41; } @@ -507,16 +467,17 @@ public class DatabaseHelper extends SQLiteOpenHelper { * Initialize newly public haptic feedback setting */ db.beginTransaction(); + SQLiteStatement stmt = null; try { db.execSQL("DELETE FROM system WHERE name='" + Settings.System.HAPTIC_FEEDBACK_ENABLED + "'"); - SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)" + stmt = db.compileStatement("INSERT INTO system(name,value)" + " VALUES(?,?);"); loadDefaultHapticSettings(stmt); - stmt.close(); db.setTransactionSuccessful(); } finally { db.endTransaction(); + if (stmt != null) stmt.close(); } upgradeVersion = 42; } @@ -526,19 +487,215 @@ public class DatabaseHelper extends SQLiteOpenHelper { * Initialize new notification pulse setting */ db.beginTransaction(); + SQLiteStatement stmt = null; try { - SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)" + stmt = db.compileStatement("INSERT INTO system(name,value)" + " VALUES(?,?);"); loadBooleanSetting(stmt, Settings.System.NOTIFICATION_LIGHT_PULSE, R.bool.def_notification_pulse); - stmt.close(); db.setTransactionSuccessful(); } finally { db.endTransaction(); + if (stmt != null) stmt.close(); } upgradeVersion = 43; } + if (upgradeVersion == 43) { + /* + * This upgrade stores bluetooth volume separately from voice volume + */ + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + + " VALUES(?,?);"); + loadSetting(stmt, Settings.System.VOLUME_BLUETOOTH_SCO, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_BLUETOOTH_SCO]); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + upgradeVersion = 44; + } + + if (upgradeVersion == 44) { + /* + * Gservices was moved into vendor/google. + */ + db.execSQL("DROP TABLE IF EXISTS gservices"); + db.execSQL("DROP INDEX IF EXISTS gservicesIndex1"); + upgradeVersion = 45; + } + + if (upgradeVersion == 45) { + /* + * New settings for MountService + */ + db.beginTransaction(); + try { + db.execSQL("INSERT INTO secure(name,value) values('" + + Settings.Secure.MOUNT_PLAY_NOTIFICATION_SND + "','1');"); + db.execSQL("INSERT INTO secure(name,value) values('" + + Settings.Secure.MOUNT_UMS_AUTOSTART + "','0');"); + db.execSQL("INSERT INTO secure(name,value) values('" + + Settings.Secure.MOUNT_UMS_PROMPT + "','1');"); + db.execSQL("INSERT INTO secure(name,value) values('" + + Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED + "','1');"); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + upgradeVersion = 46; + } + + if (upgradeVersion == 46) { + /* + * The password mode constants have changed; reset back to no + * password. + */ + db.beginTransaction(); + try { + db.execSQL("DELETE FROM system WHERE name='lockscreen.password_type';"); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + upgradeVersion = 47; + } + + + if (upgradeVersion == 47) { + /* + * The password mode constants have changed again; reset back to no + * password. + */ + db.beginTransaction(); + try { + db.execSQL("DELETE FROM system WHERE name='lockscreen.password_type';"); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + upgradeVersion = 48; + } + + if (upgradeVersion == 48) { + /* + * Default recognition service no longer initialized here, + * moved to RecognitionManagerService. + */ + upgradeVersion = 49; + } + + if (upgradeVersion == 49) { + /* + * New settings for new user interface noises. + */ + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT INTO system(name,value)" + + " VALUES(?,?);"); + loadUISoundEffectsSettings(stmt); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + + upgradeVersion = 50; + } + + if (upgradeVersion == 50) { + /* + * Install location no longer initiated here. + */ + upgradeVersion = 51; + } + + if (upgradeVersion == 51) { + /* Move the lockscreen related settings to Secure, including some private ones. */ + String[] settingsToMove = { + Secure.LOCK_PATTERN_ENABLED, + Secure.LOCK_PATTERN_VISIBLE, + Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, + "lockscreen.password_type", + "lockscreen.lockoutattemptdeadline", + "lockscreen.patterneverchosen", + "lock_pattern_autolock", + "lockscreen.lockedoutpermanently", + "lockscreen.password_salt" + }; + moveFromSystemToSecure(db, settingsToMove); + upgradeVersion = 52; + } + + if (upgradeVersion == 52) { + // new vibration/silent mode settings + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT INTO system(name,value)" + + " VALUES(?,?);"); + loadBooleanSetting(stmt, Settings.System.VIBRATE_IN_SILENT, + R.bool.def_vibrate_in_silent); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + + upgradeVersion = 53; + } + + if (upgradeVersion == 53) { + /* + * New settings for set install location UI no longer initiated here. + */ + upgradeVersion = 54; + } + + if (upgradeVersion == 54) { + /* + * Update the screen timeout value if set to never + */ + db.beginTransaction(); + try { + upgradeScreenTimeoutFromNever(db); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + + upgradeVersion = 55; + } + + if (upgradeVersion == 55) { + /* Move the install location settings. */ + String[] settingsToMove = { + Secure.SET_INSTALL_LOCATION, + Secure.DEFAULT_INSTALL_LOCATION + }; + moveFromSystemToSecure(db, settingsToMove); + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT INTO system(name,value)" + + " VALUES(?,?);"); + loadSetting(stmt, Secure.SET_INSTALL_LOCATION, 0); + loadSetting(stmt, Secure.DEFAULT_INSTALL_LOCATION, + PackageHelper.APP_INSTALL_AUTO); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + upgradeVersion = 56; + } + // *** Remember to update DATABASE_VERSION above! + if (upgradeVersion != currentVersion) { Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion + ", must wipe the settings provider"); @@ -554,6 +711,43 @@ public class DatabaseHelper extends SQLiteOpenHelper { db.execSQL("DROP INDEX IF EXISTS bookmarksIndex2"); db.execSQL("DROP TABLE IF EXISTS favorites"); onCreate(db); + + // Added for diagnosing settings.db wipes after the fact + String wipeReason = oldVersion + "/" + upgradeVersion + "/" + currentVersion; + db.execSQL("INSERT INTO secure(name,value) values('" + + "wiped_db_reason" + "','" + wipeReason + "');"); + } + } + + private void moveFromSystemToSecure(SQLiteDatabase db, String [] settingsToMove) { + // Copy settings values from 'system' to 'secure' and delete them from 'system' + SQLiteStatement insertStmt = null; + SQLiteStatement deleteStmt = null; + + db.beginTransaction(); + try { + insertStmt = + db.compileStatement("INSERT INTO secure (name,value) SELECT name,value FROM " + + "system WHERE name=?"); + deleteStmt = db.compileStatement("DELETE FROM system WHERE name=?"); + + + for (String setting : settingsToMove) { + insertStmt.bindString(1, setting); + insertStmt.execute(); + + deleteStmt.bindString(1, setting); + deleteStmt.execute(); + } + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (insertStmt != null) { + insertStmt.close(); + } + if (deleteStmt != null) { + deleteStmt.close(); + } } } @@ -566,7 +760,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { if (!TextUtils.isEmpty(lockPattern)) { // Convert lock pattern try { - LockPatternUtils lpu = new LockPatternUtils(mContext.getContentResolver()); + LockPatternUtils lpu = new LockPatternUtils(mContext); List<LockPatternView.Cell> cellPattern = LockPatternUtils.stringToPattern(lockPattern); lpu.saveLockPattern(cellPattern); @@ -581,44 +775,57 @@ public class DatabaseHelper extends SQLiteOpenHelper { } } + private void upgradeScreenTimeoutFromNever(SQLiteDatabase db) { + // See if the timeout is -1 (for "Never"). + Cursor c = db.query("system", new String[] { "_id", "value" }, "name=? AND value=?", + new String[] { Settings.System.SCREEN_OFF_TIMEOUT, "-1" }, + null, null, null); + + SQLiteStatement stmt = null; + if (c.getCount() > 0) { + c.close(); + try { + stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)" + + " VALUES(?,?);"); + + // Set the timeout to 30 minutes in milliseconds + loadSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT, + Integer.toString(30 * 60 * 1000)); + } finally { + if (stmt != null) stmt.close(); + } + } else { + c.close(); + } + } + /** * Loads the default set of bookmarked shortcuts from an xml file. * * @param db The database to write the values into * @param startingIndex The zero-based position at which bookmarks in this file should begin - * @param subPath The relative path from ANDROID_ROOT to the file to read - * @param quiet If true, do no complain if the file is missing */ - private int loadBookmarks(SQLiteDatabase db, int startingIndex, String subPath, - boolean quiet) { - FileReader bookmarksReader; - - // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system". - final File favFile = new File(Environment.getRootDirectory(), subPath); - try { - bookmarksReader = new FileReader(favFile); - } catch (FileNotFoundException e) { - if (!quiet) { - Log.e(TAG, "Couldn't find or open bookmarks file " + favFile); - } - return 0; - } - + private int loadBookmarks(SQLiteDatabase db, int startingIndex) { Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_LAUNCHER); ContentValues values = new ContentValues(); PackageManager packageManager = mContext.getPackageManager(); - ActivityInfo info; int i = startingIndex; - try { - XmlPullParser parser = Xml.newPullParser(); - parser.setInput(bookmarksReader); + try { + XmlResourceParser parser = mContext.getResources().getXml(R.xml.bookmarks); XmlUtils.beginDocument(parser, "bookmarks"); - while (true) { - XmlUtils.nextElement(parser); + final int depth = parser.getDepth(); + int type; + + while (((type = parser.next()) != XmlPullParser.END_TAG || + parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) { + + if (type != XmlPullParser.START_TAG) { + continue; + } String name = parser.getName(); if (!"bookmark".equals(name)) { @@ -628,23 +835,36 @@ public class DatabaseHelper extends SQLiteOpenHelper { String pkg = parser.getAttributeValue(null, "package"); String cls = parser.getAttributeValue(null, "class"); String shortcutStr = parser.getAttributeValue(null, "shortcut"); + int shortcutValue = (int) shortcutStr.charAt(0); if (TextUtils.isEmpty(shortcutStr)) { Log.w(TAG, "Unable to get shortcut for: " + pkg + "/" + cls); } + + ActivityInfo info = null; + ComponentName cn = new ComponentName(pkg, cls); try { - ComponentName cn = new ComponentName(pkg, cls); info = packageManager.getActivityInfo(cn, 0); + } catch (PackageManager.NameNotFoundException e) { + String[] packages = packageManager.canonicalToCurrentPackageNames( + new String[] { pkg }); + cn = new ComponentName(packages[0], cls); + try { + info = packageManager.getActivityInfo(cn, 0); + } catch (PackageManager.NameNotFoundException e1) { + Log.w(TAG, "Unable to add bookmark: " + pkg + "/" + cls, e); + } + } + + if (info != null) { intent.setComponent(cn); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - values.put(Settings.Bookmarks.INTENT, intent.toURI()); + values.put(Settings.Bookmarks.INTENT, intent.toUri(0)); values.put(Settings.Bookmarks.TITLE, info.loadLabel(packageManager).toString()); values.put(Settings.Bookmarks.SHORTCUT, shortcutValue); db.insert("bookmarks", null, values); i++; - } catch (PackageManager.NameNotFoundException e) { - Log.w(TAG, "Unable to add bookmark: " + pkg + "/" + cls, e); } } } catch (XmlPullParserException e) { @@ -662,7 +882,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { * @param db The database to write the values into */ private void loadBookmarks(SQLiteDatabase db) { - loadBookmarks(db, 0, DEFAULT_BOOKMARKS_PATH, false); + loadBookmarks(db, 0); } /** @@ -672,42 +892,50 @@ public class DatabaseHelper extends SQLiteOpenHelper { * @param db the database to insert the volume levels into */ private void loadVolumeLevels(SQLiteDatabase db) { - SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" - + " VALUES(?,?);"); - - loadSetting(stmt, Settings.System.VOLUME_MUSIC, - AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_MUSIC]); - loadSetting(stmt, Settings.System.VOLUME_RING, - AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_RING]); - loadSetting(stmt, Settings.System.VOLUME_SYSTEM, - AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_SYSTEM]); - loadSetting( - stmt, - Settings.System.VOLUME_VOICE, - AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_VOICE_CALL]); - loadSetting(stmt, Settings.System.VOLUME_ALARM, - AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_ALARM]); - loadSetting( - stmt, - Settings.System.VOLUME_NOTIFICATION, - AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_NOTIFICATION]); - loadSetting(stmt, Settings.System.MODE_RINGER, - AudioManager.RINGER_MODE_NORMAL); - - loadVibrateSetting(db, false); - - // By default, only the ring/notification and system streams are affected - loadSetting(stmt, Settings.System.MODE_RINGER_STREAMS_AFFECTED, - (1 << AudioManager.STREAM_RING) | (1 << AudioManager.STREAM_NOTIFICATION) | - (1 << AudioManager.STREAM_SYSTEM) | (1 << AudioManager.STREAM_SYSTEM_ENFORCED)); - - loadSetting(stmt, Settings.System.MUTE_STREAMS_AFFECTED, - ((1 << AudioManager.STREAM_MUSIC) | - (1 << AudioManager.STREAM_RING) | - (1 << AudioManager.STREAM_NOTIFICATION) | - (1 << AudioManager.STREAM_SYSTEM))); - - stmt.close(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + + " VALUES(?,?);"); + + loadSetting(stmt, Settings.System.VOLUME_MUSIC, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_MUSIC]); + loadSetting(stmt, Settings.System.VOLUME_RING, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_RING]); + loadSetting(stmt, Settings.System.VOLUME_SYSTEM, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_SYSTEM]); + loadSetting( + stmt, + Settings.System.VOLUME_VOICE, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_VOICE_CALL]); + loadSetting(stmt, Settings.System.VOLUME_ALARM, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_ALARM]); + loadSetting( + stmt, + Settings.System.VOLUME_NOTIFICATION, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_NOTIFICATION]); + loadSetting( + stmt, + Settings.System.VOLUME_BLUETOOTH_SCO, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_BLUETOOTH_SCO]); + + loadSetting(stmt, Settings.System.MODE_RINGER, + AudioManager.RINGER_MODE_NORMAL); + + loadVibrateSetting(db, false); + + // By default, only the ring/notification and system streams are affected + loadSetting(stmt, Settings.System.MODE_RINGER_STREAMS_AFFECTED, + (1 << AudioManager.STREAM_RING) | (1 << AudioManager.STREAM_NOTIFICATION) | + (1 << AudioManager.STREAM_SYSTEM) | (1 << AudioManager.STREAM_SYSTEM_ENFORCED)); + + loadSetting(stmt, Settings.System.MUTE_STREAMS_AFFECTED, + ((1 << AudioManager.STREAM_MUSIC) | + (1 << AudioManager.STREAM_RING) | + (1 << AudioManager.STREAM_NOTIFICATION) | + (1 << AudioManager.STREAM_SYSTEM))); + } finally { + if (stmt != null) stmt.close(); + } } private void loadVibrateSetting(SQLiteDatabase db, boolean deleteOld) { @@ -715,16 +943,21 @@ public class DatabaseHelper extends SQLiteOpenHelper { db.execSQL("DELETE FROM system WHERE name='" + Settings.System.VIBRATE_ON + "'"); } - SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" - + " VALUES(?,?);"); - - // Vibrate off by default for ringer, on for notification - int vibrate = 0; - vibrate = AudioService.getValueForVibrateSetting(vibrate, - AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON); - vibrate = AudioService.getValueForVibrateSetting(vibrate, - AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF); - loadSetting(stmt, Settings.System.VIBRATE_ON, vibrate); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + + " VALUES(?,?);"); + + // Vibrate off by default for ringer, on for notification + int vibrate = 0; + vibrate = AudioService.getValueForVibrateSetting(vibrate, + AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON); + vibrate = AudioService.getValueForVibrateSetting(vibrate, + AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF); + loadSetting(stmt, Settings.System.VIBRATE_ON, vibrate); + } finally { + if (stmt != null) stmt.close(); + } } private void loadSettings(SQLiteDatabase db) { @@ -733,61 +966,96 @@ public class DatabaseHelper extends SQLiteOpenHelper { } private void loadSystemSettings(SQLiteDatabase db) { - SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" - + " VALUES(?,?);"); - - Resources r = mContext.getResources(); - - loadBooleanSetting(stmt, Settings.System.DIM_SCREEN, - R.bool.def_dim_screen); - loadSetting(stmt, Settings.System.STAY_ON_WHILE_PLUGGED_IN, - "1".equals(SystemProperties.get("ro.kernel.qemu")) ? 1 : 0); - loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT, - R.integer.def_screen_off_timeout); - - // Set default cdma emergency tone - loadSetting(stmt, Settings.System.EMERGENCY_TONE, 0); - - // Set default cdma call auto retry - loadSetting(stmt, Settings.System.CALL_AUTO_RETRY, 0); - - // Set default cdma DTMF type - loadSetting(stmt, Settings.System.DTMF_TONE_TYPE_WHEN_DIALING, 0); - - // Set default hearing aid - loadSetting(stmt, Settings.System.HEARING_AID, 0); - - // Set default tty mode - loadSetting(stmt, Settings.System.TTY_MODE, 0); - - loadBooleanSetting(stmt, Settings.System.AIRPLANE_MODE_ON, - R.bool.def_airplane_mode_on); - - loadStringSetting(stmt, Settings.System.AIRPLANE_MODE_RADIOS, - R.string.def_airplane_mode_radios); - - loadStringSetting(stmt, Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS, - R.string.airplane_mode_toggleable_radios); - - loadBooleanSetting(stmt, Settings.System.AUTO_TIME, - R.bool.def_auto_time); // Sync time to NITZ - - loadIntegerSetting(stmt, Settings.System.SCREEN_BRIGHTNESS, - R.integer.def_screen_brightness); - - loadBooleanSetting(stmt, Settings.System.SCREEN_BRIGHTNESS_MODE, - R.bool.def_screen_brightness_automatic_mode); - - loadDefaultAnimationSettings(stmt); - - loadBooleanSetting(stmt, Settings.System.ACCELEROMETER_ROTATION, - R.bool.def_accelerometer_rotation); - - loadDefaultHapticSettings(stmt); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + + " VALUES(?,?);"); + + loadBooleanSetting(stmt, Settings.System.DIM_SCREEN, + R.bool.def_dim_screen); + loadSetting(stmt, Settings.System.STAY_ON_WHILE_PLUGGED_IN, + "1".equals(SystemProperties.get("ro.kernel.qemu")) ? 1 : 0); + loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT, + R.integer.def_screen_off_timeout); + + // Set default cdma emergency tone + loadSetting(stmt, Settings.System.EMERGENCY_TONE, 0); + + // Set default cdma call auto retry + loadSetting(stmt, Settings.System.CALL_AUTO_RETRY, 0); + + // Set default cdma DTMF type + loadSetting(stmt, Settings.System.DTMF_TONE_TYPE_WHEN_DIALING, 0); + + // Set default hearing aid + loadSetting(stmt, Settings.System.HEARING_AID, 0); + + // Set default tty mode + loadSetting(stmt, Settings.System.TTY_MODE, 0); + + loadBooleanSetting(stmt, Settings.System.AIRPLANE_MODE_ON, + R.bool.def_airplane_mode_on); + + loadStringSetting(stmt, Settings.System.AIRPLANE_MODE_RADIOS, + R.string.def_airplane_mode_radios); + + loadStringSetting(stmt, Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS, + R.string.airplane_mode_toggleable_radios); + + loadBooleanSetting(stmt, Settings.System.AUTO_TIME, + R.bool.def_auto_time); // Sync time to NITZ + + loadIntegerSetting(stmt, Settings.System.SCREEN_BRIGHTNESS, + R.integer.def_screen_brightness); + + loadBooleanSetting(stmt, Settings.System.SCREEN_BRIGHTNESS_MODE, + R.bool.def_screen_brightness_automatic_mode); + + loadDefaultAnimationSettings(stmt); + + loadBooleanSetting(stmt, Settings.System.ACCELEROMETER_ROTATION, + R.bool.def_accelerometer_rotation); + + loadDefaultHapticSettings(stmt); + + loadBooleanSetting(stmt, Settings.System.NOTIFICATION_LIGHT_PULSE, + R.bool.def_notification_pulse); + loadSetting(stmt, Settings.Secure.SET_INSTALL_LOCATION, 0); + loadSetting(stmt, Settings.Secure.DEFAULT_INSTALL_LOCATION, + PackageHelper.APP_INSTALL_AUTO); + + loadUISoundEffectsSettings(stmt); + + loadBooleanSetting(stmt, Settings.System.VIBRATE_IN_SILENT, + R.bool.def_vibrate_in_silent); + } finally { + if (stmt != null) stmt.close(); + } + } - loadBooleanSetting(stmt, Settings.System.NOTIFICATION_LIGHT_PULSE, - R.bool.def_notification_pulse); - stmt.close(); + private void loadUISoundEffectsSettings(SQLiteStatement stmt) { + loadIntegerSetting(stmt, Settings.System.POWER_SOUNDS_ENABLED, + R.integer.def_power_sounds_enabled); + loadStringSetting(stmt, Settings.System.LOW_BATTERY_SOUND, + R.string.def_low_battery_sound); + + loadIntegerSetting(stmt, Settings.System.DOCK_SOUNDS_ENABLED, + R.integer.def_dock_sounds_enabled); + loadStringSetting(stmt, Settings.System.DESK_DOCK_SOUND, + R.string.def_desk_dock_sound); + loadStringSetting(stmt, Settings.System.DESK_UNDOCK_SOUND, + R.string.def_desk_undock_sound); + loadStringSetting(stmt, Settings.System.CAR_DOCK_SOUND, + R.string.def_car_dock_sound); + loadStringSetting(stmt, Settings.System.CAR_UNDOCK_SOUND, + R.string.def_car_undock_sound); + + loadIntegerSetting(stmt, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, + R.integer.def_lockscreen_sounds_enabled); + loadStringSetting(stmt, Settings.System.LOCK_SOUND, + R.string.def_lock_sound); + loadStringSetting(stmt, Settings.System.UNLOCK_SOUND, + R.string.def_unlock_sound); } private void loadDefaultAnimationSettings(SQLiteStatement stmt) { @@ -803,77 +1071,92 @@ public class DatabaseHelper extends SQLiteOpenHelper { } private void loadSecureSettings(SQLiteDatabase db) { - SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" - + " VALUES(?,?);"); - - loadBooleanSetting(stmt, Settings.Secure.BLUETOOTH_ON, - R.bool.def_bluetooth_on); - - // Data roaming default, based on build - loadSetting(stmt, Settings.Secure.DATA_ROAMING, - "true".equalsIgnoreCase( - SystemProperties.get("ro.com.android.dataroaming", - "false")) ? 1 : 0); - - loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, - R.bool.def_install_non_market_apps); - - loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, - R.string.def_location_providers_allowed); - - loadBooleanSetting(stmt, Settings.Secure.ASSISTED_GPS_ENABLED, - R.bool.assisted_gps_enabled); - - loadIntegerSetting(stmt, Settings.Secure.NETWORK_PREFERENCE, - R.integer.def_network_preference); - - loadBooleanSetting(stmt, Settings.Secure.USB_MASS_STORAGE_ENABLED, - R.bool.def_usb_mass_storage_enabled); - - loadBooleanSetting(stmt, Settings.Secure.WIFI_ON, - R.bool.def_wifi_on); - loadBooleanSetting(stmt, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, - R.bool.def_networks_available_notification_on); - - String wifiWatchList = SystemProperties.get("ro.com.android.wifi-watchlist"); - if (!TextUtils.isEmpty(wifiWatchList)) { - loadSetting(stmt, Settings.Secure.WIFI_WATCHDOG_WATCH_LIST, wifiWatchList); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" + + " VALUES(?,?);"); + + loadBooleanSetting(stmt, Settings.Secure.BLUETOOTH_ON, + R.bool.def_bluetooth_on); + + // Data roaming default, based on build + loadSetting(stmt, Settings.Secure.DATA_ROAMING, + "true".equalsIgnoreCase( + SystemProperties.get("ro.com.android.dataroaming", + "false")) ? 1 : 0); + + loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, + R.bool.def_install_non_market_apps); + + loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, + R.string.def_location_providers_allowed); + + loadBooleanSetting(stmt, Settings.Secure.ASSISTED_GPS_ENABLED, + R.bool.assisted_gps_enabled); + + loadIntegerSetting(stmt, Settings.Secure.NETWORK_PREFERENCE, + R.integer.def_network_preference); + + loadBooleanSetting(stmt, Settings.Secure.USB_MASS_STORAGE_ENABLED, + R.bool.def_usb_mass_storage_enabled); + + loadBooleanSetting(stmt, Settings.Secure.WIFI_ON, + R.bool.def_wifi_on); + loadBooleanSetting(stmt, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, + R.bool.def_networks_available_notification_on); + + String wifiWatchList = SystemProperties.get("ro.com.android.wifi-watchlist"); + if (!TextUtils.isEmpty(wifiWatchList)) { + loadSetting(stmt, Settings.Secure.WIFI_WATCHDOG_WATCH_LIST, wifiWatchList); + } + + // Set the preferred network mode to 0 = Global, CDMA default + int type = SystemProperties.getInt("ro.telephony.default_network", + RILConstants.PREFERRED_NETWORK_MODE); + loadSetting(stmt, Settings.Secure.PREFERRED_NETWORK_MODE, type); + + // Enable or disable Cell Broadcast SMS + loadSetting(stmt, Settings.Secure.CDMA_CELL_BROADCAST_SMS, + RILConstants.CDMA_CELL_BROADCAST_SMS_DISABLED); + + // Set the preferred cdma subscription to 0 = Subscription from RUIM, when available + loadSetting(stmt, Settings.Secure.PREFERRED_CDMA_SUBSCRIPTION, + RILConstants.PREFERRED_CDMA_SUBSCRIPTION); + + // Don't do this. The SystemServer will initialize ADB_ENABLED from a + // persistent system property instead. + //loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0); + + // Allow mock locations default, based on build + loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION, + "1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0); + + loadSecure35Settings(stmt); + + loadBooleanSetting(stmt, Settings.Secure.MOUNT_PLAY_NOTIFICATION_SND, + R.bool.def_mount_play_notification_snd); + + loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_AUTOSTART, + R.bool.def_mount_ums_autostart); + + loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_PROMPT, + R.bool.def_mount_ums_prompt); + + loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED, + R.bool.def_mount_ums_notify_enabled); + } finally { + if (stmt != null) stmt.close(); } - - // Set the preferred network mode to 0 = Global, CDMA default - int type = SystemProperties.getInt("ro.telephony.default_network", - RILConstants.PREFERRED_NETWORK_MODE); - loadSetting(stmt, Settings.Secure.PREFERRED_NETWORK_MODE, type); - - // Enable or disable Cell Broadcast SMS - loadSetting(stmt, Settings.Secure.CDMA_CELL_BROADCAST_SMS, - RILConstants.CDMA_CELL_BROADCAST_SMS_DISABLED); - - // Set the preferred cdma subscription to 0 = Subscription from RUIM, when available - loadSetting(stmt, Settings.Secure.PREFERRED_CDMA_SUBSCRIPTION, - RILConstants.PREFERRED_CDMA_SUBSCRIPTION); - - // Don't do this. The SystemServer will initialize ADB_ENABLED from a - // persistent system property instead. - //loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0); - - // Allow mock locations default, based on build - loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION, - "1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0); - - loadSecure35Settings(stmt); - - stmt.close(); } private void loadSecure35Settings(SQLiteStatement stmt) { loadBooleanSetting(stmt, Settings.Secure.BACKUP_ENABLED, R.bool.def_backup_enabled); - + loadStringSetting(stmt, Settings.Secure.BACKUP_TRANSPORT, R.string.def_backup_transport); } - + private void loadSetting(SQLiteStatement stmt, String key, Object value) { stmt.bindString(1, key); stmt.bindString(2, value.toString()); diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index 2738efb..b98071e 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -30,9 +30,9 @@ import java.io.IOException; import java.util.Arrays; import java.util.zip.CRC32; -import android.backup.BackupDataInput; -import android.backup.BackupDataOutput; -import android.backup.BackupHelperAgent; +import android.app.backup.BackupDataInput; +import android.app.backup.BackupDataOutput; +import android.app.backup.BackupAgentHelper; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; @@ -49,7 +49,7 @@ import android.util.Log; * Performs backup and restore of the System and Secure settings. * List of settings that are backed up are stored in the Settings.java file */ -public class SettingsBackupAgent extends BackupHelperAgent { +public class SettingsBackupAgent extends BackupAgentHelper { private static final boolean DEBUG = false; private static final String KEY_SYSTEM = "system"; diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java index 153a5ea..0e75fbc 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java @@ -20,7 +20,8 @@ import java.util.Locale; import android.app.ActivityManagerNative; import android.app.IActivityManager; -import android.backup.BackupDataInput; +import android.app.backup.BackupDataInput; +import android.app.backup.IBackupManager; import android.content.ContentResolver; import android.content.Context; import android.content.IContentService; @@ -41,7 +42,6 @@ public class SettingsHelper { private AudioManager mAudioManager; private IContentService mContentService; private IPowerManager mPowerManager; - private static final String[] PROVIDERS = { "gmail-ls", "calendar", "contacts" }; private boolean mSilent; private boolean mVibrate; @@ -72,10 +72,22 @@ public class SettingsHelper { } else if (Settings.Secure.LOCATION_PROVIDERS_ALLOWED.equals(name)) { setGpsLocation(value); return false; + } else if (Settings.Secure.BACKUP_AUTO_RESTORE.equals(name)) { + setAutoRestore(Integer.parseInt(value) == 1); } return true; } + private void setAutoRestore(boolean enabled) { + try { + IBackupManager bm = IBackupManager.Stub.asInterface( + ServiceManager.getService(Context.BACKUP_SERVICE)); + if (bm != null) { + bm.setAutoRestore(enabled); + } + } catch (RemoteException e) {} + } + private void setGpsLocation(String value) { final String GPS = LocationManager.GPS_PROVIDER; boolean enabled = diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index ab186cf..1019fa8 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -17,8 +17,13 @@ package com.android.providers.settings; import java.io.FileNotFoundException; +import java.io.UnsupportedEncodingException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.util.LinkedHashMap; +import java.util.Map; -import android.backup.BackupManager; +import android.app.backup.BackupManager; import android.content.ContentProvider; import android.content.ContentUris; import android.content.ContentValues; @@ -27,12 +32,12 @@ import android.content.pm.PackageManager; import android.content.res.AssetFileDescriptor; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteQueryBuilder; -import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; +import android.os.Bundle; import android.os.ParcelFileDescriptor; -import android.os.ServiceManager; import android.os.SystemProperties; import android.provider.DrmStore; import android.provider.MediaStore; @@ -47,6 +52,21 @@ public class SettingsProvider extends ContentProvider { private static final String TABLE_FAVORITES = "favorites"; private static final String TABLE_OLD_FAVORITES = "old_favorites"; + private static final String[] COLUMN_VALUE = new String[] { "value" }; + + // Cache for settings, access-ordered for acting as LRU. + // Guarded by themselves. + private static final int MAX_CACHE_ENTRIES = 50; + private static final SettingsCache sSystemCache = new SettingsCache(); + private static final SettingsCache sSecureCache = new SettingsCache(); + + // Over this size we don't reject loading or saving settings but + // we do consider them broken/malicious and don't keep them in + // memory at least: + private static final int MAX_CACHE_ENTRY_SIZE = 500; + + private static final Bundle NULL_SETTING = Bundle.forPair("value", null); + protected DatabaseHelper mOpenHelper; private BackupManager mBackupManager; @@ -71,8 +91,7 @@ public class SettingsProvider extends ContentProvider { throw new UnsupportedOperationException("WHERE clause not supported: " + url); } else { this.table = url.getPathSegments().get(0); - if ("gservices".equals(this.table) || "system".equals(this.table) - || "secure".equals(this.table)) { + if ("system".equals(this.table) || "secure".equals(this.table)) { this.where = Settings.NameValueTable.NAME + "=?"; this.args = new String[] { url.getPathSegments().get(1) }; } else { @@ -106,8 +125,7 @@ public class SettingsProvider extends ContentProvider { throw new IllegalArgumentException("Invalid URI: " + tableUri); } String table = tableUri.getPathSegments().get(0); - if ("gservices".equals(table) || "system".equals(table) - || "secure".equals(table)) { + if ("system".equals(table) || "secure".equals(table)) { String name = values.getAsString(Settings.NameValueTable.NAME); return Uri.withAppendedPath(tableUri, name); } else { @@ -135,8 +153,6 @@ public class SettingsProvider extends ContentProvider { } else if (table.equals("secure")) { property = Settings.Secure.SYS_PROP_SETTING_VERSION; backedUpDataChanged = true; - } else if (table.equals("gservices")) { - property = Settings.Gservices.SYS_PROP_SETTING_VERSION; } if (property != null) { @@ -167,21 +183,12 @@ public class SettingsProvider extends ContentProvider { */ private void checkWritePermissions(SqlArguments args) { if ("secure".equals(args.table) && - getContext().checkCallingOrSelfPermission( - android.Manifest.permission.WRITE_SECURE_SETTINGS) != - PackageManager.PERMISSION_GRANTED) { - throw new SecurityException( - String.format("Permission denial: writing to secure settings requires %1$s", - android.Manifest.permission.WRITE_SECURE_SETTINGS)); - - // TODO: Move gservices into its own provider so we don't need this nonsense. - } else if ("gservices".equals(args.table) && getContext().checkCallingOrSelfPermission( - android.Manifest.permission.WRITE_GSERVICES) != - PackageManager.PERMISSION_GRANTED) { + android.Manifest.permission.WRITE_SECURE_SETTINGS) != + PackageManager.PERMISSION_GRANTED) { throw new SecurityException( - String.format("Permission denial: writing to gservices settings requires %1$s", - android.Manifest.permission.WRITE_GSERVICES)); + String.format("Permission denial: writing to secure settings requires %1$s", + android.Manifest.permission.WRITE_SECURE_SETTINGS)); } } @@ -189,9 +196,91 @@ public class SettingsProvider extends ContentProvider { public boolean onCreate() { mOpenHelper = new DatabaseHelper(getContext()); mBackupManager = new BackupManager(getContext()); + + if (!ensureAndroidIdIsSet()) { + return false; + } + return true; } + private boolean ensureAndroidIdIsSet() { + final Cursor c = query(Settings.Secure.CONTENT_URI, + new String[] { Settings.NameValueTable.VALUE }, + Settings.NameValueTable.NAME + "=?", + new String[] { Settings.Secure.ANDROID_ID }, null); + try { + final String value = c.moveToNext() ? c.getString(0) : null; + if (value == null) { + final SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); + String serial = SystemProperties.get("ro.serialno"); + if (serial != null) { + try { + random.setSeed(serial.getBytes("UTF-8")); + } catch (UnsupportedEncodingException ignore) { + // stick with default seed + } + } + final String newAndroidIdValue = Long.toHexString(random.nextLong()); + Log.d(TAG, "Generated and saved new ANDROID_ID"); + final ContentValues values = new ContentValues(); + values.put(Settings.NameValueTable.NAME, Settings.Secure.ANDROID_ID); + values.put(Settings.NameValueTable.VALUE, newAndroidIdValue); + final Uri uri = insert(Settings.Secure.CONTENT_URI, values); + if (uri == null) { + return false; + } + } + return true; + } catch (NoSuchAlgorithmException e) { + return false; + } finally { + c.close(); + } + } + + /** + * Fast path that avoids the use of chatty remoted Cursors. + */ + @Override + public Bundle call(String method, String request, Bundle args) { + if (Settings.CALL_METHOD_GET_SYSTEM.equals(method)) { + return lookupValue("system", sSystemCache, request); + } + if (Settings.CALL_METHOD_GET_SECURE.equals(method)) { + return lookupValue("secure", sSecureCache, request); + } + return null; + } + + // Looks up value 'key' in 'table' and returns either a single-pair Bundle, + // possibly with a null value, or null on failure. + private Bundle lookupValue(String table, SettingsCache cache, String key) { + synchronized (cache) { + if (cache.containsKey(key)) { + return cache.get(key); + } + } + + SQLiteDatabase db = mOpenHelper.getReadableDatabase(); + Cursor cursor = null; + try { + cursor = db.query(table, COLUMN_VALUE, "name=?", new String[]{key}, + null, null, null, null); + if (cursor != null && cursor.getCount() == 1) { + cursor.moveToFirst(); + return cache.putIfAbsent(key, cursor.getString(0)); + } + } catch (SQLiteException e) { + Log.w(TAG, "settings lookup error", e); + return null; + } finally { + if (cursor != null) cursor.close(); + } + cache.putIfAbsent(key, null); + return NULL_SETTING; + } + @Override public Cursor query(Uri url, String[] select, String where, String[] whereArgs, String sort) { SqlArguments args = new SqlArguments(url, where, whereArgs); @@ -243,6 +332,7 @@ public class SettingsProvider extends ContentProvider { return 0; } checkWritePermissions(args); + SettingsCache cache = SettingsCache.forTable(args.table); SQLiteDatabase db = mOpenHelper.getWritableDatabase(); db.beginTransaction(); @@ -250,6 +340,7 @@ public class SettingsProvider extends ContentProvider { int numValues = values.length; for (int i = 0; i < numValues; i++) { if (db.insert(args.table, null, values[i]) < 0) return 0; + SettingsCache.populate(cache, values[i]); if (LOCAL_LOGV) Log.v(TAG, args.table + " <- " + values[i]); } db.setTransactionSuccessful(); @@ -266,6 +357,9 @@ public class SettingsProvider extends ContentProvider { * This setting contains a list of the currently enabled location providers. * But helper functions in android.providers.Settings can enable or disable * a single provider by using a "+" or "-" prefix before the provider name. + * + * @returns whether the database needs to be updated or not, also modifying + * 'initialValues' if needed. */ private boolean parseProviderList(Uri url, ContentValues initialValues) { String value = initialValues.getAsString(Settings.Secure.VALUE); @@ -326,7 +420,7 @@ public class SettingsProvider extends ContentProvider { } } } - + return true; } @@ -345,10 +439,18 @@ public class SettingsProvider extends ContentProvider { if (!parseProviderList(url, initialValues)) return null; } + SettingsCache cache = SettingsCache.forTable(args.table); + String value = initialValues.getAsString(Settings.NameValueTable.VALUE); + if (SettingsCache.isRedundantSetValue(cache, name, value)) { + return Uri.withAppendedPath(url, name); + } + SQLiteDatabase db = mOpenHelper.getWritableDatabase(); final long rowId = db.insert(args.table, null, initialValues); if (rowId <= 0) return null; + SettingsCache.populate(cache, initialValues); // before we notify + if (LOCAL_LOGV) Log.v(TAG, args.table + " <- " + initialValues); url = getUriFor(url, initialValues, rowId); sendNotify(url); @@ -367,7 +469,10 @@ public class SettingsProvider extends ContentProvider { SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int count = db.delete(args.table, args.where, args.args); - if (count > 0) sendNotify(url); + if (count > 0) { + SettingsCache.wipe(args.table); // before we notify + sendNotify(url); + } if (LOCAL_LOGV) Log.v(TAG, args.table + ": " + count + " row(s) deleted"); return count; } @@ -382,7 +487,10 @@ public class SettingsProvider extends ContentProvider { SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int count = db.update(args.table, initialValues, args.where, args.args); - if (count > 0) sendNotify(url); + if (count > 0) { + SettingsCache.wipe(args.table); // before we notify + sendNotify(url); + } if (LOCAL_LOGV) Log.v(TAG, args.table + ": " + count + " row(s) <- " + initialValues); return count; } @@ -487,4 +595,103 @@ public class SettingsProvider extends ContentProvider { // Note that this will end up calling openFile() above. return super.openAssetFile(uri, mode); } + + /** + * In-memory LRU Cache of system and secure settings, along with + * associated helper functions to keep cache coherent with the + * database. + */ + private static final class SettingsCache extends LinkedHashMap<String, Bundle> { + + public SettingsCache() { + super(MAX_CACHE_ENTRIES, 0.75f /* load factor */, true /* access ordered */); + } + + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + return size() > MAX_CACHE_ENTRIES; + } + + /** + * Atomic cache population, conditional on size of value and if + * we lost a race. + * + * @returns a Bundle to send back to the client from call(), even + * if we lost the race. + */ + public Bundle putIfAbsent(String key, String value) { + Bundle bundle = (value == null) ? NULL_SETTING : Bundle.forPair("value", value); + if (value == null || value.length() <= MAX_CACHE_ENTRY_SIZE) { + synchronized (this) { + if (!containsKey(key)) { + put(key, bundle); + } + } + } + return bundle; + } + + public static SettingsCache forTable(String tableName) { + if ("system".equals(tableName)) { + return SettingsProvider.sSystemCache; + } + if ("secure".equals(tableName)) { + return SettingsProvider.sSecureCache; + } + return null; + } + + /** + * Populates a key in a given (possibly-null) cache. + */ + public static void populate(SettingsCache cache, ContentValues contentValues) { + if (cache == null) { + return; + } + String name = contentValues.getAsString(Settings.NameValueTable.NAME); + if (name == null) { + Log.w(TAG, "null name populating settings cache."); + return; + } + String value = contentValues.getAsString(Settings.NameValueTable.VALUE); + synchronized (cache) { + if (value == null || value.length() <= MAX_CACHE_ENTRY_SIZE) { + cache.put(name, Bundle.forPair(Settings.NameValueTable.VALUE, value)); + } else { + cache.remove(name); + } + } + } + + /** + * Used for wiping a whole cache on deletes when we're not + * sure what exactly was deleted or changed. + */ + public static void wipe(String tableName) { + SettingsCache cache = SettingsCache.forTable(tableName); + if (cache == null) { + return; + } + synchronized (cache) { + cache.clear(); + } + } + + /** + * For suppressing duplicate/redundant settings inserts early, + * checking our cache first (but without faulting it in), + * before going to sqlite with the mutation. + */ + public static boolean isRedundantSetValue(SettingsCache cache, String name, String value) { + if (cache == null) return false; + synchronized (cache) { + Bundle bundle = cache.get(name); + if (bundle == null) return false; + String oldValue = bundle.getPairValue(); + if (oldValue == null && value == null) return true; + if ((oldValue == null) != (value == null)) return false; + return oldValue.equals(value); + } + } + } } |
