auto import from //depot/cupcake/@135843
This commit is contained in:
11
apps/CustomLocale/Android.mk
Normal file
11
apps/CustomLocale/Android.mk
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := user
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||||
|
|
||||||
|
LOCAL_PACKAGE_NAME := CustomLocale
|
||||||
|
LOCAL_CERTIFICATE := platform
|
||||||
|
|
||||||
|
include $(BUILD_PACKAGE)
|
||||||
37
apps/CustomLocale/AndroidManifest.xml
Normal file
37
apps/CustomLocale/AndroidManifest.xml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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.
|
||||||
|
-->
|
||||||
|
<manifest
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0" package="com.android.customlocale">
|
||||||
|
<application
|
||||||
|
android:icon="@drawable/icon"
|
||||||
|
android:label="@string/app_name">
|
||||||
|
<activity
|
||||||
|
android:label="@string/app_name" android:name="CustomLocaleActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name="NewLocaleDialog"
|
||||||
|
android:theme="@android:style/Theme.Dialog" />
|
||||||
|
</application>
|
||||||
|
<uses-sdk android:minSdkVersion="3" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||||
|
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
|
||||||
|
</manifest>
|
||||||
BIN
apps/CustomLocale/res/drawable/icon.png
Normal file
BIN
apps/CustomLocale/res/drawable/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
35
apps/CustomLocale/res/layout/list_item.xml
Normal file
35
apps/CustomLocale/res/layout/list_item.xml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dip">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/locale_code"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:textAppearanceLarge"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/locale_default" />
|
||||||
|
<TextView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/locale_name"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:textAppearance"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
</LinearLayout>
|
||||||
62
apps/CustomLocale/res/layout/main.xml
Normal file
62
apps/CustomLocale/res/layout/main.xml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:text="@string/header_current_locale"
|
||||||
|
android:textAppearance="@style/TextAppearance.header"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:background="@color/header_background" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/current_locale"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:padding="5dip" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:text="@string/header_locale_list"
|
||||||
|
android:textAppearance="@style/TextAppearance.header"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:background="@color/header_background" />
|
||||||
|
<ListView
|
||||||
|
android:id="@id/android:list"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:padding="8dip" />
|
||||||
|
<TextView
|
||||||
|
android:id="@id/android:empty"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:text="@string/no_data_label" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/new_locale"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:paddingLeft="8dip"
|
||||||
|
android:paddingRight="8dip"
|
||||||
|
android:text="@string/add_new_locale_button" />
|
||||||
|
</LinearLayout>
|
||||||
49
apps/CustomLocale/res/layout/new_locale.xml
Normal file
49
apps/CustomLocale/res/layout/new_locale.xml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="8dip"
|
||||||
|
android:paddingRight="8dip">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/new_locale_label" />
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/value"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/locale_default" android:inputType="text"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/add"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/add_button" android:layout_gravity="center_vertical"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/add_and_select"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/add_select_button" android:layout_gravity="center_vertical"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
25
apps/CustomLocale/res/values-fr/strings.xml
Normal file
25
apps/CustomLocale/res/values-fr/strings.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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="app_name">Locales Personalisées</string>
|
||||||
|
<string name="add_new_locale_button">Ajouter une nouvelle locale</string>
|
||||||
|
<string name="new_locale_label">Code de la nouvelle locale:</string>
|
||||||
|
<string name="add_button">Ajouter</string>
|
||||||
|
<string name="no_data_label">Aucune locale</string>
|
||||||
|
<string name="header_current_locale">Locale courrante</string>
|
||||||
|
<string name="header_locale_list">Liste des locales</string>
|
||||||
|
<string name="add_select_button">Ajouter et sélectionner</string>
|
||||||
|
</resources>
|
||||||
18
apps/CustomLocale/res/values/colors.xml
Normal file
18
apps/CustomLocale/res/values/colors.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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>
|
||||||
|
<color name="header_background">#888</color>
|
||||||
|
</resources>
|
||||||
26
apps/CustomLocale/res/values/strings.xml
Normal file
26
apps/CustomLocale/res/values/strings.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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="app_name">Custom Locale</string>
|
||||||
|
<string name="locale_default">ex_EX</string>
|
||||||
|
<string name="add_new_locale_button">Add New Locale</string>
|
||||||
|
<string name="new_locale_label">New locale code:</string>
|
||||||
|
<string name="add_button">Add</string>
|
||||||
|
<string name="no_data_label">No data</string>
|
||||||
|
<string name="header_current_locale">Current Locale</string>
|
||||||
|
<string name="header_locale_list">Locale List</string>
|
||||||
|
<string name="add_select_button">Add and Select</string>
|
||||||
|
</resources>
|
||||||
25
apps/CustomLocale/res/values/styles.xml
Normal file
25
apps/CustomLocale/res/values/styles.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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>
|
||||||
|
<style name="TextAppearance"
|
||||||
|
parent="android:TextAppearance" />
|
||||||
|
|
||||||
|
<style name="TextAppearance.header">
|
||||||
|
<item name="android:textSize">14sp</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,326 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.customlocale;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.ActivityManagerNative;
|
||||||
|
import android.app.IActivityManager;
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.ContextMenu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ListAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.SimpleAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the list of system locales as well as maintain a custom list of user
|
||||||
|
* locales. The user can select a locale and apply it or it can create or remove
|
||||||
|
* a custom locale.
|
||||||
|
*/
|
||||||
|
public class CustomLocaleActivity extends ListActivity {
|
||||||
|
|
||||||
|
private static final String CUSTOM_LOCALES_SEP = " ";
|
||||||
|
private static final String CUSTOM_LOCALES = "custom_locales";
|
||||||
|
private static final String KEY_CUSTOM = "custom";
|
||||||
|
private static final String KEY_NAME = "name";
|
||||||
|
private static final String KEY_CODE = "code";
|
||||||
|
|
||||||
|
private static final String TAG = "LocaleSetup";
|
||||||
|
private static final boolean DEBUG = true;
|
||||||
|
|
||||||
|
/** Request code returned when the NewLocaleDialog activity finishes. */
|
||||||
|
private static final int UPDATE_LIST = 42;
|
||||||
|
/** Menu item id for applying a locale */
|
||||||
|
private static final int MENU_APPLY = 43;
|
||||||
|
/** Menu item id for removing a custom locale */
|
||||||
|
private static final int MENU_REMOVE = 44;
|
||||||
|
|
||||||
|
/** List view displaying system and custom locales. */
|
||||||
|
private ListView mListView;
|
||||||
|
/** Textview used to display current locale */
|
||||||
|
private TextView mCurrentLocaleTextView;
|
||||||
|
/** Private shared preferences of this activity. */
|
||||||
|
private SharedPreferences mPrefs;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.main);
|
||||||
|
|
||||||
|
mPrefs = getPreferences(MODE_PRIVATE);
|
||||||
|
|
||||||
|
Button newLocaleButton = (Button) findViewById(R.id.new_locale);
|
||||||
|
|
||||||
|
newLocaleButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent(CustomLocaleActivity.this, NewLocaleDialog.class);
|
||||||
|
startActivityForResult(i, UPDATE_LIST);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mListView = (ListView) findViewById(android.R.id.list);
|
||||||
|
mListView.setFocusable(true);
|
||||||
|
mListView.setFocusableInTouchMode(true);
|
||||||
|
mListView.requestFocus();
|
||||||
|
registerForContextMenu(mListView);
|
||||||
|
setupLocaleList();
|
||||||
|
|
||||||
|
mCurrentLocaleTextView = (TextView) findViewById(R.id.current_locale);
|
||||||
|
displayCurrentLocale();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
|
if (requestCode == UPDATE_LIST && resultCode == RESULT_OK && data != null) {
|
||||||
|
String locale = data.getExtras().getString(NewLocaleDialog.INTENT_EXTRA_LOCALE);
|
||||||
|
if (locale != null && locale.length() > 0) {
|
||||||
|
// Get current custom locale list
|
||||||
|
String customLocales = mPrefs.getString(CUSTOM_LOCALES, null);
|
||||||
|
|
||||||
|
// Update
|
||||||
|
if (customLocales == null) {
|
||||||
|
customLocales = locale;
|
||||||
|
} else {
|
||||||
|
customLocales += CUSTOM_LOCALES_SEP + locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save prefs
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "add/customLocales: " + customLocales);
|
||||||
|
}
|
||||||
|
mPrefs.edit().putString(CUSTOM_LOCALES, customLocales).commit();
|
||||||
|
|
||||||
|
Toast.makeText(this, "Added custom locale: " + locale, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
// Update list view
|
||||||
|
setupLocaleList();
|
||||||
|
|
||||||
|
// Find the item to select it in the list view
|
||||||
|
ListAdapter a = mListView.getAdapter();
|
||||||
|
for (int i = 0; i < a.getCount(); i++) {
|
||||||
|
Object o = a.getItem(i);
|
||||||
|
if (o instanceof Map<?, ?>) {
|
||||||
|
String code = ((Map<String, String>) o).get(KEY_CODE);
|
||||||
|
if (code != null && code.equals(locale)) {
|
||||||
|
mListView.setSelection(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getExtras().getBoolean(NewLocaleDialog.INTENT_EXTRA_SELECT)) {
|
||||||
|
selectLocale(locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupLocaleList() {
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Update locate list");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Map<String, String>> data = new ArrayList<Map<String, String>>();
|
||||||
|
|
||||||
|
// Insert all system locales
|
||||||
|
String[] locales = getAssets().getLocales();
|
||||||
|
for (String locale : locales) {
|
||||||
|
Locale loc = new Locale(locale);
|
||||||
|
|
||||||
|
Map<String, String> map = new HashMap<String, String>(1);
|
||||||
|
map.put(KEY_CODE, locale);
|
||||||
|
map.put(KEY_NAME, loc.getDisplayName());
|
||||||
|
data.add(map);
|
||||||
|
}
|
||||||
|
locales = null;
|
||||||
|
|
||||||
|
// Insert all custom locales
|
||||||
|
String customLocales = mPrefs.getString(CUSTOM_LOCALES, "");
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "customLocales: " + customLocales);
|
||||||
|
}
|
||||||
|
for (String locale : customLocales.split(CUSTOM_LOCALES_SEP)) {
|
||||||
|
if (locale != null && locale.length() > 0) {
|
||||||
|
Locale loc = new Locale(locale);
|
||||||
|
|
||||||
|
Map<String, String> map = new HashMap<String, String>(1);
|
||||||
|
map.put(KEY_CODE, locale);
|
||||||
|
map.put(KEY_NAME, loc.getDisplayName() + " [Custom]");
|
||||||
|
// the presence of the "custom" key marks it as custom.
|
||||||
|
map.put(KEY_CUSTOM, "");
|
||||||
|
data.add(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort all locales by code
|
||||||
|
Collections.sort(data, new Comparator<Map<String, String>>() {
|
||||||
|
public int compare(Map<String, String> lhs, Map<String, String> rhs) {
|
||||||
|
return lhs.get(KEY_CODE).compareTo(rhs.get(KEY_CODE));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the list view adapter
|
||||||
|
mListView.setAdapter(new SimpleAdapter(this, data, R.layout.list_item, new String[] {
|
||||||
|
KEY_CODE, KEY_NAME}, new int[] {R.id.locale_code, R.id.locale_name}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||||
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
|
|
||||||
|
if (menuInfo instanceof AdapterContextMenuInfo) {
|
||||||
|
int position = ((AdapterContextMenuInfo) menuInfo).position;
|
||||||
|
Object o = mListView.getItemAtPosition(position);
|
||||||
|
if (o instanceof Map<?, ?>) {
|
||||||
|
String locale = ((Map<String, String>) o).get(KEY_CODE);
|
||||||
|
String custom = ((Map<String, String>) o).get(KEY_CUSTOM);
|
||||||
|
|
||||||
|
if (custom == null) {
|
||||||
|
menu.setHeaderTitle("System Locale");
|
||||||
|
menu.add(0, MENU_APPLY, 0, "Apply");
|
||||||
|
} else {
|
||||||
|
menu.setHeaderTitle("Custom Locale");
|
||||||
|
menu.add(0, MENU_APPLY, 0, "Apply");
|
||||||
|
menu.add(0, MENU_REMOVE, 0, "Remove");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean onContextItemSelected(MenuItem item) {
|
||||||
|
|
||||||
|
String pendingLocale = null;
|
||||||
|
boolean is_custom = false;
|
||||||
|
|
||||||
|
ContextMenuInfo menuInfo = item.getMenuInfo();
|
||||||
|
if (menuInfo instanceof AdapterContextMenuInfo) {
|
||||||
|
int position = ((AdapterContextMenuInfo) menuInfo).position;
|
||||||
|
Object o = mListView.getItemAtPosition(position);
|
||||||
|
if (o instanceof Map<?, ?>) {
|
||||||
|
pendingLocale = ((Map<String, String>) o).get(KEY_CODE);
|
||||||
|
is_custom = ((Map<String, String>) o).get(KEY_CUSTOM) != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pendingLocale == null) {
|
||||||
|
// should never happen
|
||||||
|
return super.onContextItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getItemId() == MENU_REMOVE) {
|
||||||
|
// Get current custom locale list
|
||||||
|
String customLocales = mPrefs.getString(CUSTOM_LOCALES, "");
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Remove " + pendingLocale + " from custom locales: " + customLocales);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String locale : customLocales.split(CUSTOM_LOCALES_SEP)) {
|
||||||
|
if (locale != null && locale.length() > 0 && !locale.equals(pendingLocale)) {
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.append(CUSTOM_LOCALES_SEP);
|
||||||
|
}
|
||||||
|
sb.append(locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String newLocales = sb.toString();
|
||||||
|
if (!newLocales.equals(customLocales)) {
|
||||||
|
// Save prefs
|
||||||
|
mPrefs.edit().putString(CUSTOM_LOCALES, customLocales).commit();
|
||||||
|
|
||||||
|
Toast.makeText(this, "Removed custom locale: " + pendingLocale, Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (item.getItemId() == MENU_APPLY) {
|
||||||
|
selectLocale(pendingLocale);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onContextItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectLocale(String locale) {
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Select locale " + locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
IActivityManager am = ActivityManagerNative.getDefault();
|
||||||
|
Configuration config = am.getConfiguration();
|
||||||
|
|
||||||
|
Locale loc = new Locale(locale);
|
||||||
|
config.locale = loc;
|
||||||
|
|
||||||
|
// indicate this isn't some passing default - the user wants this
|
||||||
|
// remembered
|
||||||
|
config.userSetLocale = true;
|
||||||
|
|
||||||
|
am.updateConfiguration(config);
|
||||||
|
|
||||||
|
Toast.makeText(this, "Select locale: " + locale, Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.e(TAG, "Select locale failed", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayCurrentLocale() {
|
||||||
|
try {
|
||||||
|
IActivityManager am = ActivityManagerNative.getDefault();
|
||||||
|
Configuration config = am.getConfiguration();
|
||||||
|
|
||||||
|
if (config.locale != null) {
|
||||||
|
String text = String.format("%s - %s",
|
||||||
|
config.locale.toString(),
|
||||||
|
config.locale.getDisplayName());
|
||||||
|
mCurrentLocaleTextView.setText(text);
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.e(TAG, "get current locale failed", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.customlocale;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dialog to ask the user for a new locale. <p/> Returns the locale code (e.g.
|
||||||
|
* "en_US") via an intent with a "locale" extra string and a "select" extra
|
||||||
|
* boolean.
|
||||||
|
*/
|
||||||
|
public class NewLocaleDialog extends Activity
|
||||||
|
implements View.OnClickListener, View.OnKeyListener {
|
||||||
|
|
||||||
|
public static final String INTENT_EXTRA_LOCALE = "locale";
|
||||||
|
public static final String INTENT_EXTRA_SELECT = "select";
|
||||||
|
|
||||||
|
private static final String TAG = "NewLocale";
|
||||||
|
private static final boolean DEBUG = true;
|
||||||
|
private Button mButtonAdd;
|
||||||
|
private Button mButtonAddSelect;
|
||||||
|
private EditText mEditText;
|
||||||
|
private boolean mWasEmpty;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.new_locale);
|
||||||
|
|
||||||
|
mEditText = (EditText) findViewById(R.id.value);
|
||||||
|
mWasEmpty = true;
|
||||||
|
|
||||||
|
mButtonAdd = (Button) findViewById(R.id.add);
|
||||||
|
mButtonAdd.setOnClickListener(this);
|
||||||
|
mButtonAdd.setEnabled(false);
|
||||||
|
|
||||||
|
mButtonAddSelect = (Button) findViewById(R.id.add_and_select);
|
||||||
|
mButtonAddSelect.setOnClickListener(this);
|
||||||
|
mButtonAddSelect.setEnabled(false);
|
||||||
|
|
||||||
|
mEditText.setOnKeyListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
String locale = mEditText.getText().toString();
|
||||||
|
boolean select = v == mButtonAddSelect;
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "New Locale: " + locale + (select ? " + select" : ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent data = new Intent(NewLocaleDialog.this, NewLocaleDialog.class);
|
||||||
|
data.putExtra(INTENT_EXTRA_LOCALE, locale);
|
||||||
|
data.putExtra(INTENT_EXTRA_SELECT, select);
|
||||||
|
setResult(RESULT_OK, data);
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||||
|
boolean isEmpty = TextUtils.isEmpty(mEditText.getText());
|
||||||
|
if (isEmpty != mWasEmpty) {
|
||||||
|
mWasEmpty = isEmpty;
|
||||||
|
|
||||||
|
mButtonAdd.setEnabled(!isEmpty);
|
||||||
|
mButtonAddSelect.setEnabled(!isEmpty);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
apps/Development/Android.mk
Normal file
15
apps/Development/Android.mk
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := eng development tests
|
||||||
|
|
||||||
|
LOCAL_JAVA_LIBRARIES := android.test.runner
|
||||||
|
LOCAL_STATIC_JAVA_LIBRARIES := googlelogin-client
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(call all-subdir-java-files) \
|
||||||
|
src/com/android/development/IRemoteService.aidl \
|
||||||
|
|
||||||
|
LOCAL_PACKAGE_NAME := Development
|
||||||
|
LOCAL_CERTIFICATE := platform
|
||||||
|
|
||||||
|
include $(BUILD_PACKAGE)
|
||||||
136
apps/Development/AndroidManifest.xml
Normal file
136
apps/Development/AndroidManifest.xml
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.android.development"
|
||||||
|
android:versionCode="1" android:versionName="1.0">
|
||||||
|
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||||
|
<uses-permission android:name="android.permission.DUMP" />
|
||||||
|
<uses-permission android:name="android.permission.SET_PREFERRED_APPLICATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.RESTART_PACKAGES" />
|
||||||
|
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE" />
|
||||||
|
<uses-permission android:name="android.permission.SET_PROCESS_LIMIT" />
|
||||||
|
<uses-permission android:name="android.permission.SET_ALWAYS_FINISH" />
|
||||||
|
<uses-permission android:name="android.permission.SET_DEBUG_APP" />
|
||||||
|
<uses-permission android:name="android.permission.HARDWARE_TEST" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
|
||||||
|
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES" />
|
||||||
|
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.YouTubeUser" />
|
||||||
|
<uses-permission android:name="com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD" />
|
||||||
|
|
||||||
|
<application android:label="Dev Tools"
|
||||||
|
android:icon="@drawable/ic_launcher_devtools">
|
||||||
|
|
||||||
|
<uses-library android:name="android.test.runner" />
|
||||||
|
<uses-library android:name="com.google.android.maps" />
|
||||||
|
|
||||||
|
<activity android:name="Development" android:label="Dev Tools"
|
||||||
|
android:icon="@drawable/ic_launcher_devtools">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="PackageBrowser" android:label="Package Browser">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="ExceptionBrowser" android:label="Exception Browser">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="StacktraceViewer" android:label="Stacktrace Viewer"/>
|
||||||
|
<activity android:name="PackageSummary" android:label="Package Summary">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="ShowActivity" android:label="Activity">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="AppPicker"
|
||||||
|
android:theme="@android:style/Theme.Dialog">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="PointerLocation" android:label="Pointer Location"
|
||||||
|
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|navigation|orientation">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name="DataList">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="Details">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="DevelopmentSettings" android:label="Development Settings" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name="InstrumentationList" android:label="Instrumentation">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name="MediaScannerActivity" android:label="Media Scanner">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name="GLSTester" android:label="Google Login Service">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name="RunningProcesses" android:label="Running processes">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="ProcessInfo" android:label="Process Information">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<!--
|
||||||
|
<activity android:name="AppHwConfigList" android:label="Applications Hw Configuration">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
-->
|
||||||
|
<activity android:name="AppHwPref" android:label="Applications Hardware Preferences">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
26
apps/Development/res/drawable/box.xml
Normal file
26
apps/Development/res/drawable/box.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/* //device/apps/common/res/drawable/box.xml
|
||||||
|
**
|
||||||
|
** Copyright 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#00000000"/>
|
||||||
|
<stroke android:width="1dp" color="#ff000000"/>
|
||||||
|
<padding android:left="1dp" android:top="1dp"
|
||||||
|
android:right="1dp" android:bottom="1dp" />
|
||||||
|
</shape>
|
||||||
BIN
apps/Development/res/drawable/ic_launcher_devtools.png
Normal file
BIN
apps/Development/res/drawable/ic_launcher_devtools.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
apps/Development/res/drawable/stat_sample.png
Normal file
BIN
apps/Development/res/drawable/stat_sample.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
82
apps/Development/res/layout/application_hw_pref.xml
Executable file
82
apps/Development/res/layout/application_hw_pref.xml
Executable file
@@ -0,0 +1,82 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:padding="4dip" >
|
||||||
|
|
||||||
|
<TextView android:id="@+id/attr_package_label"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/package_label"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView android:id="@+id/attr_package"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/attr_touchscreen_label"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/touchscreen_label"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView android:id="@+id/attr_touchscreen"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/attr_input_method_label"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/input_method_label"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView android:id="@+id/attr_input_method"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/attr_hard_keyboard_label"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/hard_keyboard_label"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView android:id="@+id/attr_hard_keyboard"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/attr_navigation_label"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/navigation_label"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView android:id="@+id/attr_navigation"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/attr_five_way_nav_label"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/five_way_nav_label"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView android:id="@+id/attr_five_way_nav"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
156
apps/Development/res/layout/development_settings.xml
Normal file
156
apps/Development/res/layout/development_settings.xml
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/* //device/apps/Settings/assets/res/any/layout/keyboard_version.xml
|
||||||
|
**
|
||||||
|
** Copyright 2006, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/debug_app_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_debug_app_label_text" />
|
||||||
|
|
||||||
|
<Button android:id="@+id/debug_app"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/debug_app_label"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_toRightOf="@id/debug_app_label" />
|
||||||
|
|
||||||
|
<!-- android:visibility="gone" -->
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/wait_for_debugger"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/debug_app"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_wait_for_debugger_text" />
|
||||||
|
|
||||||
|
<View android:id="@+id/separator"
|
||||||
|
android:layout_width="8dip"
|
||||||
|
android:layout_height="8dip"
|
||||||
|
android:layout_below="@id/wait_for_debugger"
|
||||||
|
android:layout_alignParentLeft="true" />
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/show_load"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/separator"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_show_load_text" />
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/show_updates"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/show_load"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_show_updates_text" />
|
||||||
|
|
||||||
|
<Spinner android:id="@+id/max_procs"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/show_updates"
|
||||||
|
android:layout_alignParentLeft="true" />
|
||||||
|
|
||||||
|
<View android:id="@+id/separator2"
|
||||||
|
android:layout_width="8dip"
|
||||||
|
android:layout_height="8dip"
|
||||||
|
android:layout_below="@id/max_procs"
|
||||||
|
android:layout_alignParentLeft="true" />
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/always_finish"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/separator2"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_always_finish_text" />
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/show_cpu"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/always_finish"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_show_cpu_text" />
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/enable_gl"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/show_cpu"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_enable_gl_text" />
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/show_background"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/enable_gl"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_show_background_text" />
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/show_sleep"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/show_background"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_show_sleep_text" />
|
||||||
|
|
||||||
|
<Spinner android:id="@+id/window_animation_scale"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/show_sleep"
|
||||||
|
android:layout_alignParentLeft="true">
|
||||||
|
</Spinner>
|
||||||
|
|
||||||
|
<Spinner android:id="@+id/transition_animation_scale"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/window_animation_scale"
|
||||||
|
android:layout_alignParentLeft="true">
|
||||||
|
</Spinner>
|
||||||
|
|
||||||
|
<Spinner android:id="@+id/font_hinting"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/transition_animation_scale"
|
||||||
|
android:layout_alignParentLeft="true">
|
||||||
|
</Spinner>
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/show_xmpp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/font_hinting"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_show_xmpp_text" />
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/show_maps_compass"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/show_xmpp"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="@string/development_settings_show_maps_compass_text" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
33
apps/Development/res/layout/enter_url.xml
Normal file
33
apps/Development/res/layout/enter_url.xml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent">
|
||||||
|
<com.android.development.UrlEditText android:id="@+id/url_edit_text"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:autoText="false"
|
||||||
|
android:capitalize="none"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
||||||
|
<com.android.development.DisplayEditText android:id="@+id/display_edit_text"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:autoText="false"
|
||||||
|
android:capitalize="none"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
||||||
|
<ListView android:id="@android:id/list"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
111
apps/Development/res/layout/gls_tester.xml
Normal file
111
apps/Development/res/layout/gls_tester.xml
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/prefer_hosted"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gls_tester_prefer_hosted"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/require_google"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gls_tester_require_google"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/get_accounts"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gls_tester_get_accounts"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/clear"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gls_tester_clear"/>
|
||||||
|
|
||||||
|
<Button android:id="@+id/go"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gls_tester_go"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<EditText android:id="@+id/username_edit"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minWidth="250dip"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:capitalize="none"
|
||||||
|
android:autoText="false"/>
|
||||||
|
|
||||||
|
<LinearLayout android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/do_notification"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gls_tester_do_notification"/>
|
||||||
|
|
||||||
|
<CheckBox android:id="@+id/run_intent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gls_tester_run_intent"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<Spinner android:id="@+id/service_spinner"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:entries="@array/glstester_services"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/wipe_passwords"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gls_tester_wipe_passwords"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.android.development.LogTextBox
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:background="@drawable/box"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0dip"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:textSize="10dip"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
20
apps/Development/res/layout/log_viewer.xml
Normal file
20
apps/Development/res/layout/log_viewer.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.android.development.LogTextBox xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
/>
|
||||||
25
apps/Development/res/layout/media_scanner_activity.xml
Normal file
25
apps/Development/res/layout/media_scanner_activity.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/title" android:textSize="16sp" android:textStyle="bold"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
70
apps/Development/res/layout/monkey_screen.xml
Normal file
70
apps/Development/res/layout/monkey_screen.xml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="10dip" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingRight="5dip"
|
||||||
|
android:text="@string/monkey_screen_initial_activity_label" />
|
||||||
|
|
||||||
|
<Button android:id="@+id/initialActivity"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/monkey_screen_initialActivity_text" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="5dip" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingRight="5dip"
|
||||||
|
android:text="@string/monkey_screen_number_of_events_label" />
|
||||||
|
|
||||||
|
<EditText android:id="@+id/numberOfEvents"
|
||||||
|
android:layout_marginLeft="2dip"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:drawable/editbox_background"
|
||||||
|
android:numeric="integer"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:maxLines="1" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button android:id="@+id/start"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="10dip"
|
||||||
|
android:text="@string/monkey_screen_start_text" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
20
apps/Development/res/layout/package_item.xml
Normal file
20
apps/Development/res/layout/package_item.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<Button xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<!--android:background="@android:drawable/list_highlight"-->
|
||||||
151
apps/Development/res/layout/package_summary.xml
Normal file
151
apps/Development/res/layout/package_summary.xml
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:padding="4dip" >
|
||||||
|
|
||||||
|
<TextView android:id="@+id/packageView"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingTop="4dip"
|
||||||
|
android:paddingBottom="6dip"
|
||||||
|
android:paddingRight="4dip" >
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/icon"
|
||||||
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
|
android:paddingRight="8dip" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/classView"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/label"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/disabled"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/disabled" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/system"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/system" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/debuggable"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/debuggable" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/nocode"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/nocode" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/persistent"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/persistent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button android:id="@+id/restart"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="@string/restart" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/package_summary_process_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/process"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/package_summary_uid_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/uid"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/package_summary_task_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/task"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/package_summary_version_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/version"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/package_summary_source_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/source"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/package_summary_data_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/data"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/activities" style="@style/SummaryCategoryLayout">
|
||||||
|
<TextView style="@style/SummaryCategoryHeader"
|
||||||
|
android:text="@string/package_summary_activities_label" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/receivers" style="@style/SummaryCategoryLayout">
|
||||||
|
<TextView style="@style/SummaryCategoryHeader"
|
||||||
|
android:text="@string/package_summary_receivers_label" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/services" style="@style/SummaryCategoryLayout">
|
||||||
|
<TextView style="@style/SummaryCategoryHeader"
|
||||||
|
android:text="@string/package_summary_services_label" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/providers" style="@style/SummaryCategoryLayout">
|
||||||
|
<TextView style="@style/SummaryCategoryHeader"
|
||||||
|
android:text="@string/package_summary_providers_label" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/instrumentation" style="@style/SummaryCategoryLayout">
|
||||||
|
<TextView style="@style/SummaryCategoryHeader"
|
||||||
|
android:text="@string/package_summary_instrumentation_label" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
51
apps/Development/res/layout/process_info.xml
Executable file
51
apps/Development/res/layout/process_info.xml
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:padding="4dip" >
|
||||||
|
|
||||||
|
<TextView android:id="@+id/process_name_header"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/process_name_header"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView android:id="@+id/process_name"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<TextView android:id="@+id/package_list_header"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/package_list_header"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/package_list"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="4dip"
|
||||||
|
android:paddingBottom="6dip"
|
||||||
|
android:paddingRight="4dip" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
49
apps/Development/res/layout/radio_issue.xml
Normal file
49
apps/Development/res/layout/radio_issue.xml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<!--
|
||||||
|
**
|
||||||
|
** Copyright 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button android:id="@+id/submit"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:layout_marginTop="8dip"
|
||||||
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/radio_issue_submit_text"
|
||||||
|
/>
|
||||||
|
<TextView android:id="@+id/instructions"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:layout_marginTop="10dip"
|
||||||
|
android:layout_marginLeft="4dip"
|
||||||
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/radio_issue_instructions_text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<EditText android:id="@+id/report_text"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
106
apps/Development/res/layout/show_activity.xml
Normal file
106
apps/Development/res/layout/show_activity.xml
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/* //device/apps/Settings/res/layout/keyguard.xml
|
||||||
|
**
|
||||||
|
** Copyright 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="8dip" android:paddingLeft="2dip" android:paddingRight="2dip" >
|
||||||
|
|
||||||
|
<TextView android:id="@+id/packageView"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingTop="4dip"
|
||||||
|
android:paddingBottom="6dip" >
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/icon"
|
||||||
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
|
android:paddingRight="8dip" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/classView"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/label"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/launch"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/show_activity_process_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/process"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/show_activity_task_affinity_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/taskAffinity"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/show_activity_required_permission_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/permission"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/show_activity_multiprocess_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/multiprocess"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/show_activity_clear_on_background_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/clearOnBackground"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView style="@style/SummaryCategoryLayout"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" android:text="@string/show_activity_state_not_needed_label" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/stateNotNeeded"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
22
apps/Development/res/layout/url_list.xml
Normal file
22
apps/Development/res/layout/url_list.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#FF000000"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:maxLines="1" />
|
||||||
31
apps/Development/res/values/arrays.xml
Normal file
31
apps/Development/res/values/arrays.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<string-array name="glstester_services">
|
||||||
|
<item>mail</item>
|
||||||
|
<item>SID</item>
|
||||||
|
<item>LSID</item>
|
||||||
|
<item>youtube</item>
|
||||||
|
<item>YouTubeUser</item>
|
||||||
|
<item>sierra</item>
|
||||||
|
<item>lh2</item>
|
||||||
|
<item>cl</item>
|
||||||
|
<item>cp</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
||||||
|
|
||||||
|
|
||||||
126
apps/Development/res/values/strings.xml
Normal file
126
apps/Development/res/values/strings.xml
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/* //device/apps/common/assets/res/any/strings.xml
|
||||||
|
**
|
||||||
|
** Copyright 2006, 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="menu_upload_exceptions">Upload Exceptions</string>
|
||||||
|
<string name="menu_clear_exceptions">Clear Exceptions</string>
|
||||||
|
|
||||||
|
<string name="device_info_default">unknown</string>
|
||||||
|
<string name="device_info_uptime">Uptime</string>
|
||||||
|
<string name="device_info_awaketime">Awake Time</string>
|
||||||
|
<string name="device_info_asleeptime">Asleep Time</string>
|
||||||
|
|
||||||
|
<string name="build_id_label">Build ID</string>
|
||||||
|
<string name="build_date_label">Build Date</string>
|
||||||
|
<string name="build_type_label">Build Type</string>
|
||||||
|
<string name="build_product_label">Build Product</string>
|
||||||
|
<string name="build_user_label">Build Label</string>
|
||||||
|
<string name="build_host_label">Build Host</string>
|
||||||
|
<string name="gsm_version_baseband_label">Baseband Version</string>
|
||||||
|
<string name="gsm_version_ril_impl_label">RIL Impl Version</string>
|
||||||
|
|
||||||
|
<string name="turn_on_radio">Turn on radio</string>
|
||||||
|
<string name="turn_off_radio">Turn off radio</string>
|
||||||
|
|
||||||
|
<string name="refresh_networks">Refresh Network List</string>
|
||||||
|
|
||||||
|
<string name="radioInfo_menu_viewADN">View SIM Address Book</string>
|
||||||
|
<string name="radioInfo_menu_viewFDN">View Fixed Dialing Numbers</string>
|
||||||
|
<string name="radioInfo_menu_viewSDN">View Service Dialing Numbers</string>
|
||||||
|
|
||||||
|
<!-- Package summary in Package Browser -->
|
||||||
|
<string name="disabled"><i>disabled</i></string>
|
||||||
|
<string name="system"><i>system</i></string>
|
||||||
|
<string name="debuggable"><i>debuggable</i></string>
|
||||||
|
<string name="nocode"><i>no code</i></string>
|
||||||
|
<string name="persistent"><i>persistent</i></string>
|
||||||
|
<string name="restart">Restart</string>
|
||||||
|
<string name="package_summary_uid_label">User ID</string>
|
||||||
|
<string name="package_summary_task_label">Task Affinity</string>
|
||||||
|
<string name="package_summary_version_label">Version</string>
|
||||||
|
<string name="package_summary_source_label">Source</string>
|
||||||
|
<string name="package_summary_receivers_label">Receivers</string>
|
||||||
|
<string name="package_summary_data_label">Data</string>
|
||||||
|
<string name="package_summary_instrumentation_label">Instrumentation</string>
|
||||||
|
<string name="package_summary_process_label">Process</string>
|
||||||
|
<string name="package_summary_services_label">Services</string>
|
||||||
|
<string name="package_summary_providers_label">Providers</string>
|
||||||
|
<string name="package_summary_activities_label">Activities</string>
|
||||||
|
|
||||||
|
<!-- Activity details in Package Browser -->
|
||||||
|
<string name="none">"(none)"</string>
|
||||||
|
<string name="yes">Yes</string>
|
||||||
|
<string name="no">No</string>
|
||||||
|
<string name="launch_multiple">Multiple (normal)</string>
|
||||||
|
<string name="launch_singleTop">Single Top</string>
|
||||||
|
<string name="launch_singleTask">Single Task</string>
|
||||||
|
<string name="launch_singleInstance">Single Instance</string>
|
||||||
|
<string name="launch_unknown">"(Unknown)"</string>
|
||||||
|
|
||||||
|
<string name="development_settings_show_cpu_text">Show CPU usage</string>
|
||||||
|
<string name="development_settings_always_finish_text">Immediately destroy activities</string>
|
||||||
|
<string name="development_settings_show_load_text">Show running processes</string>
|
||||||
|
<string name="development_settings_show_updates_text">Show screen updates</string>
|
||||||
|
<string name="development_settings_enable_gl_text">Enable OpenGL ES (reboot needed)</string>
|
||||||
|
<string name="development_settings_allow_mock_location_text">Allow mock locations for testing</string>
|
||||||
|
<string name="development_settings_wait_for_debugger_text">Wait for debugger</string>
|
||||||
|
<string name="development_settings_show_background_text">Show background</string>
|
||||||
|
<string name="development_settings_show_xmpp_text">Show GTalk service connection status</string>
|
||||||
|
<string name="development_settings_debug_app_label_text">Debug App:</string>
|
||||||
|
<string name="development_settings_show_sleep_text">Show sleep state on LED</string>
|
||||||
|
<string name="development_settings_show_maps_compass_text">Show compass in Maps</string>
|
||||||
|
<string name="development_settings_keep_screen_on_text">Keep screen on while plugged in</string>
|
||||||
|
|
||||||
|
<string name="monkey_screen_initialActivity_text"></string>
|
||||||
|
<string name="monkey_screen_number_of_events_label">Number of Events: </string>
|
||||||
|
<string name="monkey_screen_start_text">Start</string>
|
||||||
|
<string name="monkey_screen_initial_activity_label">Initial Activity: </string>
|
||||||
|
|
||||||
|
<string name="radio_issue_submit_text">Submit report</string>
|
||||||
|
<string name="radio_issue_instructions_text">Enter a description of the issue.</string>
|
||||||
|
|
||||||
|
<string name="show_activity_clear_on_background_label">Clear on Background</string>
|
||||||
|
<string name="show_activity_task_affinity_label">Task Affinity</string>
|
||||||
|
<string name="show_activity_process_label">Process</string>
|
||||||
|
<string name="show_activity_state_not_needed_label">State Not Needed</string>
|
||||||
|
<string name="show_activity_required_permission_label">Required Permission</string>
|
||||||
|
<string name="show_activity_multiprocess_label">Multiprocess</string>
|
||||||
|
|
||||||
|
<string name="red_button_behavior_label">End Button Behavior</string>
|
||||||
|
|
||||||
|
<string name="gls_tester_label">GLS Tester</string>
|
||||||
|
<string name="gls_tester_prefer_hosted">Hosted</string>
|
||||||
|
<string name="gls_tester_require_google">Google</string>
|
||||||
|
<string name="gls_tester_get_accounts">List</string>
|
||||||
|
<string name="gls_tester_clear">Clear</string>
|
||||||
|
<string name="gls_tester_go">Go</string>
|
||||||
|
<string name="gls_tester_do_notification">Notify on failure</string>
|
||||||
|
<string name="gls_tester_run_intent">Run intent</string>
|
||||||
|
<string name="gls_tester_wipe_passwords">Wipe passwords</string>
|
||||||
|
<string name="process_name_header">Process Name:</string>
|
||||||
|
<string name="package_list_header">Packages in process:</string>
|
||||||
|
<string name="package_label">Package Name:</string>
|
||||||
|
|
||||||
|
<!-- Application configuration requirements related attributes -->
|
||||||
|
<string name="touchscreen_label">touchscreen:</string>
|
||||||
|
<string name="input_method_label">inputMethod:</string>
|
||||||
|
<string name="hard_keyboard_label">hardKeyboard:</string>
|
||||||
|
<string name="navigation_label">navigation:</string>
|
||||||
|
<string name="five_way_nav_label">five way nav:</string>
|
||||||
|
</resources>
|
||||||
76
apps/Development/res/values/styles.xml
Normal file
76
apps/Development/res/values/styles.xml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2006 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>
|
||||||
|
<style name="SummaryCategoryLayout">
|
||||||
|
<item name="android:layout_width">fill_parent</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:orientation">vertical</item>
|
||||||
|
</style>
|
||||||
|
<style name="SummaryCategoryHeader">
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:paddingTop">7dip</item>
|
||||||
|
<item name="android:paddingBottom">1dip</item>
|
||||||
|
<item name="android:maxLines">1</item>
|
||||||
|
<item name="android:textAppearance">@style/TextAppearance.SummaryCategoryHeader</item>
|
||||||
|
</style>
|
||||||
|
<style name="info_layout">
|
||||||
|
<item name="android:orientation">vertical</item>
|
||||||
|
<item name="android:paddingLeft">10dip</item>
|
||||||
|
<item name="android:paddingTop">10dip</item>
|
||||||
|
<item name="android:paddingRight">10dip</item>
|
||||||
|
<item name="android:paddingBottom">10dip</item>
|
||||||
|
<item name="android:layout_width">fill_parent</item>
|
||||||
|
<item name="android:layout_height">fill_parent</item>
|
||||||
|
</style>
|
||||||
|
<style name="entry_layout">
|
||||||
|
<item name="android:orientation">horizontal</item>
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
</style>
|
||||||
|
<style name="info_label">
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:textAppearance">@style/TextAppearance.info_label</item>
|
||||||
|
<item name="android:paddingRight">4dip</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="info_value">
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:textAppearance">@style/TextAppearance.info_value</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance" parent="android:TextAppearance">
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.info_label">
|
||||||
|
<item name="android:textSize">14sp</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.SummaryCategoryHeader">
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.info_value">
|
||||||
|
<item name="android:textSize">14sp</item>
|
||||||
|
<item name="android:textStyle">normal</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
||||||
|
|
||||||
156
apps/Development/src/com/android/development/AppHwConfigList.java
Executable file
156
apps/Development/src/com/android/development/AppHwConfigList.java
Executable file
@@ -0,0 +1,156 @@
|
|||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import java.text.Collator;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AppHwConfigList extends ListActivity {
|
||||||
|
private static final String TAG = "AppHwConfigList";
|
||||||
|
PackageManager mPm;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
mPm = getPackageManager();
|
||||||
|
mAdapter = new AppListAdapter(this);
|
||||||
|
if (mAdapter.getCount() <= 0) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
setListAdapter(mAdapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||||
|
PackageInfo app = mAdapter.appForPosition(position);
|
||||||
|
// TODO display all preference settings
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setClass(this, AppHwPref.class);
|
||||||
|
intent.putExtra("packageName", app.packageName);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class AppListAdapter extends BaseAdapter {
|
||||||
|
public AppListAdapter(Context context) {
|
||||||
|
mContext = context;
|
||||||
|
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
|
List<ApplicationInfo> appList = mPm.getInstalledApplications(0);
|
||||||
|
for (ApplicationInfo app : appList) {
|
||||||
|
PackageInfo pkgInfo = null;
|
||||||
|
try {
|
||||||
|
pkgInfo = mPm.getPackageInfo(app.packageName, 0);
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if ((pkgInfo != null)) {
|
||||||
|
if(mList == null) {
|
||||||
|
mList = new ArrayList<PackageInfo>();
|
||||||
|
}
|
||||||
|
mList.add(pkgInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mList != null) {
|
||||||
|
Collections.sort(mList, sDisplayNameComparator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PackageInfo appForPosition(int position) {
|
||||||
|
if (mList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return mList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return mList != null ? mList.size() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
View view;
|
||||||
|
if (convertView == null) {
|
||||||
|
view = mInflater.inflate(
|
||||||
|
android.R.layout.simple_list_item_1, parent, false);
|
||||||
|
} else {
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
bindView(view, mList.get(position));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void bindView(View view, PackageInfo info) {
|
||||||
|
TextView text = (TextView)view.findViewById(android.R.id.text1);
|
||||||
|
text.setText(info != null ? info.applicationInfo.loadLabel(mPm) : "(none)");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final Context mContext;
|
||||||
|
protected final LayoutInflater mInflater;
|
||||||
|
protected List<PackageInfo> mList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Comparator sDisplayNameComparator = new Comparator() {
|
||||||
|
public final int compare(Object a, Object b) {
|
||||||
|
CharSequence sa = ((PackageInfo) a).applicationInfo.loadLabel(mPm);
|
||||||
|
CharSequence sb = ((PackageInfo) b).applicationInfo.loadLabel(mPm);
|
||||||
|
return collator.compare(sa, sb);
|
||||||
|
}
|
||||||
|
private final Collator collator = Collator.getInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
private AppListAdapter mAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
228
apps/Development/src/com/android/development/AppHwPref.java
Normal file
228
apps/Development/src/com/android/development/AppHwPref.java
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import com.android.development.R;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ConfigurationInfo;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import java.text.Collator;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/* This activity displays the hardware configuration details
|
||||||
|
* of an application as defined in its manifests
|
||||||
|
*/
|
||||||
|
public class AppHwPref extends Activity {
|
||||||
|
private static final String TAG = "AppHwPref";
|
||||||
|
PackageManager mPm;
|
||||||
|
private static final int BASE = 0;
|
||||||
|
private static final int TOUCHSCREEN = BASE + 1;
|
||||||
|
private static final int KEYBOARD_TYPE = BASE + 2;
|
||||||
|
private static final int NAVIGATION = BASE + 3;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
String pkgName = intent.getStringExtra("packageName");
|
||||||
|
if(pkgName == null) {
|
||||||
|
handleError("Null package name", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mPm = getPackageManager();
|
||||||
|
PackageInfo pInfo;
|
||||||
|
try {
|
||||||
|
pInfo = mPm.getPackageInfo(pkgName, PackageManager.GET_CONFIGURATIONS);
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
pInfo = null;
|
||||||
|
}
|
||||||
|
if(pInfo == null) {
|
||||||
|
handleError("Failed retrieving packageInfo for pkg:"+pkgName, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConfigurationInfo appHwPref[] = pInfo.configPreferences;
|
||||||
|
|
||||||
|
setContentView(R.layout.application_hw_pref);
|
||||||
|
if(appHwPref != null) {
|
||||||
|
displayTextView(R.id.attr_package, pInfo.applicationInfo.loadLabel(mPm));
|
||||||
|
displayTextView(R.id.attr_touchscreen, appHwPref, TOUCHSCREEN);
|
||||||
|
displayTextView(R.id.attr_input_method, appHwPref, KEYBOARD_TYPE);
|
||||||
|
displayTextView(R.id.attr_navigation, appHwPref, NAVIGATION);
|
||||||
|
displayFlag(R.id.attr_hard_keyboard, ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD, appHwPref);
|
||||||
|
displayFlag(R.id.attr_five_way_nav, ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV, appHwPref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayFlag(int viewId, int flagMask, ConfigurationInfo[] appHwPref) {
|
||||||
|
if(appHwPref == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean flag = false;
|
||||||
|
for (int i = 0; i < appHwPref.length; i++) {
|
||||||
|
ConfigurationInfo pref = appHwPref[i];
|
||||||
|
if((pref.reqInputFeatures & flagMask) != 0) {
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(flag) {
|
||||||
|
displayTextView(viewId, "true");
|
||||||
|
} else {
|
||||||
|
displayTextView(viewId, "false");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleError(String errMsg, boolean finish) {
|
||||||
|
// TODO display dialog
|
||||||
|
Log.i(TAG, errMsg);
|
||||||
|
if(finish) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayTextView(int textViewId, CharSequence displayStr) {
|
||||||
|
TextView tView = (TextView) findViewById(textViewId);
|
||||||
|
if(displayStr != null) {
|
||||||
|
tView.setText(displayStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayTextView(int viewId, ConfigurationInfo[] config, int type) {
|
||||||
|
if((config == null) || (config.length < 1)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashSet<String> list = new HashSet<String>();
|
||||||
|
for(int i = 0; i < config.length; i++) {
|
||||||
|
String str = null;
|
||||||
|
switch(type) {
|
||||||
|
case TOUCHSCREEN:
|
||||||
|
str = getTouchScreenStr(config[i]);
|
||||||
|
break;
|
||||||
|
case KEYBOARD_TYPE:
|
||||||
|
str = getKeyboardTypeStr(config[i]);
|
||||||
|
break;
|
||||||
|
case NAVIGATION:
|
||||||
|
str = getNavigationStr(config[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(str != null) {
|
||||||
|
list.add(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String listStr = "";
|
||||||
|
boolean set = false;
|
||||||
|
for(String str : list) {
|
||||||
|
set = true;
|
||||||
|
listStr += str+",";
|
||||||
|
}
|
||||||
|
if(set) {
|
||||||
|
TextView tView = (TextView)findViewById(viewId);
|
||||||
|
CharSequence txt = listStr.subSequence(0, listStr.length()-1);
|
||||||
|
tView.setText(txt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTouchScreenStr(ConfigurationInfo appHwPref) {
|
||||||
|
if(appHwPref == null) {
|
||||||
|
handleError("Invalid HardwareConfigurationObject", true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
switch(appHwPref.reqTouchScreen) {
|
||||||
|
case Configuration.TOUCHSCREEN_FINGER:
|
||||||
|
return "finger";
|
||||||
|
case Configuration.TOUCHSCREEN_NOTOUCH:
|
||||||
|
return "notouch";
|
||||||
|
case Configuration.TOUCHSCREEN_STYLUS:
|
||||||
|
return "stylus";
|
||||||
|
case Configuration.TOUCHSCREEN_UNDEFINED:
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getKeyboardTypeStr(ConfigurationInfo appHwPref) {
|
||||||
|
if(appHwPref == null) {
|
||||||
|
handleError("Invalid HardwareConfigurationObject", true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
switch(appHwPref.reqKeyboardType) {
|
||||||
|
case Configuration.KEYBOARD_12KEY:
|
||||||
|
return "12key";
|
||||||
|
case Configuration.KEYBOARD_NOKEYS:
|
||||||
|
return "nokeys";
|
||||||
|
case Configuration.KEYBOARD_QWERTY:
|
||||||
|
return "querty";
|
||||||
|
case Configuration.KEYBOARD_UNDEFINED:
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getNavigationStr(ConfigurationInfo appHwPref) {
|
||||||
|
if(appHwPref == null) {
|
||||||
|
handleError("Invalid HardwareConfigurationObject", true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
switch(appHwPref.reqNavigation) {
|
||||||
|
case Configuration.NAVIGATION_DPAD:
|
||||||
|
return "dpad";
|
||||||
|
case Configuration.NAVIGATION_TRACKBALL:
|
||||||
|
return "trackball";
|
||||||
|
case Configuration.NAVIGATION_WHEEL:
|
||||||
|
return "wheel";
|
||||||
|
case Configuration.NAVIGATION_UNDEFINED:
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
167
apps/Development/src/com/android/development/AppPicker.java
Normal file
167
apps/Development/src/com/android/development/AppPicker.java
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
/* //device/java/android/android/app/ResolveListActivity.java
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.ActivityManagerNative;
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.text.Collator;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AppPicker extends ListActivity
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle)
|
||||||
|
{
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
mAdapter = new AppListAdapter(this);
|
||||||
|
if (mAdapter.getCount() <= 0) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
setListAdapter(mAdapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume()
|
||||||
|
{
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop()
|
||||||
|
{
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id)
|
||||||
|
{
|
||||||
|
ApplicationInfo app = mAdapter.appForPosition(position);
|
||||||
|
Intent intent = new Intent();
|
||||||
|
if (app != null) intent.setAction(app.packageName);
|
||||||
|
setResult(RESULT_OK, intent);
|
||||||
|
|
||||||
|
/* This is a temporary fix for 824637 while it is blocked by 805226. When 805226 is resolved, please remove this. */
|
||||||
|
try {
|
||||||
|
boolean waitForDebugger = Settings.System.getInt(
|
||||||
|
getContentResolver(), Settings.System.WAIT_FOR_DEBUGGER, 0) != 0;
|
||||||
|
ActivityManagerNative.getDefault().setDebugApp(
|
||||||
|
app != null ? app.packageName : null, waitForDebugger, true);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class AppListAdapter extends BaseAdapter
|
||||||
|
{
|
||||||
|
public AppListAdapter(Context context)
|
||||||
|
{
|
||||||
|
mContext = context;
|
||||||
|
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
|
mList = context.getPackageManager().getInstalledApplications(0);
|
||||||
|
if (mList != null) {
|
||||||
|
Collections.sort(mList, sDisplayNameComparator);
|
||||||
|
mList.add(0, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationInfo appForPosition(int position)
|
||||||
|
{
|
||||||
|
if (mList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount()
|
||||||
|
{
|
||||||
|
return mList != null ? mList.size() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position)
|
||||||
|
{
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position)
|
||||||
|
{
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
|
{
|
||||||
|
View view;
|
||||||
|
if (convertView == null) {
|
||||||
|
view = mInflater.inflate(
|
||||||
|
android.R.layout.simple_list_item_1, parent, false);
|
||||||
|
} else {
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
bindView(view, mList.get(position));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void bindView(View view, ApplicationInfo info)
|
||||||
|
{
|
||||||
|
TextView text = (TextView)view.findViewById(android.R.id.text1);
|
||||||
|
|
||||||
|
text.setText(info != null ? info.packageName : "(none)");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final Context mContext;
|
||||||
|
protected final LayoutInflater mInflater;
|
||||||
|
|
||||||
|
protected List<ApplicationInfo> mList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static Comparator sDisplayNameComparator = new Comparator() {
|
||||||
|
public final int
|
||||||
|
compare(Object a, Object b)
|
||||||
|
{
|
||||||
|
CharSequence sa = ((ApplicationInfo) a).packageName;
|
||||||
|
CharSequence sb = ((ApplicationInfo) b).packageName;
|
||||||
|
|
||||||
|
return collator.compare(sa, sb);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Collator collator = Collator.getInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
private AppListAdapter mAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class ArrayAdapter<E> extends BaseAdapter
|
||||||
|
{
|
||||||
|
public ArrayAdapter(Context context, int layoutRes) {
|
||||||
|
mContext = context;
|
||||||
|
mInflater = (LayoutInflater)context.getSystemService(
|
||||||
|
Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
mLayoutRes = layoutRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(List<E> list) {
|
||||||
|
mList = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void bindView(View view, E item);
|
||||||
|
|
||||||
|
public E itemForPosition(int position) {
|
||||||
|
if (mList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return mList != null ? mList.size() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
View view;
|
||||||
|
if (convertView == null) {
|
||||||
|
view = mInflater.inflate(mLayoutRes, parent, false);
|
||||||
|
} else {
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
bindView(view, mList.get(position));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Context mContext;
|
||||||
|
private final LayoutInflater mInflater;
|
||||||
|
private final int mLayoutRes;
|
||||||
|
private List<E> mList;
|
||||||
|
}
|
||||||
|
|
||||||
31
apps/Development/src/com/android/development/ColumnData.java
Normal file
31
apps/Development/src/com/android/development/ColumnData.java
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/* //device/apps/Notes/NotesList.java
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
class ColumnData
|
||||||
|
{
|
||||||
|
ColumnData(String k, String v)
|
||||||
|
{
|
||||||
|
key = k;
|
||||||
|
value = v;
|
||||||
|
}
|
||||||
|
public String key;
|
||||||
|
public String value;
|
||||||
|
}
|
||||||
|
|
||||||
134
apps/Development/src/com/android/development/DataList.java
Normal file
134
apps/Development/src/com/android/development/DataList.java
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/* //device/apps/Notes/NotesList.java
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.SimpleCursorAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class DataList extends ListActivity
|
||||||
|
{
|
||||||
|
public void onCreate(Bundle icicle)
|
||||||
|
{
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
|
||||||
|
mCursor = getContentResolver().query(intent.getData(), null, null, null, null);
|
||||||
|
mDisplay = intent.getStringExtra("display");
|
||||||
|
if (mDisplay == null) {
|
||||||
|
mDisplay = "_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mCursor != null) {
|
||||||
|
setListAdapter(new SimpleCursorAdapter(
|
||||||
|
this,
|
||||||
|
R.layout.url_list,
|
||||||
|
mCursor,
|
||||||
|
new String[] {mDisplay},
|
||||||
|
new int[] {android.R.id.text1}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onStop()
|
||||||
|
{
|
||||||
|
super.onStop();
|
||||||
|
|
||||||
|
if (mCursor != null) {
|
||||||
|
mCursor.deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResume()
|
||||||
|
{
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (mCursor != null) {
|
||||||
|
mCursor.requery();
|
||||||
|
}
|
||||||
|
|
||||||
|
setTitle("Showing " + mDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
|
menu.add(0, 0, 0, "Requery").setOnMenuItemClickListener(mRequery);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id)
|
||||||
|
{
|
||||||
|
mCursor.moveToPosition(position);
|
||||||
|
|
||||||
|
ArrayList<ColumnData> data = new ArrayList<ColumnData>();
|
||||||
|
|
||||||
|
String[] columnNames = mCursor.getColumnNames();
|
||||||
|
for (int i=0; i<columnNames.length; i++) {
|
||||||
|
String str = mCursor.getString(i);
|
||||||
|
ColumnData cd = new ColumnData(columnNames[i], str);
|
||||||
|
data.add(cd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Uri uri = null;
|
||||||
|
int idCol = mCursor.getColumnIndex("_id");
|
||||||
|
if (idCol >= 0) {
|
||||||
|
uri = Uri.withAppendedPath(getIntent().getData(), mCursor.getString(idCol));
|
||||||
|
}
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
intent.setClass(this, Details.class);
|
||||||
|
|
||||||
|
intent.putExtra("data", data);
|
||||||
|
int displayColumn = mCursor.getColumnIndex(mDisplay);
|
||||||
|
if (displayColumn >= 0) {
|
||||||
|
intent.putExtra("title",
|
||||||
|
((ColumnData)data.get(displayColumn)).value);
|
||||||
|
}
|
||||||
|
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem.OnMenuItemClickListener mRequery = new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
// Should just do requery on cursor, but
|
||||||
|
// doesn't work right now. So do this instead.
|
||||||
|
mCursor.requery();
|
||||||
|
if (mCursor != null) {
|
||||||
|
setListAdapter(new SimpleCursorAdapter(
|
||||||
|
DataList.this,
|
||||||
|
R.layout.url_list,
|
||||||
|
mCursor,
|
||||||
|
new String[] {mDisplay},
|
||||||
|
new int[] {android.R.id.text1}));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private String mDisplay;
|
||||||
|
private Cursor mCursor;
|
||||||
|
}
|
||||||
157
apps/Development/src/com/android/development/Details.java
Normal file
157
apps/Development/src/com/android/development/Details.java
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
/* //device/apps/Notes/NotesList.java
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ScrollView;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class Details extends Activity
|
||||||
|
{
|
||||||
|
public void onCreate(Bundle icicle)
|
||||||
|
{
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
|
||||||
|
String title = intent.getStringExtra("title");
|
||||||
|
if (title == null) {
|
||||||
|
title = "Details";
|
||||||
|
}
|
||||||
|
setTitle(title);
|
||||||
|
|
||||||
|
mScrollView = new ScrollView(this);
|
||||||
|
setContentView(mScrollView);
|
||||||
|
mScrollView.setFocusable(true);
|
||||||
|
|
||||||
|
mData = (ArrayList<ColumnData>)getIntent().getExtra("data");
|
||||||
|
addDataViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResume()
|
||||||
|
{
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
|
menu.add(0, 0, 0, "Requery").setOnMenuItemClickListener(mRequery);
|
||||||
|
menu.add(0, 0, 0, "Print to stdout").setOnMenuItemClickListener(mPrintToStdout);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addDataViews()
|
||||||
|
{
|
||||||
|
int oldScroll = 0;
|
||||||
|
|
||||||
|
if (mLinearLayout != null) {
|
||||||
|
mScrollView.removeView(mLinearLayout);
|
||||||
|
}
|
||||||
|
mLinearLayout = new LinearLayout(this);
|
||||||
|
mScrollView.addView(mLinearLayout, new ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.FILL_PARENT,
|
||||||
|
ViewGroup.LayoutParams.FILL_PARENT));
|
||||||
|
mLinearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
|
||||||
|
// Here in onStart, we're given data. We use that because some
|
||||||
|
// data that we show is transient and can't be retrieved from a url.
|
||||||
|
// We'll try to use that in requery
|
||||||
|
int count = mData.size();
|
||||||
|
for (int i=0; i<count; i++) {
|
||||||
|
ColumnData cd = mData.get(i);
|
||||||
|
TextView label = makeView(cd.key, true, 12);
|
||||||
|
TextView contents = makeView(cd.value, false, 12);
|
||||||
|
contents.setPadding(3, 0, 0, i==count-1?0:3);
|
||||||
|
mLinearLayout.addView(label, lazy());
|
||||||
|
mLinearLayout.addView(contents, lazy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView makeView(String str, boolean bold, int fontSize)
|
||||||
|
{
|
||||||
|
if (str == null) {
|
||||||
|
str = "(null)";
|
||||||
|
}
|
||||||
|
TextView v = new TextView(this);
|
||||||
|
v.setText(str);
|
||||||
|
v.setTextSize(fontSize);
|
||||||
|
if (bold) {
|
||||||
|
v.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams lazy()
|
||||||
|
{
|
||||||
|
return new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem.OnMenuItemClickListener mRequery = new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
Intent intent = getIntent();
|
||||||
|
Cursor c = getContentResolver().query(intent.getData(), null, null, null, null);
|
||||||
|
if (c != null && c.moveToNext()) {
|
||||||
|
mData.clear();
|
||||||
|
String[] columnNames = c.getColumnNames();
|
||||||
|
for (int i=0; i<columnNames.length; i++) {
|
||||||
|
String str = c.getString(i);
|
||||||
|
ColumnData cd = new ColumnData(columnNames[i], str);
|
||||||
|
mData.add(cd);
|
||||||
|
}
|
||||||
|
addDataViews();
|
||||||
|
} else {
|
||||||
|
TextView error = new TextView(Details.this);
|
||||||
|
error.setText("Showing old data.\nURL couldn't be requeried:\n"
|
||||||
|
+ intent.getData());
|
||||||
|
error.setTextColor(0xffff0000);
|
||||||
|
error.setTextSize(11);
|
||||||
|
mLinearLayout.addView(error, 0, lazy());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MenuItem.OnMenuItemClickListener mPrintToStdout = new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
System.out.println("=== begin data ===");
|
||||||
|
int count = mData.size();
|
||||||
|
for (int i=0; i<count; i++) {
|
||||||
|
ColumnData cd = mData.get(i);
|
||||||
|
System.out.println(" " + cd.key + ": " + cd.value);
|
||||||
|
}
|
||||||
|
System.out.println("=== end data ===");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LinearLayout mLinearLayout;
|
||||||
|
ScrollView mScrollView;
|
||||||
|
ArrayList<ColumnData> mData;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.app.LauncherActivity;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
public class Development extends LauncherActivity
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected Intent getTargetIntent() {
|
||||||
|
Intent targetIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||||
|
targetIntent.addCategory(Intent.CATEGORY_TEST);
|
||||||
|
targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
return targetIntent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,510 @@
|
|||||||
|
/* //device/apps/Settings/src/com/android/settings/Keyguard.java
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.ActivityManagerNative;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.ServiceManager;
|
||||||
|
import android.os.ServiceManagerNative;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.IWindowManager;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.AdapterView.OnItemSelectedListener;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DevelopmentSettings extends Activity {
|
||||||
|
private static final String TAG = "DevelopmentSettings";
|
||||||
|
private static final int DEBUG_APP_REQUEST = 1;
|
||||||
|
|
||||||
|
private Button mDebugAppButton;
|
||||||
|
private CheckBox mWaitForDebuggerCB;
|
||||||
|
private CheckBox mAlwaysFinishCB;
|
||||||
|
private CheckBox mShowLoadCB;
|
||||||
|
private CheckBox mShowCpuCB;
|
||||||
|
private CheckBox mEnableGLCB;
|
||||||
|
private CheckBox mShowUpdatesCB;
|
||||||
|
private CheckBox mShowBackgroundCB;
|
||||||
|
private CheckBox mShowSleepCB;
|
||||||
|
private CheckBox mShowMapsCompassCB;
|
||||||
|
private CheckBox mShowXmppCB;
|
||||||
|
private Spinner mMaxProcsSpinner;
|
||||||
|
private Spinner mWindowAnimationScaleSpinner;
|
||||||
|
private Spinner mTransitionAnimationScaleSpinner;
|
||||||
|
private Spinner mFontHintingSpinner;
|
||||||
|
|
||||||
|
private String mDebugApp;
|
||||||
|
private boolean mWaitForDebugger;
|
||||||
|
private boolean mAlwaysFinish;
|
||||||
|
private int mProcessLimit;
|
||||||
|
private boolean mShowSleep;
|
||||||
|
private boolean mShowMapsCompass;
|
||||||
|
private boolean mShowXmpp;
|
||||||
|
private AnimationScaleSelectedListener mWindowAnimationScale
|
||||||
|
= new AnimationScaleSelectedListener(0);
|
||||||
|
private AnimationScaleSelectedListener mTransitionAnimationScale
|
||||||
|
= new AnimationScaleSelectedListener(1);
|
||||||
|
private SharedPreferences mSharedPrefs;
|
||||||
|
private IWindowManager mWindowManager;
|
||||||
|
|
||||||
|
private static final boolean FONT_HINTING_ENABLED = true;
|
||||||
|
private static final String FONT_HINTING_FILE = "/data/misc/font-hack";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
setContentView(R.layout.development_settings);
|
||||||
|
|
||||||
|
mDebugAppButton = (Button)findViewById(R.id.debug_app);
|
||||||
|
mDebugAppButton.setOnClickListener(mDebugAppClicked);
|
||||||
|
mWaitForDebuggerCB = (CheckBox)findViewById(R.id.wait_for_debugger);
|
||||||
|
mWaitForDebuggerCB.setOnClickListener(mWaitForDebuggerClicked);
|
||||||
|
mAlwaysFinishCB = (CheckBox)findViewById(R.id.always_finish);
|
||||||
|
mAlwaysFinishCB.setOnClickListener(mAlwaysFinishClicked);
|
||||||
|
mShowLoadCB = (CheckBox)findViewById(R.id.show_load);
|
||||||
|
mShowLoadCB.setOnClickListener(mShowLoadClicked);
|
||||||
|
mShowCpuCB = (CheckBox)findViewById(R.id.show_cpu);
|
||||||
|
mShowCpuCB.setOnCheckedChangeListener(new SurfaceFlingerClicker(1000));
|
||||||
|
mEnableGLCB = (CheckBox)findViewById(R.id.enable_gl);
|
||||||
|
mEnableGLCB.getLayoutParams().height = 0; // doesn't do anything
|
||||||
|
mEnableGLCB.setOnCheckedChangeListener(new SurfaceFlingerClicker(1004));
|
||||||
|
mShowUpdatesCB = (CheckBox)findViewById(R.id.show_updates);
|
||||||
|
mShowUpdatesCB.setOnCheckedChangeListener(new SurfaceFlingerClicker(1002));
|
||||||
|
mShowBackgroundCB = (CheckBox)findViewById(R.id.show_background);
|
||||||
|
mShowBackgroundCB.setOnCheckedChangeListener(new SurfaceFlingerClicker(1003));
|
||||||
|
mShowSleepCB = (CheckBox)findViewById(R.id.show_sleep);
|
||||||
|
mShowSleepCB.setOnClickListener(mShowSleepClicked);
|
||||||
|
mShowMapsCompassCB = (CheckBox)findViewById(R.id.show_maps_compass);
|
||||||
|
mShowMapsCompassCB.setOnClickListener(mShowMapsCompassClicked);
|
||||||
|
mShowXmppCB = (CheckBox)findViewById(R.id.show_xmpp);
|
||||||
|
mShowXmppCB.setOnClickListener(mShowXmppClicked);
|
||||||
|
mMaxProcsSpinner = (Spinner)findViewById(R.id.max_procs);
|
||||||
|
mMaxProcsSpinner.setOnItemSelectedListener(mMaxProcsChanged);
|
||||||
|
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
|
||||||
|
this,
|
||||||
|
android.R.layout.simple_spinner_item,
|
||||||
|
new String[] {
|
||||||
|
"No App Process Limit",
|
||||||
|
"Max 1 App Process",
|
||||||
|
"Max 2 App Processes",
|
||||||
|
"Max 3 App Processes",
|
||||||
|
"Max 4 App Processes" });
|
||||||
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
mMaxProcsSpinner.setAdapter(adapter);
|
||||||
|
mWindowAnimationScaleSpinner = setupAnimationSpinner(
|
||||||
|
R.id.window_animation_scale, mWindowAnimationScale, "Window");
|
||||||
|
mTransitionAnimationScaleSpinner = setupAnimationSpinner(
|
||||||
|
R.id.transition_animation_scale, mTransitionAnimationScale, "Transition");
|
||||||
|
|
||||||
|
if (FONT_HINTING_ENABLED) {
|
||||||
|
mFontHintingSpinner = (Spinner)findViewById(R.id.font_hinting);
|
||||||
|
mFontHintingSpinner.setOnItemSelectedListener(mFontHintingChanged);
|
||||||
|
adapter = new ArrayAdapter<String>(
|
||||||
|
this,
|
||||||
|
android.R.layout.simple_spinner_item,
|
||||||
|
new String[] {
|
||||||
|
"Light Hinting",
|
||||||
|
"Medium Hinting" });
|
||||||
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
mFontHintingSpinner.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
mSharedPrefs = getSharedPreferences("global", 0);
|
||||||
|
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Spinner setupAnimationSpinner(int resid,
|
||||||
|
AnimationScaleSelectedListener listener, String name) {
|
||||||
|
Spinner spinner = (Spinner)findViewById(resid);
|
||||||
|
spinner.setOnItemSelectedListener(listener);
|
||||||
|
ArrayAdapter adapter = new ArrayAdapter<String>(
|
||||||
|
this,
|
||||||
|
android.R.layout.simple_spinner_item,
|
||||||
|
new String[] {
|
||||||
|
name + " Animation Scale 1x",
|
||||||
|
name + " Animation Scale 2x",
|
||||||
|
name + " Animation Scale 5x",
|
||||||
|
name + " Animation Scale 10x",
|
||||||
|
name + " Animation Off" });
|
||||||
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
spinner.setAdapter(adapter);
|
||||||
|
listener.spinner = spinner;
|
||||||
|
return spinner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
updateDebugOptions();
|
||||||
|
updateFinishOptions();
|
||||||
|
updateProcessLimitOptions();
|
||||||
|
updateSharedOptions();
|
||||||
|
updateFlingerOptions();
|
||||||
|
updateSleepOptions();
|
||||||
|
updateMapsCompassOptions();
|
||||||
|
updateXmppOptions();
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileInputStream in = new FileInputStream( FONT_HINTING_FILE );
|
||||||
|
int mode = in.read() - 48;
|
||||||
|
if (mode >= 0 && mode < 3)
|
||||||
|
mFontHintingSpinner.setSelection(mode);
|
||||||
|
in.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
mWindowAnimationScale.load();
|
||||||
|
mTransitionAnimationScale.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeDebugOptions() {
|
||||||
|
try {
|
||||||
|
ActivityManagerNative.getDefault().setDebugApp(
|
||||||
|
mDebugApp, mWaitForDebugger, true);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDebugOptions() {
|
||||||
|
mDebugApp = Settings.System.getString(
|
||||||
|
getContentResolver(), Settings.System.DEBUG_APP);
|
||||||
|
mWaitForDebugger = Settings.System.getInt(
|
||||||
|
getContentResolver(), Settings.System.WAIT_FOR_DEBUGGER, 0) != 0;
|
||||||
|
|
||||||
|
mDebugAppButton.setText(
|
||||||
|
mDebugApp == null || mDebugApp.length() == 0 ? "(none)" : mDebugApp);
|
||||||
|
mWaitForDebuggerCB.setChecked(mWaitForDebugger);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeFinishOptions() {
|
||||||
|
try {
|
||||||
|
ActivityManagerNative.getDefault().setAlwaysFinish(mAlwaysFinish);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFinishOptions() {
|
||||||
|
mAlwaysFinish = Settings.System.getInt(
|
||||||
|
getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0) != 0;
|
||||||
|
mAlwaysFinishCB.setChecked(mAlwaysFinish);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeProcessLimitOptions() {
|
||||||
|
try {
|
||||||
|
ActivityManagerNative.getDefault().setProcessLimit(mProcessLimit);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateProcessLimitOptions() {
|
||||||
|
try {
|
||||||
|
mProcessLimit = ActivityManagerNative.getDefault().getProcessLimit();
|
||||||
|
mMaxProcsSpinner.setSelection(mProcessLimit);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSharedOptions() {
|
||||||
|
mShowLoadCB.setChecked(Settings.System.getInt(getContentResolver(),
|
||||||
|
Settings.System.SHOW_PROCESSES, 0) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFlingerOptions() {
|
||||||
|
// magic communication with surface flinger.
|
||||||
|
try {
|
||||||
|
IBinder flinger = ServiceManager.getService("SurfaceFlinger");
|
||||||
|
if (flinger != null) {
|
||||||
|
Parcel data = Parcel.obtain();
|
||||||
|
Parcel reply = Parcel.obtain();
|
||||||
|
data.writeInterfaceToken("android.ui.ISurfaceComposer");
|
||||||
|
flinger.transact(1010, data, reply, 0);
|
||||||
|
int v;
|
||||||
|
v = reply.readInt();
|
||||||
|
mShowCpuCB.setChecked(v != 0);
|
||||||
|
v = reply.readInt();
|
||||||
|
mEnableGLCB.setChecked(v != 0);
|
||||||
|
v = reply.readInt();
|
||||||
|
mShowUpdatesCB.setChecked(v != 0);
|
||||||
|
v = reply.readInt();
|
||||||
|
mShowBackgroundCB.setChecked(v != 0);
|
||||||
|
reply.recycle();
|
||||||
|
data.recycle();
|
||||||
|
}
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeSleepOptions() {
|
||||||
|
try {
|
||||||
|
FileOutputStream os = new FileOutputStream(
|
||||||
|
"/sys/devices/platform/gpio_sleep_debug/enable", true);
|
||||||
|
if(mShowSleep)
|
||||||
|
os.write(new byte[] { (byte)'1' });
|
||||||
|
else
|
||||||
|
os.write(new byte[] { (byte)'0' });
|
||||||
|
os.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Failed setting gpio_sleep_debug");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSleepOptions() {
|
||||||
|
try {
|
||||||
|
FileInputStream is = new FileInputStream(
|
||||||
|
"/sys/devices/platform/gpio_sleep_debug/enable");
|
||||||
|
int character = is.read();
|
||||||
|
mShowSleep = character == '1';
|
||||||
|
is.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Failed reading gpio_sleep_debug");
|
||||||
|
mShowSleep = false;
|
||||||
|
}
|
||||||
|
mShowSleepCB.setChecked(mShowSleep);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeMapsCompassOptions() {
|
||||||
|
try {
|
||||||
|
Context c = createPackageContext("com.google.android.apps.maps", 0);
|
||||||
|
c.getSharedPreferences("extra-features", MODE_WORLD_WRITEABLE)
|
||||||
|
.edit()
|
||||||
|
.putBoolean("compass", mShowMapsCompass)
|
||||||
|
.commit();
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
Log.w(TAG, "Failed setting maps compass");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateMapsCompassOptions() {
|
||||||
|
try {
|
||||||
|
Context c = createPackageContext("com.google.android.apps.maps", 0);
|
||||||
|
mShowMapsCompass = c.getSharedPreferences("extra-features", MODE_WORLD_READABLE)
|
||||||
|
.getBoolean("compass", false);
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
Log.w(TAG, "Failed reading maps compass");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
mShowMapsCompassCB.setChecked(mShowMapsCompass);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeXmppOptions() {
|
||||||
|
Settings.System.setShowGTalkServiceStatus(getContentResolver(), mShowXmpp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateXmppOptions() {
|
||||||
|
mShowXmpp = Settings.System.getShowGTalkServiceStatus(getContentResolver());
|
||||||
|
mShowXmppCB.setChecked(mShowXmpp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener mDebugAppClicked = new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
intent.setClass(DevelopmentSettings.this, AppPicker.class);
|
||||||
|
startActivityForResult(intent, DEBUG_APP_REQUEST);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
|
if (requestCode == DEBUG_APP_REQUEST && resultCode == RESULT_OK) {
|
||||||
|
mDebugApp = intent.getAction();
|
||||||
|
writeDebugOptions();
|
||||||
|
updateDebugOptions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener mWaitForDebuggerClicked =
|
||||||
|
new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mWaitForDebugger = ((CheckBox)v).isChecked();
|
||||||
|
writeDebugOptions();
|
||||||
|
updateDebugOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private View.OnClickListener mAlwaysFinishClicked =
|
||||||
|
new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mAlwaysFinish = ((CheckBox)v).isChecked();
|
||||||
|
writeFinishOptions();
|
||||||
|
updateFinishOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private View.OnClickListener mShowLoadClicked = new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
boolean value = ((CheckBox)v).isChecked();
|
||||||
|
Settings.System.putInt(getContentResolver(),
|
||||||
|
Settings.System.SHOW_PROCESSES, value ? 1 : 0);
|
||||||
|
Intent service = (new Intent())
|
||||||
|
.setClassName("android", "com.android.server.LoadAverageService");
|
||||||
|
if (value) {
|
||||||
|
startService(service);
|
||||||
|
} else {
|
||||||
|
stopService(service);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private class SurfaceFlingerClicker implements CheckBox.OnCheckedChangeListener {
|
||||||
|
SurfaceFlingerClicker(int code) {
|
||||||
|
mCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
try {
|
||||||
|
IBinder flinger = ServiceManager.getService("SurfaceFlinger");
|
||||||
|
if (flinger != null) {
|
||||||
|
Parcel data = Parcel.obtain();
|
||||||
|
data.writeInterfaceToken("android.ui.ISurfaceComposer");
|
||||||
|
data.writeInt(isChecked ? 1 : 0);
|
||||||
|
flinger.transact(mCode, data, null, 0);
|
||||||
|
data.recycle();
|
||||||
|
|
||||||
|
updateFlingerOptions();
|
||||||
|
}
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final int mCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener mShowSleepClicked =
|
||||||
|
new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mShowSleep = ((CheckBox)v).isChecked();
|
||||||
|
writeSleepOptions();
|
||||||
|
updateSleepOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private View.OnClickListener mShowMapsCompassClicked =
|
||||||
|
new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mShowMapsCompass = ((CheckBox)v).isChecked();
|
||||||
|
writeMapsCompassOptions();
|
||||||
|
updateMapsCompassOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private View.OnClickListener mShowXmppClicked = new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mShowXmpp = ((CheckBox)v).isChecked();
|
||||||
|
// can streamline these calls, but keeping consistent with the
|
||||||
|
// other development settings code.
|
||||||
|
writeXmppOptions();
|
||||||
|
updateXmppOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private Spinner.OnItemSelectedListener mMaxProcsChanged
|
||||||
|
= new Spinner.OnItemSelectedListener() {
|
||||||
|
public void onItemSelected(android.widget.AdapterView av, View v,
|
||||||
|
int position, long id) {
|
||||||
|
mProcessLimit = position;
|
||||||
|
writeProcessLimitOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onNothingSelected(android.widget.AdapterView av) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private Spinner.OnItemSelectedListener mFontHintingChanged
|
||||||
|
= new Spinner.OnItemSelectedListener() {
|
||||||
|
public void onItemSelected(android.widget.AdapterView av, View v,
|
||||||
|
int position, long id) {
|
||||||
|
try {
|
||||||
|
FileOutputStream out = new FileOutputStream( FONT_HINTING_FILE );
|
||||||
|
out.write(position+48);
|
||||||
|
out.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Failed to write font hinting settings to /data/misc/font-hack");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onNothingSelected(android.widget.AdapterView av) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class AnimationScaleSelectedListener implements OnItemSelectedListener {
|
||||||
|
final int which;
|
||||||
|
float scale;
|
||||||
|
Spinner spinner;
|
||||||
|
|
||||||
|
AnimationScaleSelectedListener(int _which) {
|
||||||
|
which = _which;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load() {
|
||||||
|
try {
|
||||||
|
scale = mWindowManager.getAnimationScale(which);
|
||||||
|
|
||||||
|
if (scale > 0.1f && scale < 2.0f) {
|
||||||
|
spinner.setSelection(0);
|
||||||
|
} else if (scale >= 2.0f && scale < 3.0f) {
|
||||||
|
spinner.setSelection(1);
|
||||||
|
} else if (scale >= 4.9f && scale < 6.0f) {
|
||||||
|
spinner.setSelection(2);
|
||||||
|
} else if (scale >= 9.9f && scale < 11.0f) {
|
||||||
|
spinner.setSelection(3);
|
||||||
|
} else {
|
||||||
|
spinner.setSelection(4);
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onItemSelected(android.widget.AdapterView av, View v,
|
||||||
|
int position, long id) {
|
||||||
|
switch (position) {
|
||||||
|
case 0: scale = 1.0f; break;
|
||||||
|
case 1: scale = 2.0f; break;
|
||||||
|
case 2: scale = 5.0f; break;
|
||||||
|
case 3: scale = 10.0f; break;
|
||||||
|
case 4: scale = 0.0f; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mWindowManager.setAnimationScale(which, scale);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onNothingSelected(android.widget.AdapterView av) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
310
apps/Development/src/com/android/development/EnterURL.java
Normal file
310
apps/Development/src/com/android/development/EnterURL.java
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
/* //device/apps/Notes/NotesList.java
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.Selection;
|
||||||
|
import android.text.format.DateUtils;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.SimpleAdapter;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class EnterURL extends ListActivity
|
||||||
|
{
|
||||||
|
private static final int DATABASE_VERSION = 1;
|
||||||
|
public static class UrlEditText extends EditText
|
||||||
|
{
|
||||||
|
public UrlEditText(Context context, AttributeSet attrs)
|
||||||
|
{
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)
|
||||||
|
{
|
||||||
|
super.onFocusChanged(focused, direction, previouslyFocusedRect);
|
||||||
|
if (focused) {
|
||||||
|
Editable text = getText();
|
||||||
|
String str = text.toString();
|
||||||
|
int highlightStart = 0;
|
||||||
|
if (str.startsWith("content://")) {
|
||||||
|
highlightStart = "content://".length();
|
||||||
|
}
|
||||||
|
Selection.setSelection(text, highlightStart, text.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DisplayEditText extends EditText
|
||||||
|
{
|
||||||
|
public DisplayEditText(Context context, AttributeSet attrs)
|
||||||
|
{
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)
|
||||||
|
{
|
||||||
|
super.onFocusChanged(focused, direction, previouslyFocusedRect);
|
||||||
|
if (focused) {
|
||||||
|
Editable text = getText();
|
||||||
|
Selection.setSelection(text, 0, text.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(String name, Context context, AttributeSet attrs)
|
||||||
|
{
|
||||||
|
if (name.equals("com.android.development.UrlEditText")) {
|
||||||
|
return new UrlEditText(this, attrs);
|
||||||
|
}
|
||||||
|
if (name.equals("com.android.development.DisplayEditText")) {
|
||||||
|
return new DisplayEditText(this, attrs);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
View.OnClickListener mViewItemAction = new View.OnClickListener () {
|
||||||
|
public void onClick(View v)
|
||||||
|
{
|
||||||
|
String url = mUrlField.getText().toString();
|
||||||
|
String display = mDisplayField.getText().toString();
|
||||||
|
viewItem(url, display);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public void onCreate(Bundle icicle)
|
||||||
|
{
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(R.layout.enter_url);
|
||||||
|
|
||||||
|
// display
|
||||||
|
mDisplayField = (DisplayEditText)findViewById(R.id.display_edit_text);
|
||||||
|
mDisplayField.setOnClickListener(mViewItemAction);
|
||||||
|
// url
|
||||||
|
mUrlField = (UrlEditText)findViewById(R.id.url_edit_text);
|
||||||
|
mUrlField.setOnClickListener(mViewItemAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onStop()
|
||||||
|
{
|
||||||
|
super.onStop();
|
||||||
|
|
||||||
|
if (mCursor != null) {
|
||||||
|
mCursor.deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResume()
|
||||||
|
{
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
// show the history
|
||||||
|
loadPrefs();
|
||||||
|
fillListView();
|
||||||
|
if (mHistory.size() > 0) {
|
||||||
|
ListView lv = this.getListView();
|
||||||
|
lv.setSelection(0);
|
||||||
|
lv.requestFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
|
menu.add(0, 0, 0, "Clear Bookmarks").setOnMenuItemClickListener(mClearBookmarks);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id)
|
||||||
|
{
|
||||||
|
HistoryEntry he = mHistory.get(position);
|
||||||
|
viewItem(he.url, he.display);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void viewItem(String url, String display)
|
||||||
|
{
|
||||||
|
// -------------- save this in the history ----------------
|
||||||
|
// look in the history
|
||||||
|
int count = mHistory.size();
|
||||||
|
int i;
|
||||||
|
for (i=0; i<count; i++) {
|
||||||
|
HistoryEntry he = mHistory.get(i);
|
||||||
|
if (he.url.equals(url) && he.display.equals(display)) {
|
||||||
|
he.updateAccessTime();
|
||||||
|
mHistory.remove(i);
|
||||||
|
mHistory.add(0, he);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i >= count) {
|
||||||
|
// didn't find it, add it first
|
||||||
|
HistoryEntry he = new HistoryEntry();
|
||||||
|
he.url = url;
|
||||||
|
he.display = display;
|
||||||
|
he.updateAccessTime();
|
||||||
|
mHistory.add(0, he);
|
||||||
|
}
|
||||||
|
|
||||||
|
savePrefs();
|
||||||
|
|
||||||
|
// -------------- view it ---------------------------------
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
|
intent.setClass(this, DataList.class);
|
||||||
|
intent.putExtra("display", display);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem.OnMenuItemClickListener mClearBookmarks = new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
mHistory.clear();
|
||||||
|
savePrefs();
|
||||||
|
fillListView();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private void fillListView()
|
||||||
|
{
|
||||||
|
loadPrefs();
|
||||||
|
ArrayList<HashMap<String, String>> d = new ArrayList<HashMap<String, String>>();
|
||||||
|
int count = mHistory.size();
|
||||||
|
for (int i=0; i<count; i++) {
|
||||||
|
HashMap<String, String> m = new HashMap<String, String>();
|
||||||
|
HistoryEntry he = mHistory.get(i);
|
||||||
|
m.put("title", he.url + " (" + he.display + ")");
|
||||||
|
d.add(m);
|
||||||
|
}
|
||||||
|
setListAdapter(new SimpleAdapter(this, d, R.layout.url_list,
|
||||||
|
new String[] {"title"},
|
||||||
|
new int[] {android.R.id.text1}));
|
||||||
|
}
|
||||||
|
|
||||||
|
SQLiteDatabase openDB()
|
||||||
|
{
|
||||||
|
SQLiteDatabase db = null;
|
||||||
|
db = openOrCreateDatabase("inspector.db", 0, null);
|
||||||
|
int version = db.getVersion();
|
||||||
|
if (version != DATABASE_VERSION) {
|
||||||
|
db.execSQL("CREATE TABLE History ("
|
||||||
|
+ " url TEXT,"
|
||||||
|
+ " display TEXT,"
|
||||||
|
+ " lastAccessTime TEXT"
|
||||||
|
+ ");");
|
||||||
|
db.execSQL("CREATE TABLE FieldState ("
|
||||||
|
+ " url TEXT,"
|
||||||
|
+ " display TEXT"
|
||||||
|
+ ");");
|
||||||
|
db.setVersion(DATABASE_VERSION);
|
||||||
|
}
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadPrefs()
|
||||||
|
{
|
||||||
|
SQLiteDatabase db = openDB();
|
||||||
|
Cursor c = db.query("History",
|
||||||
|
new String[] { "url", "display", "lastAccessTime" },
|
||||||
|
null, null, null, null, "lastAccessTime DESC");
|
||||||
|
int urlCol = c.getColumnIndex("url");
|
||||||
|
int accessCol = c.getColumnIndex("lastAccessTime");
|
||||||
|
int displayCol = c.getColumnIndex("display");
|
||||||
|
mHistory.clear();
|
||||||
|
while (c.moveToNext()) {
|
||||||
|
HistoryEntry he = new HistoryEntry();
|
||||||
|
he.url = c.getString(urlCol);
|
||||||
|
he.display = c.getString(displayCol);
|
||||||
|
he.lastAccessTime = c.getString(accessCol);
|
||||||
|
mHistory.add(he);
|
||||||
|
}
|
||||||
|
|
||||||
|
c = db.query("FieldState", null, null, null, null, null, null);
|
||||||
|
if (c.moveToNext()) {
|
||||||
|
urlCol = c.getColumnIndex("url");
|
||||||
|
displayCol = c.getColumnIndex("display");
|
||||||
|
mUrlField.setText(c.getString(urlCol));
|
||||||
|
mDisplayField.setText(c.getString(displayCol));
|
||||||
|
} else {
|
||||||
|
mDisplayField.setText("_id");
|
||||||
|
mUrlField.setText("content://");
|
||||||
|
}
|
||||||
|
|
||||||
|
db.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void savePrefs()
|
||||||
|
{
|
||||||
|
ContentValues m;
|
||||||
|
HistoryEntry he;
|
||||||
|
|
||||||
|
SQLiteDatabase db = openDB();
|
||||||
|
db.execSQL("DELETE FROM History;");
|
||||||
|
int count = mHistory.size();
|
||||||
|
for (int i=0; i<count; i++) {
|
||||||
|
m = new ContentValues();
|
||||||
|
he = mHistory.get(i);
|
||||||
|
m.put("url", he.url);
|
||||||
|
m.put("display", he.display);
|
||||||
|
m.put("lastAccessTime", he.lastAccessTime);
|
||||||
|
db.insert("History", null, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
db.execSQL("DELETE FROM FieldState");
|
||||||
|
m = new ContentValues();
|
||||||
|
m.put("url", mUrlField.getText().toString());
|
||||||
|
m.put("display", mDisplayField.getText().toString());
|
||||||
|
db.insert("FieldState", null, m);
|
||||||
|
|
||||||
|
db.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class HistoryEntry
|
||||||
|
{
|
||||||
|
public String url;
|
||||||
|
public String display;
|
||||||
|
public String lastAccessTime;
|
||||||
|
public void updateAccessTime()
|
||||||
|
{
|
||||||
|
this.lastAccessTime = DateUtils.writeDateTime(
|
||||||
|
new GregorianCalendar());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<HistoryEntry> mHistory = new ArrayList<HistoryEntry>();
|
||||||
|
private UrlEditText mUrlField;
|
||||||
|
private DisplayEditText mDisplayField;
|
||||||
|
private Cursor mCursor;
|
||||||
|
}
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 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.android.development;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.ContentObserver;
|
||||||
|
import android.database.DataSetObserver;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.os.ServiceManager;
|
||||||
|
import android.provider.Checkin;
|
||||||
|
import android.server.data.CrashData;
|
||||||
|
import android.server.data.ThrowableData;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.widget.*;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExceptionBrowser extends ListActivity {
|
||||||
|
/** Logging identifier. */
|
||||||
|
private static final String TAG = "ExceptionBrowser";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
Cursor cursor = getContentResolver().query(
|
||||||
|
Checkin.Crashes.CONTENT_URI,
|
||||||
|
new String[] { Checkin.Crashes._ID, Checkin.Crashes.DATA },
|
||||||
|
null, null, null);
|
||||||
|
|
||||||
|
if (cursor != null) {
|
||||||
|
startManagingCursor(cursor);
|
||||||
|
|
||||||
|
setListAdapter(new CursorAdapter(this, cursor, true) {
|
||||||
|
public View newView(Context context, Cursor c, ViewGroup v) {
|
||||||
|
return new CrashListItem(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindView(View view, Context c, Cursor cursor) {
|
||||||
|
CrashListItem item = (CrashListItem) view;
|
||||||
|
try {
|
||||||
|
String data = cursor.getString(1);
|
||||||
|
CrashData crash = new CrashData(
|
||||||
|
new DataInputStream(
|
||||||
|
new ByteArrayInputStream(
|
||||||
|
Base64.decodeBase64(data.getBytes()))));
|
||||||
|
|
||||||
|
ThrowableData exc = crash.getThrowableData();
|
||||||
|
item.setText(exc.getType() + ": " + exc.getMessage());
|
||||||
|
item.setCrashData(crash);
|
||||||
|
} catch (IOException e) {
|
||||||
|
item.setText("Invalid crash: " + e);
|
||||||
|
Log.e(TAG, "Invalid crash", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// No database, no exceptions, empty list.
|
||||||
|
setListAdapter(new BaseAdapter() {
|
||||||
|
public int getCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getView(int position, View convertView,
|
||||||
|
ViewGroup parent) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int UPLOAD_ID = Menu.FIRST;
|
||||||
|
private static final int CLEAR_ID = Menu.FIRST + 1;
|
||||||
|
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
|
|
||||||
|
menu.add(0, UPLOAD_ID, 0, R.string.menu_upload_exceptions);
|
||||||
|
menu.add(0, CLEAR_ID, 0, R.string.menu_clear_exceptions);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle all of the possible menu actions.
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case UPLOAD_ID:
|
||||||
|
sendBroadcast(new Intent(Checkin.TriggerIntent.ACTION));
|
||||||
|
break;
|
||||||
|
case CLEAR_ID:
|
||||||
|
getContentResolver().delete(
|
||||||
|
Checkin.Crashes.CONTENT_URI, null, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class CrashListItem extends TextView {
|
||||||
|
CrashData crashData = null;
|
||||||
|
|
||||||
|
public CrashListItem(Context context) {
|
||||||
|
super(context);
|
||||||
|
setTextSize(10);
|
||||||
|
setTypeface(Typeface.MONOSPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrashData getCrashData() {
|
||||||
|
return crashData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCrashData(CrashData crashData) {
|
||||||
|
this.crashData = crashData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onListItemClick(ListView l, View view, int pos, long id) {
|
||||||
|
// TODO: Use a generic VIEW action on the crash's content URI.
|
||||||
|
CrashData crash = ((CrashListItem) view).getCrashData();
|
||||||
|
if (crash != null) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setClass(this, StacktraceViewer.class);
|
||||||
|
intent.putExtra(
|
||||||
|
CrashData.class.getName(),
|
||||||
|
crash.getThrowableData().toString());
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
210
apps/Development/src/com/android/development/GLSTester.java
Normal file
210
apps/Development/src/com/android/development/GLSTester.java
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import com.google.android.googleapps.GoogleLoginCredentialsResult;
|
||||||
|
import com.google.android.googlelogin.GoogleLoginServiceConstants;
|
||||||
|
import com.google.android.googleapps.IGoogleLoginService;
|
||||||
|
import com.google.android.googleapps.LoginData;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.ServiceConnection;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Using a LogTextBox to display a scrollable text area
|
||||||
|
* to which text is appended.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GLSTester extends Activity {
|
||||||
|
|
||||||
|
private static final String TAG = "GLSTester";
|
||||||
|
|
||||||
|
private LogTextBox mText;
|
||||||
|
|
||||||
|
private IGoogleLoginService mGls = null;
|
||||||
|
private ServiceConnection mConnection = null;
|
||||||
|
|
||||||
|
CheckBox mDoNotify = null;
|
||||||
|
CheckBox mRunIntent = null;
|
||||||
|
Spinner mService = null;
|
||||||
|
EditText mUsernameEdit = null;
|
||||||
|
|
||||||
|
private class Listener implements View.OnClickListener {
|
||||||
|
public Listener() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (mGls == null) {
|
||||||
|
mText.append("mGls is null\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String service = (String) mService.getSelectedItem();
|
||||||
|
mText.append("service: " + service + "\n");
|
||||||
|
|
||||||
|
String account = mUsernameEdit.getText().toString();
|
||||||
|
if (account.length() == 0) {
|
||||||
|
account = null;
|
||||||
|
}
|
||||||
|
mText.append("account: " + account + "\n");
|
||||||
|
GoogleLoginCredentialsResult result =
|
||||||
|
mGls.blockingGetCredentials(account, service, mDoNotify.isChecked());
|
||||||
|
mText.append("result account: " + result.getAccount() + "\n");
|
||||||
|
mText.append("result string: " + result.getCredentialsString() + "\n");
|
||||||
|
Intent intent = result.getCredentialsIntent();
|
||||||
|
mText.append("result intent: " + intent + "\n");
|
||||||
|
|
||||||
|
if (intent != null && mRunIntent.isChecked()) {
|
||||||
|
startActivityForResult(intent, 0);
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
mText.append("caught exception " + e + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
mText.append("resultCode: " + resultCode + "\n");
|
||||||
|
if (data != null) {
|
||||||
|
mText.append("account: " +
|
||||||
|
data.getStringExtra(GoogleLoginServiceConstants.AUTH_ACCOUNT_KEY) + "\n");
|
||||||
|
mText.append("authtoken: " +
|
||||||
|
data.getStringExtra(GoogleLoginServiceConstants.AUTHTOKEN_KEY) + "\n");
|
||||||
|
} else {
|
||||||
|
mText.append("intent is null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// Open a connection to the Google Login Service. Return the account.
|
||||||
|
mConnection = new ServiceConnection() {
|
||||||
|
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||||
|
mGls = IGoogleLoginService.Stub.asInterface(service);
|
||||||
|
}
|
||||||
|
public void onServiceDisconnected(ComponentName className) {
|
||||||
|
mGls = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
bindService(GoogleLoginServiceConstants.SERVICE_INTENT,
|
||||||
|
mConnection, Context.BIND_AUTO_CREATE);
|
||||||
|
|
||||||
|
setContentView(R.layout.gls_tester);
|
||||||
|
|
||||||
|
mText = (LogTextBox) findViewById(R.id.text);
|
||||||
|
mText.append("Hello, world!\n");
|
||||||
|
Log.v(TAG, "hello, world!");
|
||||||
|
|
||||||
|
mDoNotify = (CheckBox) findViewById(R.id.do_notification);
|
||||||
|
mRunIntent = (CheckBox) findViewById(R.id.run_intent);
|
||||||
|
mRunIntent.setChecked(true);
|
||||||
|
|
||||||
|
mService = (Spinner) findViewById(R.id.service_spinner);
|
||||||
|
|
||||||
|
mUsernameEdit = (EditText) findViewById(R.id.username_edit);
|
||||||
|
|
||||||
|
Button b;
|
||||||
|
b = (Button) findViewById(R.id.require_google);
|
||||||
|
b.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
try {
|
||||||
|
String account = mGls.getAccount(GoogleLoginServiceConstants.REQUIRE_GOOGLE);
|
||||||
|
mText.append("REQUIRE_GOOGLE gave: " + account + "\n");
|
||||||
|
mUsernameEdit.setText(account == null ? "" : account);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
mText.append("exception: " + e + "\n");
|
||||||
|
}
|
||||||
|
} });
|
||||||
|
|
||||||
|
b = (Button) findViewById(R.id.prefer_hosted);
|
||||||
|
b.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
try {
|
||||||
|
String account = mGls.getAccount(GoogleLoginServiceConstants.PREFER_HOSTED);
|
||||||
|
mText.append("PREFER_HOSTED gave: " + account + "\n");
|
||||||
|
mUsernameEdit.setText(account == null ? "" : account);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
mText.append("exception: " + e + "\n");
|
||||||
|
}
|
||||||
|
} });
|
||||||
|
|
||||||
|
|
||||||
|
b = (Button) findViewById(R.id.get_accounts);
|
||||||
|
b.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
try {
|
||||||
|
String[] accounts = mGls.getAccounts();
|
||||||
|
mText.append("account list: (" + accounts.length + " entries)\n");
|
||||||
|
for (String username: accounts) {
|
||||||
|
mText.append(" " + username + "\n");
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
mText.append("exception: " + e + "\n");
|
||||||
|
}
|
||||||
|
} });
|
||||||
|
|
||||||
|
b = (Button) findViewById(R.id.clear);
|
||||||
|
b.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mText.setText("");
|
||||||
|
} });
|
||||||
|
|
||||||
|
b = (Button) findViewById(R.id.go);
|
||||||
|
b.setOnClickListener(new Listener());
|
||||||
|
|
||||||
|
b = (Button) findViewById(R.id.wipe_passwords);
|
||||||
|
b.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mText.setText("wiping passwords:\n");
|
||||||
|
try {
|
||||||
|
String[] accounts = mGls.getAccounts();
|
||||||
|
LoginData ld = new LoginData();
|
||||||
|
for (String username: accounts) {
|
||||||
|
ld.mUsername = username;
|
||||||
|
mGls.updatePassword(ld);
|
||||||
|
mText.append(" " + username + "\n");
|
||||||
|
}
|
||||||
|
mText.append("done.\n");
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
mText.append("caught exception " + e + "\n");
|
||||||
|
}
|
||||||
|
} });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
unbindService(mConnection);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/* //device/samples/SampleCode/src/com/android/development/IRemoteService.aidl
|
||||||
|
**
|
||||||
|
** Copyright 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.android.development;
|
||||||
|
|
||||||
|
interface IRemoteService
|
||||||
|
{
|
||||||
|
int getPid();
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.app.ActivityManagerNative;
|
||||||
|
import android.app.IInstrumentationWatcher;
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.InstrumentationInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class InstrumentationAdapter extends BaseAdapter
|
||||||
|
{
|
||||||
|
private PackageManager mPM;
|
||||||
|
|
||||||
|
public InstrumentationAdapter(Context context, String targetPackage)
|
||||||
|
{
|
||||||
|
mContext = context;
|
||||||
|
mTargetPackage = targetPackage;
|
||||||
|
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
mPM = context.getPackageManager();
|
||||||
|
|
||||||
|
mList = context.getPackageManager().queryInstrumentation(mTargetPackage, 0);
|
||||||
|
if (mList != null) {
|
||||||
|
Collections.sort(mList, new InstrumentationInfo.DisplayNameComparator(mPM));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComponentName instrumentationForPosition(int position)
|
||||||
|
{
|
||||||
|
if (mList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
InstrumentationInfo ii = mList.get(position);
|
||||||
|
return new ComponentName(ii.packageName, ii.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount()
|
||||||
|
{
|
||||||
|
return mList != null ? mList.size() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position)
|
||||||
|
{
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position)
|
||||||
|
{
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
|
{
|
||||||
|
View view;
|
||||||
|
if (convertView == null) {
|
||||||
|
view = mInflater.inflate(
|
||||||
|
android.R.layout.simple_list_item_1, parent, false);
|
||||||
|
} else {
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
bindView(view, mList.get(position));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void bindView(View view, InstrumentationInfo info)
|
||||||
|
{
|
||||||
|
TextView text = (TextView)view.findViewById(android.R.id.text1);
|
||||||
|
CharSequence label = info.loadLabel(mPM);
|
||||||
|
text.setText(label != null ? label : info.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final Context mContext;
|
||||||
|
protected final String mTargetPackage;
|
||||||
|
protected final LayoutInflater mInflater;
|
||||||
|
|
||||||
|
protected List<InstrumentationInfo> mList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InstrumentationList extends ListActivity
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
mProfilingMode = icicle != null && icicle.containsKey("profiling");
|
||||||
|
setListAdapter(new InstrumentationAdapter(this, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
|
mProfilingItem = menu.add(0, 0, 0, "Profiling Mode")
|
||||||
|
.setOnMenuItemClickListener(mProfilingCallback);
|
||||||
|
mProfilingItem.setCheckable(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
mProfilingItem.setChecked(mProfilingMode);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle outState)
|
||||||
|
{
|
||||||
|
if (mProfilingMode) {
|
||||||
|
outState.putBoolean("profiling", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id)
|
||||||
|
{
|
||||||
|
ComponentName className = ((InstrumentationAdapter)getListAdapter()).
|
||||||
|
instrumentationForPosition(position);
|
||||||
|
if (className != null) {
|
||||||
|
String profilingFile = null;
|
||||||
|
if (mProfilingMode) {
|
||||||
|
profilingFile = "/tmp/trace/" + className + ".dmtrace";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ActivityManagerNative.getDefault().
|
||||||
|
startInstrumentation(className, profilingFile, 0, null, mWatcher);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private MenuItem.OnMenuItemClickListener mProfilingCallback =
|
||||||
|
new MenuItem.OnMenuItemClickListener()
|
||||||
|
{
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
mProfilingMode = !mProfilingMode;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private IInstrumentationWatcher mWatcher = new IInstrumentationWatcher.Stub() {
|
||||||
|
|
||||||
|
public void instrumentationStatus(ComponentName name, int resultCode, Bundle results) {
|
||||||
|
if (results != null) {
|
||||||
|
for (String key : results.keySet()) {
|
||||||
|
Log.i("instrumentation",
|
||||||
|
"INSTRUMENTATION_STATUS_RESULT: " + key + "=" + results.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.i("instrumentation", "INSTRUMENTATION_STATUS_CODE: " + resultCode);
|
||||||
|
}
|
||||||
|
public void instrumentationFinished(ComponentName name,
|
||||||
|
int resultCode, Bundle results) {
|
||||||
|
if (results != null) {
|
||||||
|
for (String key : results.keySet()) {
|
||||||
|
Log.i("instrumentation",
|
||||||
|
"INSTRUMENTATION_RESULT: " + key + "=" + results.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.i("instrumentation", "INSTRUMENTATION_CODE: " + resultCode);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private MenuItem mProfilingItem;
|
||||||
|
private boolean mProfilingMode;
|
||||||
|
}
|
||||||
72
apps/Development/src/com/android/development/LogTextBox.java
Normal file
72
apps/Development/src/com/android/development/LogTextBox.java
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.method.ScrollingMovementMethod;
|
||||||
|
import android.text.method.MovementMethod;
|
||||||
|
import android.text.method.KeyListener;
|
||||||
|
import android.text.method.TransformationMethod;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a TextView that is Editable and by default scrollable,
|
||||||
|
* like EditText without a cursor.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>XML attributes</b>
|
||||||
|
* <p>
|
||||||
|
* See
|
||||||
|
* {@link android.R.styleable#TextView TextView Attributes},
|
||||||
|
* {@link android.R.styleable#View View Attributes}
|
||||||
|
*/
|
||||||
|
public class LogTextBox extends TextView {
|
||||||
|
public LogTextBox(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogTextBox(Context context, AttributeSet attrs) {
|
||||||
|
this(context, attrs, android.R.attr.textViewStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogTextBox(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean getDefaultEditable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected MovementMethod getDefaultMovementMethod() {
|
||||||
|
return ScrollingMovementMethod.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Editable getText() {
|
||||||
|
return (Editable) super.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setText(CharSequence text, BufferType type) {
|
||||||
|
super.setText(text, BufferType.EDITABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
169
apps/Development/src/com/android/development/LogViewer.java
Normal file
169
apps/Development/src/com/android/development/LogViewer.java
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 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.android.development;
|
||||||
|
|
||||||
|
import static com.android.internal.util.CharSequences.forAsciiBytes;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.net.Socket;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.view.Gravity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Views the device log.
|
||||||
|
*/
|
||||||
|
public class LogViewer extends Activity {
|
||||||
|
|
||||||
|
static final String TAG = LogViewer.class.getSimpleName();
|
||||||
|
|
||||||
|
FileOutputStream logger;
|
||||||
|
|
||||||
|
volatile boolean active = true;
|
||||||
|
Handler handler;
|
||||||
|
LogTextBox text;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(R.layout.log_viewer);
|
||||||
|
this.handler = new Handler();
|
||||||
|
|
||||||
|
text = (LogTextBox) findViewById(R.id.text);
|
||||||
|
|
||||||
|
text.setTextSize(10);
|
||||||
|
text.setHorizontallyScrolling(true);
|
||||||
|
text.setTypeface(Typeface.MONOSPACE);
|
||||||
|
text.setGravity(Gravity.BOTTOM | Gravity.LEFT);
|
||||||
|
|
||||||
|
this.active = true;
|
||||||
|
try {
|
||||||
|
logger = new FileOutputStream("/tmp/logviewer.txt");
|
||||||
|
new Thread(new LogReader()).start();
|
||||||
|
} catch (IOException e) {
|
||||||
|
appendThrowable(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void appendThrowable(Throwable t) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Error reading log: ");
|
||||||
|
builder.append(Log.getStackTraceString(t));
|
||||||
|
text.getText().append(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class LogReader implements Runnable {
|
||||||
|
|
||||||
|
final Socket socket;
|
||||||
|
final DataInputStream in;
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
long lastTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
private static final int HEADER_SIZE = 24;
|
||||||
|
|
||||||
|
public LogReader() throws IOException {
|
||||||
|
this.socket = new Socket("127.0.0.1", 5040);
|
||||||
|
this.in = new DataInputStream(this.socket.getInputStream());
|
||||||
|
// Write two newlines to indicate "no reader args"
|
||||||
|
this.socket.getOutputStream().write('\n');
|
||||||
|
this.socket.getOutputStream().write('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
while (active) {
|
||||||
|
try {
|
||||||
|
while (in.available() > 0) {
|
||||||
|
logger.write("Reading message.\n".getBytes());
|
||||||
|
|
||||||
|
int length = in.readInt();
|
||||||
|
byte[] bytes = new byte[length];
|
||||||
|
in.readFully(bytes);
|
||||||
|
|
||||||
|
int tagEnd = next0(bytes, HEADER_SIZE);
|
||||||
|
int fileEnd = next0(bytes, tagEnd + 1);
|
||||||
|
int messageEnd = next0(bytes, fileEnd + 1);
|
||||||
|
|
||||||
|
CharSequence tag
|
||||||
|
= forAsciiBytes(bytes, HEADER_SIZE, tagEnd);
|
||||||
|
CharSequence message
|
||||||
|
= forAsciiBytes(bytes, fileEnd + 1, messageEnd);
|
||||||
|
|
||||||
|
builder.append(tag)
|
||||||
|
.append(": ")
|
||||||
|
.append(message)
|
||||||
|
.append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.write("Updating UI.\n".getBytes());
|
||||||
|
handler.post(new AppendCharacters(builder));
|
||||||
|
builder = new StringBuilder();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
|
} catch (final IOException e) {
|
||||||
|
handler.post(new AppendThrowable(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int next0(byte[] bytes, int start) {
|
||||||
|
for (int current = start; current < bytes.length; current++) {
|
||||||
|
if (bytes[current] == 0)
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
return bytes.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AppendThrowable implements Runnable {
|
||||||
|
|
||||||
|
private final Throwable t;
|
||||||
|
|
||||||
|
public AppendThrowable(Throwable t) {
|
||||||
|
this.t = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
appendThrowable(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AppendCharacters implements Runnable {
|
||||||
|
|
||||||
|
private final CharSequence message;
|
||||||
|
|
||||||
|
public AppendCharacters(CharSequence message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
text.getText().append(message);
|
||||||
|
// try {
|
||||||
|
// logger.write(builder.toString().getBytes());
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// appendThrowable(e);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class MediaScannerActivity extends Activity
|
||||||
|
{
|
||||||
|
public MediaScannerActivity() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Called when the activity is first created or resumed. */
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
setContentView(R.layout.media_scanner_activity);
|
||||||
|
|
||||||
|
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_SCANNER_STARTED);
|
||||||
|
intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
|
||||||
|
intentFilter.addDataScheme("file");
|
||||||
|
registerReceiver(mReceiver, intentFilter);
|
||||||
|
|
||||||
|
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"
|
||||||
|
+ Environment.getExternalStorageDirectory())));
|
||||||
|
|
||||||
|
mTitle = (TextView) findViewById(R.id.title);
|
||||||
|
mTitle.setText("Sent ACTION_MEDIA_MOUNTED to trigger the Media Scanner.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Called when the activity going into the background or being destroyed. */
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
unregisterReceiver(mReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (intent.getAction().equals(Intent.ACTION_MEDIA_SCANNER_STARTED)) {
|
||||||
|
mTitle.setText("Media Scanner started scanning " + intent.getData().getPath());
|
||||||
|
}
|
||||||
|
else if (intent.getAction().equals(Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
|
||||||
|
mTitle.setText("Media Scanner finished scanning " + intent.getData().getPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private TextView mTitle;
|
||||||
|
}
|
||||||
177
apps/Development/src/com/android/development/PackageBrowser.java
Normal file
177
apps/Development/src/com/android/development/PackageBrowser.java
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.IPackageDeleteObserver;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.text.Collator;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PackageBrowser extends ListActivity
|
||||||
|
{
|
||||||
|
private PackageListAdapter mAdapter;
|
||||||
|
private List<PackageInfo> mPackageInfoList = null;
|
||||||
|
private Handler mHandler;
|
||||||
|
|
||||||
|
public class PackageListAdapter extends ArrayAdapter<PackageInfo>
|
||||||
|
{
|
||||||
|
|
||||||
|
public PackageListAdapter(Context context)
|
||||||
|
{
|
||||||
|
super(context, android.R.layout.simple_list_item_1);
|
||||||
|
mPackageInfoList = context.getPackageManager().getInstalledPackages(0);
|
||||||
|
if (mPackageInfoList != null) {
|
||||||
|
Collections.sort(mPackageInfoList, sDisplayNameComparator);
|
||||||
|
}
|
||||||
|
setSource(mPackageInfoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bindView(View view, PackageInfo info)
|
||||||
|
{
|
||||||
|
TextView text = (TextView)view.findViewById(android.R.id.text1);
|
||||||
|
text.setText(info.packageName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives notifications when applications are added/removed.
|
||||||
|
*/
|
||||||
|
private class ApplicationsIntentReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
// todo: this is a bit brute force. We should probably get the action and package name
|
||||||
|
// from the intent and just add to or delete from the mPackageInfoList
|
||||||
|
setupAdapter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static Comparator sDisplayNameComparator = new Comparator() {
|
||||||
|
public final int
|
||||||
|
compare(Object a, Object b)
|
||||||
|
{
|
||||||
|
CharSequence sa = ((PackageInfo) a).packageName;
|
||||||
|
CharSequence sb = ((PackageInfo) b).packageName;
|
||||||
|
return collator.compare(sa, sb);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Collator collator = Collator.getInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setupAdapter();
|
||||||
|
mHandler= new Handler();
|
||||||
|
registerIntentReceivers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupAdapter() {
|
||||||
|
mAdapter = new PackageListAdapter(this);
|
||||||
|
setListAdapter(mAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
menu.add(0, 0, 0, "Delete package").setOnMenuItemClickListener(
|
||||||
|
new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
deletePackage();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deletePackage() {
|
||||||
|
final int curSelection = getSelectedItemPosition();
|
||||||
|
if (curSelection >= 0) {
|
||||||
|
// todo: verification dialog for package deletion
|
||||||
|
final PackageInfo packageInfo = mAdapter.itemForPosition(curSelection);
|
||||||
|
if (packageInfo != null) {
|
||||||
|
getPackageManager().deletePackage(packageInfo.packageName,
|
||||||
|
new IPackageDeleteObserver.Stub() {
|
||||||
|
public void packageDeleted(boolean succeeded) throws RemoteException {
|
||||||
|
if (succeeded) {
|
||||||
|
mPackageInfoList.remove(curSelection);
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
mAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// todo: verification dialog for data directory
|
||||||
|
final String dataPath = packageInfo.applicationInfo.dataDir;
|
||||||
|
// todo: delete the data directory
|
||||||
|
} else {
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
new AlertDialog.Builder(PackageBrowser.this)
|
||||||
|
.setTitle("Oops")
|
||||||
|
.setMessage("Could not delete package." +
|
||||||
|
" Maybe it is in /system/app rather than /data/app?")
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerIntentReceivers() {
|
||||||
|
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
||||||
|
filter.addDataScheme("package");
|
||||||
|
registerReceiver(new ApplicationsIntentReceiver(), filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id)
|
||||||
|
{
|
||||||
|
PackageInfo info =
|
||||||
|
mAdapter.itemForPosition(position);
|
||||||
|
if (info != null) {
|
||||||
|
Intent intent = new Intent(
|
||||||
|
null, Uri.fromParts("package", info.packageName, null));
|
||||||
|
intent.setClass(this, PackageSummary.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
269
apps/Development/src/com/android/development/PackageSummary.java
Normal file
269
apps/Development/src/com/android/development/PackageSummary.java
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.ActivityManagerNative;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.InstrumentationInfo;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ProviderInfo;
|
||||||
|
import android.content.pm.ServiceInfo;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
public class PackageSummary extends Activity {
|
||||||
|
|
||||||
|
String mPackageName;
|
||||||
|
private TextView mPackage;
|
||||||
|
private ImageView mIconImage;
|
||||||
|
private TextView mClass;
|
||||||
|
private TextView mLabel;
|
||||||
|
private View mDisabled;
|
||||||
|
private View mSystem;
|
||||||
|
private View mDebuggable;
|
||||||
|
private View mNoCode;
|
||||||
|
private View mPersistent;
|
||||||
|
private Button mRestart;
|
||||||
|
private TextView mTask;
|
||||||
|
private TextView mVersion;
|
||||||
|
private TextView mProcess;
|
||||||
|
private TextView mUid;
|
||||||
|
private TextView mSource;
|
||||||
|
private TextView mData;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
setContentView(R.layout.package_summary);
|
||||||
|
|
||||||
|
final PackageManager pm = getPackageManager();
|
||||||
|
|
||||||
|
mPackage = (TextView)findViewById(R.id.packageView);
|
||||||
|
mIconImage = (ImageView)findViewById(R.id.icon);
|
||||||
|
mClass = (TextView)findViewById(R.id.classView);
|
||||||
|
mLabel = (TextView)findViewById(R.id.label);
|
||||||
|
mDisabled = findViewById(R.id.disabled);
|
||||||
|
mSystem = findViewById(R.id.system);
|
||||||
|
mDebuggable = findViewById(R.id.debuggable);
|
||||||
|
mNoCode = findViewById(R.id.nocode);
|
||||||
|
mPersistent = findViewById(R.id.persistent);
|
||||||
|
mRestart = (Button)findViewById(R.id.restart);
|
||||||
|
mTask = (TextView)findViewById(R.id.task);
|
||||||
|
mVersion = (TextView)findViewById(R.id.version);
|
||||||
|
mUid = (TextView)findViewById(R.id.uid);
|
||||||
|
mProcess = (TextView)findViewById(R.id.process);
|
||||||
|
mSource = (TextView)findViewById(R.id.source);
|
||||||
|
mData = (TextView)findViewById(R.id.data);
|
||||||
|
|
||||||
|
mPackageName = getIntent().getData().getSchemeSpecificPart();
|
||||||
|
PackageInfo info = null;
|
||||||
|
try {
|
||||||
|
info = pm.getPackageInfo(mPackageName,
|
||||||
|
PackageManager.GET_ACTIVITIES | PackageManager.GET_RECEIVERS
|
||||||
|
| PackageManager.GET_SERVICES | PackageManager.GET_PROVIDERS
|
||||||
|
| PackageManager.GET_INSTRUMENTATION);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info != null) {
|
||||||
|
mPackage.setText(info.packageName);
|
||||||
|
CharSequence label = null;
|
||||||
|
String appClass = null;
|
||||||
|
if (info.applicationInfo != null) {
|
||||||
|
mIconImage.setImageDrawable(
|
||||||
|
pm.getApplicationIcon(info.applicationInfo));
|
||||||
|
label = info.applicationInfo.nonLocalizedLabel;
|
||||||
|
appClass = info.applicationInfo.className;
|
||||||
|
if (info.applicationInfo.enabled) {
|
||||||
|
mDisabled.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if ((info.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) == 0) {
|
||||||
|
mSystem.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if ((info.applicationInfo.flags&ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
|
||||||
|
mDebuggable.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if ((info.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) {
|
||||||
|
mNoCode.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if ((info.applicationInfo.flags&ApplicationInfo.FLAG_PERSISTENT) == 0) {
|
||||||
|
mPersistent.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
mUid.setText(Integer.toString(info.applicationInfo.uid));
|
||||||
|
mProcess.setText(info.applicationInfo.processName);
|
||||||
|
if (info.versionName != null) {
|
||||||
|
mVersion.setText(info.versionName + " (#" + info.versionCode + ")");
|
||||||
|
} else {
|
||||||
|
mVersion.setText("(#" + info.versionCode + ")");
|
||||||
|
}
|
||||||
|
mSource.setText(info.applicationInfo.sourceDir);
|
||||||
|
mData.setText(info.applicationInfo.dataDir);
|
||||||
|
if (info.applicationInfo.taskAffinity != null) {
|
||||||
|
mTask.setText("\"" + info.applicationInfo.taskAffinity + "\"");
|
||||||
|
} else {
|
||||||
|
mTask.setText("(No Task Affinity)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (appClass != null) {
|
||||||
|
if (appClass.startsWith(info.packageName + "."))
|
||||||
|
mClass.setText(appClass.substring(info.packageName.length()));
|
||||||
|
else
|
||||||
|
mClass.setText(appClass);
|
||||||
|
} else {
|
||||||
|
mClass.setText("(No Application Class)");
|
||||||
|
}
|
||||||
|
if (label != null) {
|
||||||
|
mLabel.setText("\"" + label + "\"");
|
||||||
|
} else {
|
||||||
|
mLabel.setText("(No Label)");
|
||||||
|
}
|
||||||
|
|
||||||
|
mRestart.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
try {
|
||||||
|
ActivityManagerNative.getDefault().restartPackage(mPackageName);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final LayoutInflater inflate =
|
||||||
|
(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
LinearLayout activities = (LinearLayout)findViewById(R.id.activities);
|
||||||
|
LinearLayout receivers = (LinearLayout)findViewById(R.id.receivers);
|
||||||
|
LinearLayout services = (LinearLayout)findViewById(R.id.services);
|
||||||
|
LinearLayout providers = (LinearLayout)findViewById(R.id.providers);
|
||||||
|
LinearLayout instrumentation = (LinearLayout)findViewById(R.id.instrumentation);
|
||||||
|
|
||||||
|
if (info.activities != null) {
|
||||||
|
final int N = info.activities.length;
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
ActivityInfo ai = info.activities[i];
|
||||||
|
// If an activity is disabled then the ActivityInfo will be null
|
||||||
|
if (ai != null) {
|
||||||
|
Button view = (Button)inflate.inflate(
|
||||||
|
R.layout.package_item, null, false);
|
||||||
|
view.setOnClickListener(new ActivityOnClick(
|
||||||
|
new ComponentName(ai.applicationInfo.packageName,
|
||||||
|
ai.name)));
|
||||||
|
setItemText(view, info, ai.name);
|
||||||
|
activities.addView(view, lp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activities.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.receivers != null) {
|
||||||
|
final int N = info.receivers.length;
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
ActivityInfo ai = info.receivers[i];
|
||||||
|
Button view = (Button)inflate.inflate(
|
||||||
|
R.layout.package_item, null, false);
|
||||||
|
setItemText(view, info, ai.name);
|
||||||
|
receivers.addView(view, lp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
receivers.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.services != null) {
|
||||||
|
final int N = info.services.length;
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
ServiceInfo si = info.services[i];
|
||||||
|
Button view = (Button)inflate.inflate(
|
||||||
|
R.layout.package_item, null, false);
|
||||||
|
setItemText(view, info, si.name);
|
||||||
|
services.addView(view, lp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
services.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.providers != null) {
|
||||||
|
final int N = info.providers.length;
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
ProviderInfo pi = info.providers[i];
|
||||||
|
Button view = (Button)inflate.inflate(
|
||||||
|
R.layout.package_item, null, false);
|
||||||
|
setItemText(view, info, pi.name);
|
||||||
|
providers.addView(view, lp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
providers.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.instrumentation != null) {
|
||||||
|
final int N = info.instrumentation.length;
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
InstrumentationInfo ii = info.instrumentation[i];
|
||||||
|
Button view = (Button)inflate.inflate(
|
||||||
|
R.layout.package_item, null, false);
|
||||||
|
setItemText(view, info, ii.name);
|
||||||
|
instrumentation.addView(view, lp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
instrumentation.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put focus here, so a button doesn't get focus and cause the
|
||||||
|
// scroll view to move to it.
|
||||||
|
mPackage.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static void setItemText(Button item, PackageInfo pi,
|
||||||
|
String className)
|
||||||
|
{
|
||||||
|
item.setText(className.substring(pi.packageName.length()+1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class ActivityOnClick implements View.OnClickListener
|
||||||
|
{
|
||||||
|
private final ComponentName mClassName;
|
||||||
|
ActivityOnClick(ComponentName className) {
|
||||||
|
mClassName = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(
|
||||||
|
null, Uri.fromParts("component",
|
||||||
|
mClassName.flattenToString(), null));
|
||||||
|
intent.setClass(PackageSummary.this, ShowActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.Paint.FontMetricsInt;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.view.VelocityTracker;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demonstrates wrapping a layout in a ScrollView.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PointerLocation extends Activity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(new MyView(this));
|
||||||
|
|
||||||
|
// Make the screen full bright for this activity.
|
||||||
|
WindowManager.LayoutParams lp = getWindow().getAttributes();
|
||||||
|
lp.screenBrightness = 1.0f;
|
||||||
|
getWindow().setAttributes(lp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MyView extends View {
|
||||||
|
private final Paint mTextPaint;
|
||||||
|
private final Paint mTextBackgroundPaint;
|
||||||
|
private final Paint mTextLevelPaint;
|
||||||
|
private final Paint mPaint;
|
||||||
|
private final Paint mTargetPaint;
|
||||||
|
private final FontMetricsInt mTextMetrics = new FontMetricsInt();
|
||||||
|
private final ArrayList<Float> mXs = new ArrayList<Float>();
|
||||||
|
private final ArrayList<Float> mYs = new ArrayList<Float>();
|
||||||
|
private int mHeaderBottom;
|
||||||
|
private boolean mCurDown;
|
||||||
|
private int mCurX;
|
||||||
|
private int mCurY;
|
||||||
|
private float mCurPressure;
|
||||||
|
private float mCurSize;
|
||||||
|
private int mCurWidth;
|
||||||
|
private VelocityTracker mVelocity;
|
||||||
|
|
||||||
|
public MyView(Context c) {
|
||||||
|
super(c);
|
||||||
|
mTextPaint = new Paint();
|
||||||
|
mTextPaint.setAntiAlias(true);
|
||||||
|
mTextPaint.setTextSize(10);
|
||||||
|
mTextPaint.setARGB(255, 0, 0, 0);
|
||||||
|
mTextBackgroundPaint = new Paint();
|
||||||
|
mTextBackgroundPaint.setAntiAlias(false);
|
||||||
|
mTextBackgroundPaint.setARGB(128, 255, 255, 255);
|
||||||
|
mTextLevelPaint = new Paint();
|
||||||
|
mTextLevelPaint.setAntiAlias(false);
|
||||||
|
mTextLevelPaint.setARGB(192, 255, 0, 0);
|
||||||
|
mPaint = new Paint();
|
||||||
|
mPaint.setAntiAlias(true);
|
||||||
|
mPaint.setARGB(255, 255, 255, 255);
|
||||||
|
mPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mPaint.setStrokeWidth(2);
|
||||||
|
mTargetPaint = new Paint();
|
||||||
|
mTargetPaint.setAntiAlias(false);
|
||||||
|
mTargetPaint.setARGB(192, 0, 0, 255);
|
||||||
|
mPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mPaint.setStrokeWidth(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
mTextPaint.getFontMetricsInt(mTextMetrics);
|
||||||
|
mHeaderBottom = -mTextMetrics.ascent+mTextMetrics.descent+2;
|
||||||
|
Log.i("foo", "Metrics: ascent=" + mTextMetrics.ascent
|
||||||
|
+ " descent=" + mTextMetrics.descent
|
||||||
|
+ " leading=" + mTextMetrics.leading
|
||||||
|
+ " top=" + mTextMetrics.top
|
||||||
|
+ " bottom=" + mTextMetrics.bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
int w = getWidth()/5;
|
||||||
|
int base = -mTextMetrics.ascent+1;
|
||||||
|
int bottom = mHeaderBottom;
|
||||||
|
canvas.drawRect(0, 0, w-1, bottom, mTextBackgroundPaint);
|
||||||
|
canvas.drawText("X: " + mCurX, 1, base, mTextPaint);
|
||||||
|
canvas.drawRect(w, 0, (w * 2) - 1, bottom, mTextBackgroundPaint);
|
||||||
|
canvas.drawText("Y: " + mCurY, 1 + w, base, mTextPaint);
|
||||||
|
canvas.drawRect(w * 2, 0, (w * 3) - 1, bottom, mTextBackgroundPaint);
|
||||||
|
canvas.drawRect(w * 2, 0, (w * 2) + (mCurPressure * w) - 1, bottom, mTextLevelPaint);
|
||||||
|
canvas.drawText("Pres: " + mCurPressure, 1 + w * 2, base, mTextPaint);
|
||||||
|
canvas.drawRect(w * 3, 0, (w * 4) - 1, bottom, mTextBackgroundPaint);
|
||||||
|
canvas.drawRect(w * 3, 0, (w * 3) + (mCurSize * w) - 1, bottom, mTextLevelPaint);
|
||||||
|
canvas.drawText("Size: " + mCurSize, 1 + w * 3, base, mTextPaint);
|
||||||
|
canvas.drawRect(w * 4, 0, getWidth(), bottom, mTextBackgroundPaint);
|
||||||
|
int velocity = mVelocity == null ? 0 : (int) (mVelocity.getYVelocity() * 1000);
|
||||||
|
canvas.drawText("yVel: " + velocity, 1 + w * 4, base, mTextPaint);
|
||||||
|
|
||||||
|
final int N = mXs.size();
|
||||||
|
float lastX=0, lastY=0;
|
||||||
|
mPaint.setARGB(255, 0, 255, 255);
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
float x = mXs.get(i);
|
||||||
|
float y = mYs.get(i);
|
||||||
|
if (i > 0) {
|
||||||
|
canvas.drawLine(lastX, lastY, x, y, mTargetPaint);
|
||||||
|
canvas.drawPoint(lastX, lastY, mPaint);
|
||||||
|
}
|
||||||
|
lastX = x;
|
||||||
|
lastY = y;
|
||||||
|
}
|
||||||
|
if (mVelocity != null) {
|
||||||
|
mPaint.setARGB(255, 255, 0, 0);
|
||||||
|
float xVel = mVelocity.getXVelocity() * (1000/60);
|
||||||
|
float yVel = mVelocity.getYVelocity() * (1000/60);
|
||||||
|
canvas.drawLine(lastX, lastY, lastX+xVel, lastY+yVel, mPaint);
|
||||||
|
} else {
|
||||||
|
canvas.drawPoint(lastX, lastY, mPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mCurDown) {
|
||||||
|
canvas.drawLine(0, (int)mCurY, getWidth(), (int)mCurY, mTargetPaint);
|
||||||
|
canvas.drawLine((int)mCurX, 0, (int)mCurX, getHeight(), mTargetPaint);
|
||||||
|
int pressureLevel = (int)(mCurPressure*255);
|
||||||
|
mPaint.setARGB(255, pressureLevel, 128, 255-pressureLevel);
|
||||||
|
canvas.drawPoint(mCurX, mCurY, mPaint);
|
||||||
|
canvas.drawCircle(mCurX, mCurY, mCurWidth, mPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
int action = event.getAction();
|
||||||
|
//mRect.set(0, 0, getWidth(), mHeaderBottom+1);
|
||||||
|
//invalidate(mRect);
|
||||||
|
//if (mCurDown) {
|
||||||
|
// mRect.set(mCurX-mCurWidth-3, mCurY-mCurWidth-3,
|
||||||
|
// mCurX+mCurWidth+3, mCurY+mCurWidth+3);
|
||||||
|
//} else {
|
||||||
|
// mRect.setEmpty();
|
||||||
|
//}
|
||||||
|
if (action == MotionEvent.ACTION_DOWN) {
|
||||||
|
mXs.clear();
|
||||||
|
mYs.clear();
|
||||||
|
mVelocity = VelocityTracker.obtain();
|
||||||
|
}
|
||||||
|
mVelocity.addMovement(event);
|
||||||
|
mVelocity.computeCurrentVelocity(1);
|
||||||
|
final int N = event.getHistorySize();
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
mXs.add(event.getHistoricalX(i));
|
||||||
|
mYs.add(event.getHistoricalY(i));
|
||||||
|
}
|
||||||
|
mXs.add(event.getX());
|
||||||
|
mYs.add(event.getY());
|
||||||
|
mCurDown = action == MotionEvent.ACTION_DOWN
|
||||||
|
|| action == MotionEvent.ACTION_MOVE;
|
||||||
|
mCurX = (int)event.getX();
|
||||||
|
mCurY = (int)event.getY();
|
||||||
|
mCurPressure = event.getPressure();
|
||||||
|
mCurSize = event.getSize();
|
||||||
|
mCurWidth = (int)(mCurSize*(getWidth()/3));
|
||||||
|
//if (mCurDown) {
|
||||||
|
// mRect.union(mCurX-mCurWidth-3, mCurY-mCurWidth-3,
|
||||||
|
// mCurX+mCurWidth+3, mCurY+mCurWidth+3);
|
||||||
|
//}
|
||||||
|
//invalidate(mRect);
|
||||||
|
invalidate();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
62
apps/Development/src/com/android/development/ProcessInfo.java
Executable file
62
apps/Development/src/com/android/development/ProcessInfo.java
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class ProcessInfo extends Activity {
|
||||||
|
PackageManager mPm;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
String processName = intent.getStringExtra("processName");
|
||||||
|
String pkgList[] = intent.getStringArrayExtra("packageList");
|
||||||
|
mPm = getPackageManager();
|
||||||
|
setContentView(R.layout.process_info);
|
||||||
|
TextView processNameView = (TextView) findViewById(R.id.process_name);
|
||||||
|
LinearLayout pkgListView = (LinearLayout) findViewById(R.id.package_list);
|
||||||
|
if(processName != null) {
|
||||||
|
processNameView.setText(processName);
|
||||||
|
}
|
||||||
|
if(pkgList != null) {
|
||||||
|
for(String pkg : pkgList) {
|
||||||
|
TextView pkgView = new TextView(this);
|
||||||
|
pkgView.setText(pkg);
|
||||||
|
pkgListView.addView(pkgView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemProperties;
|
||||||
|
import android.provider.Checkin;
|
||||||
|
import com.android.internal.telephony.Phone;
|
||||||
|
import com.android.internal.telephony.PhoneFactory;
|
||||||
|
import android.telephony.ServiceState;
|
||||||
|
import android.text.format.DateFormat;
|
||||||
|
import static com.android.internal.util.CharSequences.forAsciiBytes;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import com.google.android.collect.Maps;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.EOFException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Report radio issues to the StatisticsService.
|
||||||
|
*/
|
||||||
|
public class RadioIssueReport extends Activity
|
||||||
|
{
|
||||||
|
private static final String TAG = "RadioIssue";
|
||||||
|
private static final int HEADER_SIZE = 24;
|
||||||
|
private static final String RADIO_BUFFER_OPTIONS = "-b radio\n-d\n";
|
||||||
|
|
||||||
|
/** List of system properties to snapshot. */
|
||||||
|
private static String[] SYSTEM_PROPERTIES = {
|
||||||
|
"net.gsm.radio-reset",
|
||||||
|
"net.gsm.attempt-gprs",
|
||||||
|
"net.gsm.succeed-gprs",
|
||||||
|
"net.gsm.disconnect",
|
||||||
|
"net.ppp.sent",
|
||||||
|
"net.ppp.received",
|
||||||
|
"gsm.version.baseband",
|
||||||
|
"gsm.version.ril-impl",
|
||||||
|
};
|
||||||
|
|
||||||
|
private Button mSubmitButton;
|
||||||
|
private EditText mReportText;
|
||||||
|
private ServiceState mServiceState;
|
||||||
|
private Phone.State mPhoneState;
|
||||||
|
private int mSignalStrength;
|
||||||
|
private Phone.DataState mDataState;
|
||||||
|
private String mRadioLog;
|
||||||
|
|
||||||
|
/** Snapshot of interesting variables relevant to the radio. */
|
||||||
|
private Map<String, String> mRadioState;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void
|
||||||
|
onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
setContentView(R.layout.radio_issue);
|
||||||
|
|
||||||
|
initSubmitButton();
|
||||||
|
initReportText();
|
||||||
|
|
||||||
|
mRadioState = snapState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a snapshot of phone state variables to report.
|
||||||
|
*/
|
||||||
|
private static Map<String, String> snapState() {
|
||||||
|
Map<String, String> state = Maps.newHashMap();
|
||||||
|
|
||||||
|
// Capture a bunch of system properties
|
||||||
|
for (String property: SYSTEM_PROPERTIES) {
|
||||||
|
String value = SystemProperties.get(property);
|
||||||
|
state.put(property, SystemProperties.get(property));
|
||||||
|
}
|
||||||
|
|
||||||
|
Phone phone = PhoneFactory.getDefaultPhone();
|
||||||
|
state.put("phone-data", phone.getDataConnectionState().toString());
|
||||||
|
state.put("phone-service", phone.getServiceState().toString());
|
||||||
|
state.put("phone-signal", String.valueOf(phone.getSignalStrengthASU()));
|
||||||
|
state.put("phone-state", phone.getState().toString());
|
||||||
|
|
||||||
|
try {
|
||||||
|
state.put("radio-log", getRadioLog());
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "Error reading radio log", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSubmitButton() {
|
||||||
|
mSubmitButton = (Button) findViewById(R.id.submit);
|
||||||
|
mSubmitButton.setOnClickListener(mSubmitButtonHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initReportText() {
|
||||||
|
mReportText = (EditText) findViewById(R.id.report_text);
|
||||||
|
mReportText.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
OnClickListener mSubmitButtonHandler = new OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
// Include the user-supplied report text.
|
||||||
|
mRadioState.put("user-report", mReportText.getText().toString());
|
||||||
|
|
||||||
|
// Dump the state variables directly into the report.
|
||||||
|
Checkin.logEvent(getContentResolver(),
|
||||||
|
Checkin.Events.Tag.RADIO_BUG_REPORT,
|
||||||
|
mRadioState.toString());
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Largely stolen from LogViewer.java
|
||||||
|
private static String getRadioLog() throws IOException {
|
||||||
|
Socket sock = new Socket("127.0.0.1", 5040);
|
||||||
|
DataInputStream in = new DataInputStream(sock.getInputStream());
|
||||||
|
StringBuilder log = new StringBuilder();
|
||||||
|
|
||||||
|
// Set options
|
||||||
|
sock.getOutputStream().write(RADIO_BUFFER_OPTIONS.getBytes());
|
||||||
|
sock.getOutputStream().write('\n');
|
||||||
|
sock.getOutputStream().write('\n');
|
||||||
|
|
||||||
|
// Read in the log
|
||||||
|
try {
|
||||||
|
Calendar cal = new GregorianCalendar();
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
int length = in.readInt();
|
||||||
|
long when = (long)in.readInt();
|
||||||
|
byte[] bytes = new byte[length-4];
|
||||||
|
in.readFully(bytes);
|
||||||
|
|
||||||
|
int tagEnd = next0(bytes, HEADER_SIZE-4);
|
||||||
|
int fileEnd = next0(bytes, tagEnd + 1);
|
||||||
|
int messageEnd = next0(bytes, fileEnd + 1);
|
||||||
|
|
||||||
|
CharSequence tag
|
||||||
|
= forAsciiBytes(bytes, HEADER_SIZE-4, tagEnd);
|
||||||
|
CharSequence message
|
||||||
|
= forAsciiBytes(bytes, fileEnd + 1, messageEnd);
|
||||||
|
|
||||||
|
cal.setTimeInMillis(when*1000);
|
||||||
|
log.append(DateFormat.format("MM-dd kk:mm:ss ", cal));
|
||||||
|
log.append(tag)
|
||||||
|
.append(": ")
|
||||||
|
.append(message)
|
||||||
|
.append("\n");
|
||||||
|
}
|
||||||
|
} catch (EOFException e) {
|
||||||
|
Log.d(TAG, "reached end of stream");
|
||||||
|
}
|
||||||
|
|
||||||
|
return log.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int next0(byte[] bytes, int start) {
|
||||||
|
for (int current = start; current < bytes.length; current++) {
|
||||||
|
if (bytes[current] == 0)
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
return bytes.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
154
apps/Development/src/com/android/development/RunningProcesses.java
Executable file
154
apps/Development/src/com/android/development/RunningProcesses.java
Executable file
@@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.ActivityManager;
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import java.text.Collator;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RunningProcesses extends ListActivity {
|
||||||
|
PackageManager mPm;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
mPm = getPackageManager();
|
||||||
|
mAdapter = new AppListAdapter(this);
|
||||||
|
if (mAdapter.getCount() <= 0) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
setListAdapter(mAdapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||||
|
ListItem app = mAdapter.appForPosition(position);
|
||||||
|
// Create intent to start new activity
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setClass(this, ProcessInfo.class);
|
||||||
|
intent.putExtra("processName", app.procInfo.processName);
|
||||||
|
intent.putExtra("packageList", app.procInfo.pkgList);
|
||||||
|
// start new activity to display extended information
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class AppListAdapter extends BaseAdapter {
|
||||||
|
public AppListAdapter(Context context) {
|
||||||
|
mContext = context;
|
||||||
|
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
|
ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
|
List<ActivityManager.RunningAppProcessInfo> appList = am.getRunningAppProcesses();
|
||||||
|
for (ActivityManager.RunningAppProcessInfo app : appList) {
|
||||||
|
if(mList == null) {
|
||||||
|
mList = new ArrayList<ListItem>();
|
||||||
|
}
|
||||||
|
mList.add(new ListItem(app));
|
||||||
|
}
|
||||||
|
if (mList != null) {
|
||||||
|
Collections.sort(mList, sDisplayNameComparator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListItem appForPosition(int position) {
|
||||||
|
if (mList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return mList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return mList != null ? mList.size() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
View view;
|
||||||
|
if (convertView == null) {
|
||||||
|
view = mInflater.inflate(
|
||||||
|
android.R.layout.simple_list_item_1, parent, false);
|
||||||
|
} else {
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
bindView(view, mList.get(position));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void bindView(View view, ListItem info) {
|
||||||
|
TextView text = (TextView)view.findViewById(android.R.id.text1);
|
||||||
|
text.setText(info != null ? info.procInfo.processName : "(none)");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final Context mContext;
|
||||||
|
protected final LayoutInflater mInflater;
|
||||||
|
protected List<ListItem> mList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Comparator sDisplayNameComparator = new Comparator() {
|
||||||
|
public final int compare(Object a, Object b) {
|
||||||
|
CharSequence sa = ((ListItem) a).procInfo.processName;
|
||||||
|
CharSequence sb = ((ListItem) b).procInfo.processName;
|
||||||
|
return collator.compare(sa, sb);
|
||||||
|
}
|
||||||
|
private final Collator collator = Collator.getInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
private class ListItem {
|
||||||
|
ActivityManager.RunningAppProcessInfo procInfo;
|
||||||
|
public ListItem(ActivityManager.RunningAppProcessInfo pInfo) {
|
||||||
|
procInfo = pInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private AppListAdapter mAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
122
apps/Development/src/com/android/development/ShowActivity.java
Normal file
122
apps/Development/src/com/android/development/ShowActivity.java
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
/* //device/apps/Settings/src/com/android/settings/Keyguard.java
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.development;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
public class ShowActivity extends Activity {
|
||||||
|
|
||||||
|
private ActivityInfo mActivityInfo;
|
||||||
|
|
||||||
|
private TextView mPackage;
|
||||||
|
private ImageView mIconImage;
|
||||||
|
private TextView mClass;
|
||||||
|
private TextView mLabel;
|
||||||
|
private TextView mLaunch;
|
||||||
|
private TextView mProcess;
|
||||||
|
private TextView mTaskAffinity;
|
||||||
|
private TextView mPermission;
|
||||||
|
private TextView mMultiprocess;
|
||||||
|
private TextView mClearOnBackground;
|
||||||
|
private TextView mStateNotNeeded;
|
||||||
|
|
||||||
|
public void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
setContentView(R.layout.show_activity);
|
||||||
|
|
||||||
|
mPackage = (TextView)findViewById(R.id.packageView);
|
||||||
|
mIconImage = (ImageView)findViewById(R.id.icon);
|
||||||
|
mClass = (TextView)findViewById(R.id.classView);
|
||||||
|
mLabel = (TextView)findViewById(R.id.label);
|
||||||
|
mLaunch = (TextView)findViewById(R.id.launch);
|
||||||
|
mProcess = (TextView)findViewById(R.id.process);
|
||||||
|
mTaskAffinity = (TextView)findViewById(R.id.taskAffinity);
|
||||||
|
mPermission = (TextView)findViewById(R.id.permission);
|
||||||
|
mMultiprocess = (TextView)findViewById(R.id.multiprocess);
|
||||||
|
mClearOnBackground = (TextView)findViewById(R.id.clearOnBackground);
|
||||||
|
mStateNotNeeded = (TextView)findViewById(R.id.stateNotNeeded);
|
||||||
|
|
||||||
|
final PackageManager pm = getPackageManager();
|
||||||
|
try {
|
||||||
|
mActivityInfo = pm.getActivityInfo(ComponentName.unflattenFromString(
|
||||||
|
getIntent().getData().getSchemeSpecificPart()), 0);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
}
|
||||||
|
if (mActivityInfo != null) {
|
||||||
|
mPackage.setText(mActivityInfo.applicationInfo.packageName);
|
||||||
|
mIconImage.setImageDrawable(mActivityInfo.loadIcon(pm));
|
||||||
|
if (mActivityInfo.name.startsWith(
|
||||||
|
mActivityInfo.applicationInfo.packageName + ".")) {
|
||||||
|
mClass.setText(mActivityInfo.name.substring(
|
||||||
|
mActivityInfo.applicationInfo.packageName.length()));
|
||||||
|
} else {
|
||||||
|
mClass.setText(mActivityInfo.name);
|
||||||
|
}
|
||||||
|
CharSequence label = mActivityInfo.loadLabel(pm);
|
||||||
|
mLabel.setText("\"" + (label != null ? label : "") + "\"");
|
||||||
|
switch (mActivityInfo.launchMode) {
|
||||||
|
case ActivityInfo.LAUNCH_MULTIPLE:
|
||||||
|
mLaunch.setText(getText(R.string.launch_multiple));
|
||||||
|
break;
|
||||||
|
case ActivityInfo.LAUNCH_SINGLE_TOP:
|
||||||
|
mLaunch.setText(getText(R.string.launch_singleTop));
|
||||||
|
break;
|
||||||
|
case ActivityInfo.LAUNCH_SINGLE_TASK:
|
||||||
|
mLaunch.setText(getText(R.string.launch_singleTask));
|
||||||
|
break;
|
||||||
|
case ActivityInfo.LAUNCH_SINGLE_INSTANCE:
|
||||||
|
mLaunch.setText(getText(R.string.launch_singleInstance));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mLaunch.setText(getText(R.string.launch_unknown));
|
||||||
|
}
|
||||||
|
mProcess.setText(mActivityInfo.processName);
|
||||||
|
mTaskAffinity.setText(mActivityInfo.taskAffinity != null
|
||||||
|
? mActivityInfo.taskAffinity : getText(R.string.none));
|
||||||
|
mPermission.setText(mActivityInfo.permission != null
|
||||||
|
? mActivityInfo.permission : getText(R.string.none));
|
||||||
|
mMultiprocess.setText(
|
||||||
|
(mActivityInfo.flags&ActivityInfo.FLAG_MULTIPROCESS) != 0
|
||||||
|
? getText(R.string.yes) : getText(R.string.no));
|
||||||
|
mClearOnBackground.setText(
|
||||||
|
(mActivityInfo.flags&ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH) != 0
|
||||||
|
? getText(R.string.yes) : getText(R.string.no));
|
||||||
|
mStateNotNeeded.setText(
|
||||||
|
(mActivityInfo.flags&ActivityInfo.FLAG_STATE_NOT_NEEDED) != 0
|
||||||
|
? getText(R.string.yes) : getText(R.string.no));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 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.android.development;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.text.method.ScrollingMovementMethod;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.server.data.CrashData;
|
||||||
|
import android.server.data.ThrowableData;
|
||||||
|
import android.server.data.StackTraceElementData;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Views a single stack trace.
|
||||||
|
*/
|
||||||
|
public class StacktraceViewer extends Activity {
|
||||||
|
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(R.layout.log_viewer);
|
||||||
|
|
||||||
|
TextView text = (TextView) findViewById(R.id.text);
|
||||||
|
text.setTextSize(10);
|
||||||
|
text.setHorizontallyScrolling(true);
|
||||||
|
text.setTypeface(Typeface.MONOSPACE);
|
||||||
|
text.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||||
|
|
||||||
|
String stacktrace = getIntent().getExtras().getString(
|
||||||
|
CrashData.class.getName());
|
||||||
|
|
||||||
|
text.setText(stacktrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.development;
|
||||||
|
|
||||||
|
import android.app.LauncherActivity;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
public class UnderdevelopedSettings extends LauncherActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Intent getTargetIntent() {
|
||||||
|
Intent targetIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||||
|
targetIntent.addCategory(Intent.CATEGORY_DEVELOPMENT_PREFERENCE);
|
||||||
|
return targetIntent;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
10
apps/Fallback/Android.mk
Normal file
10
apps/Fallback/Android.mk
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := user development
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||||
|
|
||||||
|
LOCAL_PACKAGE_NAME := Fallback
|
||||||
|
|
||||||
|
include $(BUILD_PACKAGE)
|
||||||
62
apps/Fallback/AndroidManifest.xml
Normal file
62
apps/Fallback/AndroidManifest.xml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.fallback">
|
||||||
|
<application android:label="@string/appTitle">
|
||||||
|
|
||||||
|
<activity android:name="Fallback" android:label="@string/title"
|
||||||
|
android:theme="@android:style/Theme.Dialog">
|
||||||
|
<!-- for debugging on non-SDK builds
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
-->
|
||||||
|
<!-- SMS intents -->
|
||||||
|
<intent-filter android:priority="-1000">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="vnd.android.cursor.item/sms-chat" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter android:priority="-1000">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<action android:name="android.intent.action.SENDTO" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:scheme="sms" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter android:priority="-1000">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:mimeType="vnd.android.cursor.item/sms" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Mail intents -->
|
||||||
|
<intent-filter android:priority="-1000">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<action android:name="android.intent.action.SENDTO" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="mailto" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Wallpaper intents -->
|
||||||
|
<intent-filter android:priority="-1000">
|
||||||
|
<action android:name="android.intent.action.WALLPAPER_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Camera intents -->
|
||||||
|
<intent-filter android:priority="-1000">
|
||||||
|
<action android:name="android.intent.action.GET_CONTENT" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="image/*" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Settings Intent -->
|
||||||
|
<intent-filter android:priority="-1000">
|
||||||
|
<action android:name="android.settings.SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
0
apps/Fallback/MODULE_LICENSE_APACHE2
Normal file
0
apps/Fallback/MODULE_LICENSE_APACHE2
Normal file
190
apps/Fallback/NOTICE
Normal file
190
apps/Fallback/NOTICE
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
|
||||||
|
Copyright (c) 2005-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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
28
apps/Fallback/res/layout/fallback.xml
Normal file
28
apps/Fallback/res/layout/fallback.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dip"
|
||||||
|
android:layout_marginLeft="6dip"
|
||||||
|
android:text="@string/error" />
|
||||||
|
</RelativeLayout>
|
||||||
21
apps/Fallback/res/values-cs/strings.xml
Normal file
21
apps/Fallback/res/values-cs/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Záloha"</string>
|
||||||
|
<string name="title">"Akce není podporována"</string>
|
||||||
|
<string name="error">"Tato akce není momentálně podporována."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-de/strings.xml
Normal file
21
apps/Fallback/res/values-de/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"Nicht unterstützte Aktion"</string>
|
||||||
|
<string name="error">"Diese Aktion wird zurzeit nicht unterstützt."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-es/strings.xml
Normal file
21
apps/Fallback/res/values-es/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"Acción no admitida"</string>
|
||||||
|
<string name="error">"Esa acción no se admite actualmente."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-fr/strings.xml
Normal file
21
apps/Fallback/res/values-fr/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Application de secours"</string>
|
||||||
|
<string name="title">"Action non prise en charge"</string>
|
||||||
|
<string name="error">"Cette action n\'est actuellement pas prise en charge."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-it/strings.xml
Normal file
21
apps/Fallback/res/values-it/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"Azione non supportata"</string>
|
||||||
|
<string name="error">"L\'azione non è al momento supportata."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-ja/strings.xml
Normal file
21
apps/Fallback/res/values-ja/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"サポートされていない操作"</string>
|
||||||
|
<string name="error">"現在サポートされていない操作です。"</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-ko/strings.xml
Normal file
21
apps/Fallback/res/values-ko/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"지원되지 않는 작업"</string>
|
||||||
|
<string name="error">"이 작업은 현재 지원되지 않습니다."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-nb/strings.xml
Normal file
21
apps/Fallback/res/values-nb/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"Ustøttet handling"</string>
|
||||||
|
<string name="error">"Denne handlingen er ikke støttet nå."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-nl/strings.xml
Normal file
21
apps/Fallback/res/values-nl/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Reserve"</string>
|
||||||
|
<string name="title">"Niet-ondersteunde actie"</string>
|
||||||
|
<string name="error">"Die actie wordt momenteel niet ondersteund."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-pl/strings.xml
Normal file
21
apps/Fallback/res/values-pl/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Wycofanie"</string>
|
||||||
|
<string name="title">"Nieobsługiwana czynność"</string>
|
||||||
|
<string name="error">"Ta czynność nie jest aktualnie obsługiwana."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-ru/strings.xml
Normal file
21
apps/Fallback/res/values-ru/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"Действие не поддерживается"</string>
|
||||||
|
<string name="error">"В настоящее время это действие не поддерживается."</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-zh-rCN/strings.xml
Normal file
21
apps/Fallback/res/values-zh-rCN/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"不支持的操作"</string>
|
||||||
|
<string name="error">"当前不支持该操作。"</string>
|
||||||
|
</resources>
|
||||||
21
apps/Fallback/res/values-zh-rTW/strings.xml
Normal file
21
apps/Fallback/res/values-zh-rTW/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"備用"</string>
|
||||||
|
<string name="title">"不支援的操作"</string>
|
||||||
|
<string name="error">"目前不支援此操作。"</string>
|
||||||
|
</resources>
|
||||||
25
apps/Fallback/res/values/strings.xml
Normal file
25
apps/Fallback/res/values/strings.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<!-- Name of the fallback application. It's used only on the SDK when applications from
|
||||||
|
real phones aren't available. -->
|
||||||
|
<string name="appTitle">Fallback</string>
|
||||||
|
<!-- Dialog title informing the user that the requested action is not supported -->
|
||||||
|
<string name="title">Unsupported action</string>
|
||||||
|
<!-- Dialog content informing the user that the requested action is not supported -->
|
||||||
|
<string name="error">That action is not currently supported.</string>
|
||||||
|
</resources>
|
||||||
32
apps/Fallback/src/com/android/fallback/Fallback.java
Normal file
32
apps/Fallback/src/com/android/fallback/Fallback.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.fallback;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A fall back activity that registers itself for common intents which
|
||||||
|
* may possibly not otherwise be handled.
|
||||||
|
*/
|
||||||
|
public class Fallback extends Activity {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(R.layout.fallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
apps/FontLab/Android.mk
Normal file
10
apps/FontLab/Android.mk
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := tests
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||||
|
|
||||||
|
LOCAL_PACKAGE_NAME := FontLab
|
||||||
|
|
||||||
|
include $(BUILD_PACKAGE)
|
||||||
13
apps/FontLab/AndroidManifest.xml
Normal file
13
apps/FontLab/AndroidManifest.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.fontlab">
|
||||||
|
<application android:label="Font lab">
|
||||||
|
<activity android:name="FontLab">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="BackgroundPicker"/>
|
||||||
|
<activity android:name="FontPicker"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
0
apps/FontLab/MODULE_LICENSE_APACHE2
Normal file
0
apps/FontLab/MODULE_LICENSE_APACHE2
Normal file
190
apps/FontLab/NOTICE
Normal file
190
apps/FontLab/NOTICE
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
|
||||||
|
Copyright (c) 2005-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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
30
apps/FontLab/res/layout/font_lab.xml
Normal file
30
apps/FontLab/res/layout/font_lab.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/content"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="4dip" android:paddingRight="4dip"
|
||||||
|
android:paddingTop="4dip" android:paddingBottom="4dip">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/column1" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1"
|
||||||
|
android:layout_marginBottom="8dip" />
|
||||||
|
<TextView android:id="@+id/column2" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
77
apps/FontLab/src/com/android/fontlab/BackgroundPicker.java
Normal file
77
apps/FontLab/src/com/android/fontlab/BackgroundPicker.java
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.fontlab;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.SimpleAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class BackgroundPicker extends ListActivity
|
||||||
|
{
|
||||||
|
|
||||||
|
public void onCreate(Bundle icicle)
|
||||||
|
{
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
setListAdapter(new SimpleAdapter(this,
|
||||||
|
getData(),
|
||||||
|
android.R.layout.simple_list_item_1,
|
||||||
|
new String[] {"title"},
|
||||||
|
new int[] {android.R.id.text1}));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List getData()
|
||||||
|
{
|
||||||
|
List myData = new ArrayList<Bundle>();
|
||||||
|
addItem(myData, "Solid White", 0, 0xFFFFFFFF, 0xFF000000);
|
||||||
|
addItem(myData, "Solid Light Gray", 0, 0xFFBFBFBF, 0xFF000000);
|
||||||
|
addItem(myData, "Solid Dark Gray", 0, 0xFF404040, 0xFFFFFFFF);
|
||||||
|
addItem(myData, "Solid Black", 0, 0xFF000000, 0xFFFFFFFF);
|
||||||
|
addItem(myData, "Solid Blue", 0, 0xFF1a387a, 0xFFFFFFFF);
|
||||||
|
addItem(myData, "Textured White", 0, 0, 0xFF000000);
|
||||||
|
// addItem(myData, "Textured Blue", android.R.drawable.screen_background_blue, 0, 0xFFFFFFFF);
|
||||||
|
|
||||||
|
return myData;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addItem(List<Bundle> data, String name, int textureRes, int bgColor, int textColor)
|
||||||
|
{
|
||||||
|
Bundle temp = new Bundle();
|
||||||
|
temp.putString("title", name);
|
||||||
|
if (textureRes != 0) {
|
||||||
|
temp.putInt("texture", textureRes);
|
||||||
|
}
|
||||||
|
temp.putInt("bgcolor", bgColor);
|
||||||
|
temp.putInt("text", textColor);
|
||||||
|
data.add(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id)
|
||||||
|
{
|
||||||
|
Bundle map = (Bundle) l.getItemAtPosition(position);
|
||||||
|
setResult(RESULT_OK, (new Intent()).putExtras(map));
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
361
apps/FontLab/src/com/android/fontlab/FontLab.java
Normal file
361
apps/FontLab/src/com/android/fontlab/FontLab.java
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.fontlab;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.graphics.drawable.PaintDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
class FontLab extends Activity
|
||||||
|
{
|
||||||
|
private static final int MIN_SIZE = 1;
|
||||||
|
private static final int MAX_SIZE = 60;
|
||||||
|
|
||||||
|
private static final float SCALE_X_RANGE = 20;
|
||||||
|
private static final int MAX_SCALE_X = 20;
|
||||||
|
private static final int MIN_SCALE_X = -19; // -20 would make zero-scale
|
||||||
|
|
||||||
|
private static final String[] sText = {
|
||||||
|
"Applications Contacts Maps Google Browser Text messages Address book"
|
||||||
|
+ " Development Earth Quake Settings Voicemail Zoolander. Four score"
|
||||||
|
+ " and seven years ago our fathers brought forth on this continent, a"
|
||||||
|
+ " new nation, conceived in Liberty, and dedicated to the proposition"
|
||||||
|
+ " that all men are created equal. Now we are engaged in a great civil"
|
||||||
|
+ " war, testing whether that nation, or any nation so conceived and so"
|
||||||
|
+ " dedicated, can long endure. We are met on a great battle-field of"
|
||||||
|
+ " that war. We have come to dedicate a portion of that field, as a"
|
||||||
|
+ " final resting place for those who here gave their lives that that"
|
||||||
|
+ " nation might live. It is altogether fitting and proper that we"
|
||||||
|
+ " should do this. But, in a larger sense, we can not dedicate - we"
|
||||||
|
+ " can not consecrate - we can not hallow - this ground. The brave"
|
||||||
|
+ " men, living and dead, who struggled here, have consecrated it, far"
|
||||||
|
+ " above our poor power to add or detract. The world will little note,"
|
||||||
|
+ " nor long remember what we say here, but it can never forget what"
|
||||||
|
+ " they did here. It is for us the living, rather, to be dedicated"
|
||||||
|
+ " here to the unfinished work which they who fought here have thus"
|
||||||
|
+ " far so nobly advanced. It is rather for us to be here dedicated to"
|
||||||
|
+ " the great task remaining before us - that from these honored dead"
|
||||||
|
+ " we take increased devotion to that cause for which they gave the"
|
||||||
|
+ " last full measure of devotion - that we here highly resolve that"
|
||||||
|
+ " these dead shall not have died in vain - that this nation, under"
|
||||||
|
+ " God, shall have a new birth of freedom - and that government of the"
|
||||||
|
+ " people, by the people, for the people, shall not perish from the"
|
||||||
|
+ " earth."
|
||||||
|
,
|
||||||
|
"A Spanish doctor on Tuesday stood by his opinion that Fidel Castro is recovering from stomach surgery despite a newspaper report stating the Cuban leader is in a serious condition after a number of failed operations."
|
||||||
|
+ " When Senator Wayne Allard, Republican of Colorado, announced Monday that he would not seek re-election, the uphill battle for his party to reclaim the Senate in 2008 became an even steeper climb."
|
||||||
|
+ " Naomi Campbell was today sentenced to five days' community service and ordered to attend an anger management course after she admitted throwing a mobile phone at her maid."
|
||||||
|
,
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*()-_=+[]\\{}|;':\",./<>?"
|
||||||
|
,
|
||||||
|
"HaH HbH HcH HdH HeH HfH HgH HhH HiH HjH HkH HlH HmH HnH HoH HpH HqH HrH HsH HtH HuH HvH HwH HxH HyH HzH"
|
||||||
|
+ "HAH HBH HCH HDH HEH HFH HGH HHH HIH HJH HKH HLH HMH HNH HOH HPH HQH HRH HSH HTH HUH HVH HWH HXH HYH HZH"
|
||||||
|
};
|
||||||
|
|
||||||
|
private void updateText() {
|
||||||
|
mTextIndex %= sText.length;
|
||||||
|
String s = sText[mTextIndex];
|
||||||
|
mColumn1.setText(s);
|
||||||
|
mColumn2.setText(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FontLab() {}
|
||||||
|
|
||||||
|
public void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(R.layout.font_lab);
|
||||||
|
|
||||||
|
mColumn1 = (TextView)findViewById(R.id.column1);
|
||||||
|
mColumn2 = (TextView)findViewById(R.id.column2);
|
||||||
|
mContentView = findViewById(R.id.content);
|
||||||
|
|
||||||
|
|
||||||
|
mColumn1.setTextSize(mFontSize);
|
||||||
|
mColumn2.setTextSize(mFontSize);
|
||||||
|
|
||||||
|
mColumn1.setTextColor(Color.BLACK);
|
||||||
|
mColumn1.setBackgroundDrawable(new PaintDrawable(Color.WHITE));
|
||||||
|
mColumn2.setTextColor(Color.WHITE);
|
||||||
|
mColumn2.setBackgroundDrawable(new PaintDrawable(Color.BLACK));
|
||||||
|
|
||||||
|
refreshFont();
|
||||||
|
updateTitle();
|
||||||
|
updateText();
|
||||||
|
|
||||||
|
setDefaultKeyMode(Activity.DEFAULT_KEYS_SHORTCUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTitle() {
|
||||||
|
Typeface tf = mColumn1.getTypeface();
|
||||||
|
String title = " ps=" + mFontSize + " scaleX="
|
||||||
|
+ (1 + mTextScaleXDelta/SCALE_X_RANGE)
|
||||||
|
+ " gamma=" + (mGamma/20.f)
|
||||||
|
+ " " + sTypefaceName[mFontIndex]
|
||||||
|
+ " " + sStyleName[tf.getStyle()]
|
||||||
|
;
|
||||||
|
setTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Called when it is time to initialize the activity state. */
|
||||||
|
protected void onRestoreInstanceState(Bundle state) {
|
||||||
|
super.onRestoreInstanceState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String sStyleName[] = {
|
||||||
|
"Regular", "Bold", "Italic", "Bold Italic"
|
||||||
|
};
|
||||||
|
private static final String sTypefaceName[] = {
|
||||||
|
"Droid Sans",
|
||||||
|
"Droid Serif",
|
||||||
|
"Droid Mono"
|
||||||
|
};
|
||||||
|
private static final Typeface sTypeface[] = {
|
||||||
|
Typeface.SANS_SERIF,
|
||||||
|
Typeface.SERIF,
|
||||||
|
Typeface.MONOSPACE
|
||||||
|
};
|
||||||
|
private static final int FONT_INDEX_SANS = 0; // index into sTypeface
|
||||||
|
private static final int FONT_INDEX_SERIF = 1; // index into sTypeface
|
||||||
|
private static final int FONT_INDEX_MONO = 2; // index into sTypeface
|
||||||
|
|
||||||
|
private static boolean canSupportStyle(Typeface tf, int styleBits) {
|
||||||
|
tf = Typeface.create(tf, styleBits);
|
||||||
|
return (tf.getStyle() & styleBits) == styleBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshFont() {
|
||||||
|
Typeface tf = Typeface.create(sTypeface[mFontIndex], mFontStyle);
|
||||||
|
mColumn1.setTypeface(tf);
|
||||||
|
mColumn2.setTypeface(tf);
|
||||||
|
updateTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private MenuItem.OnMenuItemClickListener mFontClickListener = new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
mFontIndex = item.getItemId();
|
||||||
|
refreshFont();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private void addFontMenu(Menu menu, int index) {
|
||||||
|
MenuItem item = menu.add(0, index, 0, sTypefaceName[index]);
|
||||||
|
item.setCheckable(true);
|
||||||
|
item.setOnMenuItemClickListener(mFontClickListener);
|
||||||
|
item.setChecked(index == mFontIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MenuItem.OnMenuItemClickListener mStyleClickListener = new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
mFontStyle = mFontStyle ^ item.getItemId();
|
||||||
|
refreshFont();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private void addStyleMenu(Menu menu, int style, char shortCut) {
|
||||||
|
MenuItem item = menu.add(0, style, 0, (style == Typeface.BOLD) ? "Bold" : "Italic");
|
||||||
|
item.setCheckable(true);
|
||||||
|
item.setOnMenuItemClickListener(mStyleClickListener);
|
||||||
|
item.setChecked((mFontStyle & style) != 0);
|
||||||
|
|
||||||
|
item.setVisible(canSupportStyle(sTypeface[mFontIndex], style));
|
||||||
|
if (shortCut != 0) {
|
||||||
|
item.setAlphabeticShortcut(shortCut);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private MenuItem.OnMenuItemClickListener mFlagClickListener = new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
int mask = item.getItemId();
|
||||||
|
mColumn1.setPaintFlags(mColumn1.getPaintFlags() ^ mask);
|
||||||
|
mColumn2.setPaintFlags(mColumn2.getPaintFlags() ^ mask);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private
|
||||||
|
void addFlagMenu(Menu menu, int paintFlag, String label, char shortCut) {
|
||||||
|
MenuItem item = menu.add(0, paintFlag, 0, label);
|
||||||
|
item.setCheckable(true);
|
||||||
|
item.setOnMenuItemClickListener(mFlagClickListener);
|
||||||
|
item.setChecked((mColumn1.getPaintFlags() & paintFlag) != 0);
|
||||||
|
if (shortCut != 0) {
|
||||||
|
item.setAlphabeticShortcut(shortCut);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addListenerMenu(MenuItem item,
|
||||||
|
MenuItem.OnMenuItemClickListener listener,
|
||||||
|
char keyChar) {
|
||||||
|
item.setOnMenuItemClickListener(listener);
|
||||||
|
if (keyChar != '\0') {
|
||||||
|
item.setAlphabeticShortcut(keyChar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
menu.clear();
|
||||||
|
|
||||||
|
addFontMenu(menu, FONT_INDEX_SANS);
|
||||||
|
addFontMenu(menu, FONT_INDEX_SERIF);
|
||||||
|
addFontMenu(menu, FONT_INDEX_MONO);
|
||||||
|
addStyleMenu(menu, Typeface.BOLD, 'b');
|
||||||
|
addStyleMenu(menu, Typeface.ITALIC, 'i');
|
||||||
|
addFlagMenu(menu, Paint.DEV_KERN_TEXT_FLAG, "DevKern", 'k');
|
||||||
|
menu.add(0, 0, 0, "Text").setOnMenuItemClickListener(mTextCallback).setAlphabeticShortcut('t');
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode,
|
||||||
|
String data, Map extras) {
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
|
switch (requestCode) {
|
||||||
|
case BACKGROUND_PICKED:
|
||||||
|
{
|
||||||
|
int color = ((Integer)extras.get("text")).intValue();
|
||||||
|
mColumn1.setTextColor(color);
|
||||||
|
mColumn2.setTextColor(color);
|
||||||
|
|
||||||
|
int colorTranslucent = (color & 0x00FFFFFF) + 0x77000000;
|
||||||
|
|
||||||
|
setTitleColor(color);
|
||||||
|
|
||||||
|
Integer texture = (Integer)extras.get("texture");
|
||||||
|
if (texture != null) {
|
||||||
|
mContentView.setBackgroundResource(texture.intValue());
|
||||||
|
} else {
|
||||||
|
color = ((Integer)extras.get("bgcolor")).intValue();
|
||||||
|
mContentView.setBackgroundColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
int size = mFontSize;
|
||||||
|
int scaleX = mTextScaleXDelta;
|
||||||
|
|
||||||
|
switch (keyCode) {
|
||||||
|
case KeyEvent.KEYCODE_DPAD_DOWN:
|
||||||
|
size -= 1;
|
||||||
|
break;
|
||||||
|
case KeyEvent.KEYCODE_DPAD_UP:
|
||||||
|
size += 1;
|
||||||
|
break;
|
||||||
|
case KeyEvent.KEYCODE_DPAD_RIGHT:
|
||||||
|
scaleX += 1;
|
||||||
|
break;
|
||||||
|
case KeyEvent.KEYCODE_DPAD_LEFT:
|
||||||
|
scaleX -= 1;
|
||||||
|
break;
|
||||||
|
/*
|
||||||
|
case KeyEvent.KEYCODE_U:
|
||||||
|
changeGamma(1);
|
||||||
|
return true;
|
||||||
|
case KeyEvent.KEYCODE_D:
|
||||||
|
changeGamma(-1);
|
||||||
|
return true;
|
||||||
|
*/
|
||||||
|
default:
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
size = Math.min(MAX_SIZE, Math.max(MIN_SIZE, size));
|
||||||
|
if (size != mFontSize) {
|
||||||
|
mFontSize = size;
|
||||||
|
mColumn1.setTextSize(mFontSize);
|
||||||
|
mColumn2.setTextSize(mFontSize);
|
||||||
|
updateTitle();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
scaleX = Math.min(MAX_SCALE_X, Math.max(MIN_SCALE_X, scaleX));
|
||||||
|
if (scaleX != mTextScaleXDelta) {
|
||||||
|
mTextScaleXDelta = scaleX;
|
||||||
|
mColumn1.setTextScaleX(1 + scaleX / SCALE_X_RANGE);
|
||||||
|
mColumn2.setTextScaleX(1 + scaleX / SCALE_X_RANGE);
|
||||||
|
updateTitle();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int mGamma = 28; // current default is 1.4 (* 20)
|
||||||
|
private void changeGamma(int delta) {
|
||||||
|
int gamma = Math.min(100, Math.max(1, mGamma + delta));
|
||||||
|
if (gamma != mGamma) {
|
||||||
|
mGamma = gamma;
|
||||||
|
updateTitle();
|
||||||
|
// Paint.setTextGamma(mGamma / 20.f);
|
||||||
|
mContentView.invalidate();
|
||||||
|
android.util.Log.d("skia", "setTextGamma " + mGamma);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setFont(TextView t, TextView f, Map extras) {
|
||||||
|
int style = ((Integer)extras.get("style")).intValue();
|
||||||
|
String font = (String)extras.get("font");
|
||||||
|
t.setTypeface(Typeface.create(font, style));
|
||||||
|
|
||||||
|
f.setText((String)extras.get("title"));
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem.OnMenuItemClickListener mTextCallback = new MenuItem.OnMenuItemClickListener() {
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
mTextIndex += 1;
|
||||||
|
updateText();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static final int BACKGROUND_PICKED = 1;
|
||||||
|
|
||||||
|
private TextView mColumn1;
|
||||||
|
private TextView mColumn2;
|
||||||
|
private View mContentView;
|
||||||
|
private int mFontIndex = FONT_INDEX_SANS;
|
||||||
|
private int mFontStyle = Typeface.NORMAL;
|
||||||
|
private int mFontSize = 18;
|
||||||
|
private int mTextIndex;
|
||||||
|
private int mTextScaleXDelta;
|
||||||
|
}
|
||||||
|
|
||||||
74
apps/FontLab/src/com/android/fontlab/FontPicker.java
Normal file
74
apps/FontLab/src/com/android/fontlab/FontPicker.java
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* 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.android.fontlab;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.SimpleAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class FontPicker extends ListActivity
|
||||||
|
{
|
||||||
|
|
||||||
|
public void onCreate(Bundle icicle)
|
||||||
|
{
|
||||||
|
super.onCreate(icicle);
|
||||||
|
|
||||||
|
setListAdapter(new SimpleAdapter(this,
|
||||||
|
getData(),
|
||||||
|
android.R.layout.simple_list_item_1,
|
||||||
|
new String[] {"title"},
|
||||||
|
new int[] {android.R.id.text1}));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List getData()
|
||||||
|
{
|
||||||
|
List myData = new ArrayList<Bundle>(7);
|
||||||
|
addItem(myData, "Sans", "sans-serif", Typeface.NORMAL);
|
||||||
|
addItem(myData, "Sans Bold", "sans-serif", Typeface.BOLD);
|
||||||
|
addItem(myData, "Serif", "serif", Typeface.NORMAL);
|
||||||
|
addItem(myData, "Serif Bold", "serif", Typeface.BOLD);
|
||||||
|
addItem(myData, "Serif Italic", "serif", Typeface.ITALIC);
|
||||||
|
addItem(myData, "Serif Bold Italic", "serif", Typeface.BOLD_ITALIC);
|
||||||
|
addItem(myData, "Mono", "monospace", Typeface.NORMAL);
|
||||||
|
return myData;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addItem(List<Bundle> data, String name, String fontName, int style)
|
||||||
|
{
|
||||||
|
Bundle temp = new Bundle();
|
||||||
|
temp.putString("title", name);
|
||||||
|
temp.putString("font", fontName);
|
||||||
|
temp.putInt("style", style);
|
||||||
|
data.add(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onListItemClick(ListView l, View v, int position, long id)
|
||||||
|
{
|
||||||
|
Bundle map = (Bundle) l.getItemAtPosition(position);
|
||||||
|
setResult(RESULT_OK, (new Intent()).putExtras(map));
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
13
apps/OBJViewer/Android.mk
Normal file
13
apps/OBJViewer/Android.mk
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := tests
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||||
|
|
||||||
|
LOCAL_PACKAGE_NAME := OBJViewer
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := tests
|
||||||
|
|
||||||
|
# currently disabled because of API changes. won't be fixed for 1.0
|
||||||
|
#include $(BUILD_PACKAGE)
|
||||||
10
apps/OBJViewer/AndroidManifest.xml
Normal file
10
apps/OBJViewer/AndroidManifest.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.objviewer">
|
||||||
|
<application>
|
||||||
|
<activity android:name="OBJViewer" android:label="3D .obj File Viewer">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.TEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
0
apps/OBJViewer/MODULE_LICENSE_APACHE2
Normal file
0
apps/OBJViewer/MODULE_LICENSE_APACHE2
Normal file
190
apps/OBJViewer/NOTICE
Normal file
190
apps/OBJViewer/NOTICE
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
|
||||||
|
Copyright (c) 2005-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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
BIN
apps/OBJViewer/assets/al.gles
Normal file
BIN
apps/OBJViewer/assets/al.gles
Normal file
Binary file not shown.
BIN
apps/OBJViewer/assets/apple.gles
Normal file
BIN
apps/OBJViewer/assets/apple.gles
Normal file
Binary file not shown.
BIN
apps/OBJViewer/assets/dolphins.gles
Normal file
BIN
apps/OBJViewer/assets/dolphins.gles
Normal file
Binary file not shown.
BIN
apps/OBJViewer/assets/earth.raw
Normal file
BIN
apps/OBJViewer/assets/earth.raw
Normal file
Binary file not shown.
BIN
apps/OBJViewer/assets/f16.gles
Normal file
BIN
apps/OBJViewer/assets/f16.gles
Normal file
Binary file not shown.
BIN
apps/OBJViewer/assets/flowers.gles
Normal file
BIN
apps/OBJViewer/assets/flowers.gles
Normal file
Binary file not shown.
BIN
apps/OBJViewer/assets/porsche.gles
Normal file
BIN
apps/OBJViewer/assets/porsche.gles
Normal file
Binary file not shown.
BIN
apps/OBJViewer/assets/rosevase.gles
Normal file
BIN
apps/OBJViewer/assets/rosevase.gles
Normal file
Binary file not shown.
BIN
apps/OBJViewer/assets/shuttle.gles
Normal file
BIN
apps/OBJViewer/assets/shuttle.gles
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user