diff options
| author | Tom O'Neill <tomo@google.com> | 2013-08-20 07:20:35 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-20 07:20:35 -0700 |
| commit | 0a3537f881f47da2ea27629c50c23253da84e6be (patch) | |
| tree | 7cc043fb6cd758aa4a56d88f67a74d5ee124e382 /apps | |
| parent | 301b56fe9c731dd092cc9297246f4b1199af2f84 (diff) | |
| parent | aad48db964855c31e8f440c30cc3795d32d12703 (diff) | |
| download | android_development-0a3537f881f47da2ea27629c50c23253da84e6be.tar.gz android_development-0a3537f881f47da2ea27629c50c23253da84e6be.tar.bz2 android_development-0a3537f881f47da2ea27629c50c23253da84e6be.zip | |
am aad48db9: am cf06a033: Merge "Settings injector sample activity" into klp-dev
* commit 'aad48db964855c31e8f440c30cc3795d32d12703':
Settings injector sample activity
Diffstat (limited to 'apps')
14 files changed, 198 insertions, 0 deletions
diff --git a/apps/SettingInjectorSample/Android.mk b/apps/SettingInjectorSample/Android.mk new file mode 100644 index 000000000..8cc0c5ef2 --- /dev/null +++ b/apps/SettingInjectorSample/Android.mk @@ -0,0 +1,16 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := tests + +# Only compile source java files in this apk. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := SettingInjectorSample + +LOCAL_SDK_VERSION := current + +include $(BUILD_PACKAGE) + +# Use the following include to make our test apk. +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/apps/SettingInjectorSample/AndroidManifest.xml b/apps/SettingInjectorSample/AndroidManifest.xml new file mode 100644 index 000000000..1a55700a8 --- /dev/null +++ b/apps/SettingInjectorSample/AndroidManifest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 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. +--> + +<!-- Declare the contents of this Android application. The namespace + attribute brings in the Android platform namespace, and the package + supplies a unique name for the application. When writing your + own application, the package name must be changed from "com.example.*" + to come from a domain that you own or have control over. --> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.android.injector"> + <application android:label="My Setting Activity!"> + <activity android:name="MySettingActivity"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + + <service android:name="com.example.android.injector.MyInjectorService" > + <intent-filter> + <action android:name="com.android.settings.InjectedLocationSetting" /> + </intent-filter> + + <meta-data + android:name="com.android.settings.InjectedLocationSetting" + android:resource="@xml/my_injected_location_setting" /> + </service> + </application> +</manifest> diff --git a/apps/SettingInjectorSample/res/drawable-hdpi/ic_launcher.png b/apps/SettingInjectorSample/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..c1b44ccc8 --- /dev/null +++ b/apps/SettingInjectorSample/res/drawable-hdpi/ic_launcher.png diff --git a/apps/SettingInjectorSample/res/drawable-hdpi/ic_my_injected_setting.png b/apps/SettingInjectorSample/res/drawable-hdpi/ic_my_injected_setting.png Binary files differnew file mode 100644 index 000000000..053b5279b --- /dev/null +++ b/apps/SettingInjectorSample/res/drawable-hdpi/ic_my_injected_setting.png diff --git a/apps/SettingInjectorSample/res/drawable-mdpi/ic_launcher.png b/apps/SettingInjectorSample/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..a1bf709d3 --- /dev/null +++ b/apps/SettingInjectorSample/res/drawable-mdpi/ic_launcher.png diff --git a/apps/SettingInjectorSample/res/drawable-mdpi/ic_my_injected_setting.png b/apps/SettingInjectorSample/res/drawable-mdpi/ic_my_injected_setting.png Binary files differnew file mode 100644 index 000000000..7fe282fa5 --- /dev/null +++ b/apps/SettingInjectorSample/res/drawable-mdpi/ic_my_injected_setting.png diff --git a/apps/SettingInjectorSample/res/drawable-xhdpi/ic_launcher.png b/apps/SettingInjectorSample/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..a1bf709d3 --- /dev/null +++ b/apps/SettingInjectorSample/res/drawable-xhdpi/ic_launcher.png diff --git a/apps/SettingInjectorSample/res/drawable-xhdpi/ic_my_injected_setting.png b/apps/SettingInjectorSample/res/drawable-xhdpi/ic_my_injected_setting.png Binary files differnew file mode 100644 index 000000000..a625b3a00 --- /dev/null +++ b/apps/SettingInjectorSample/res/drawable-xhdpi/ic_my_injected_setting.png diff --git a/apps/SettingInjectorSample/res/drawable-xxhdpi/ic_launcher.png b/apps/SettingInjectorSample/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..b7df51b1e --- /dev/null +++ b/apps/SettingInjectorSample/res/drawable-xxhdpi/ic_launcher.png diff --git a/apps/SettingInjectorSample/res/layout/my_setting_activity.xml b/apps/SettingInjectorSample/res/layout/my_setting_activity.xml new file mode 100644 index 000000000..4703a3559 --- /dev/null +++ b/apps/SettingInjectorSample/res/layout/my_setting_activity.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<EditText xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:textSize="18sp" + android:autoText="true" + android:capitalize="sentences" + android:text="@string/my_setting_activity_text" /> + diff --git a/apps/SettingInjectorSample/res/values/strings.xml b/apps/SettingInjectorSample/res/values/strings.xml new file mode 100644 index 000000000..777c22e73 --- /dev/null +++ b/apps/SettingInjectorSample/res/values/strings.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 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. +--> + +<resources> + + <string name="my_setting_activity_text">Hello, World!</string> + + <string name="my_injected_setting_label">Injected setting</string> + <string name="disabled_setting_label">Disabled injected setting</string> + +</resources> diff --git a/apps/SettingInjectorSample/res/xml/my_injected_location_setting.xml b/apps/SettingInjectorSample/res/xml/my_injected_location_setting.xml new file mode 100644 index 000000000..9736b5396 --- /dev/null +++ b/apps/SettingInjectorSample/res/xml/my_injected_location_setting.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> + +<injected-location-setting xmlns:android="http://schemas.android.com/apk/res/android" + android:label="@string/my_injected_setting_label" + android:icon="@drawable/ic_my_injected_setting" + android:settingsActivity="com.example.android.injector.MySettingActivity" +/> diff --git a/apps/SettingInjectorSample/src/com/example/android/injector/MyInjectorService.java b/apps/SettingInjectorSample/src/com/example/android/injector/MyInjectorService.java new file mode 100644 index 000000000..255d991b0 --- /dev/null +++ b/apps/SettingInjectorSample/src/com/example/android/injector/MyInjectorService.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2013 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.example.android.injector; + +import android.location.SettingInjectorService; +import android.util.Log; + +/** + * Receiver that returns the status of the injected setting. + */ +public class MyInjectorService extends SettingInjectorService { + + private static final String TAG = "ClientService"; + + public MyInjectorService() { + super(TAG); + } + + @Override + protected Status getStatus() { + try { + // Simulate a delay while reading the setting from disk + Thread.sleep(1000); + } catch (InterruptedException e) { + Log.e(TAG, "", e); + } + + return new Status("Example status value", true); + } +} diff --git a/apps/SettingInjectorSample/src/com/example/android/injector/MySettingActivity.java b/apps/SettingInjectorSample/src/com/example/android/injector/MySettingActivity.java new file mode 100644 index 000000000..1e5e048d5 --- /dev/null +++ b/apps/SettingInjectorSample/src/com/example/android/injector/MySettingActivity.java @@ -0,0 +1,41 @@ +/* + * 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. + */ + +package com.example.android.injector; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; + + +/** + * A minimal "Hello, World!" application. + */ +public class MySettingActivity extends Activity { + /** + * Called with the activity is first created. + */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Set the layout for this activity. You can find it + // in res/layout/my_setting_activity.xml + View view = getLayoutInflater().inflate(R.layout.my_setting_activity, null); + setContentView(view); + } +} + |
