diff --git a/apps/Development/AndroidManifest.xml b/apps/Development/AndroidManifest.xml
index dd31b85a0..9c6b92b28 100644
--- a/apps/Development/AndroidManifest.xml
+++ b/apps/Development/AndroidManifest.xml
@@ -20,7 +20,6 @@
-
@@ -30,6 +29,7 @@
+
+
+
+
+
+
+
@@ -103,5 +111,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/Development/res/layout/application_hw_pref.xml b/apps/Development/res/layout/application_hw_pref.xml
new file mode 100755
index 000000000..859c7ab21
--- /dev/null
+++ b/apps/Development/res/layout/application_hw_pref.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/Development/res/layout/development_settings.xml b/apps/Development/res/layout/development_settings.xml
index 86fedcf4e..048674816 100644
--- a/apps/Development/res/layout/development_settings.xml
+++ b/apps/Development/res/layout/development_settings.xml
@@ -48,17 +48,10 @@
android:layout_alignParentLeft="true"
android:text="@string/development_settings_wait_for_debugger_text" />
-
-
-
-
diff --git a/apps/Development/res/layout/gls_tester.xml b/apps/Development/res/layout/gls_tester.xml
index b6dc86946..fbd4549de 100644
--- a/apps/Development/res/layout/gls_tester.xml
+++ b/apps/Development/res/layout/gls_tester.xml
@@ -4,9 +4,9 @@
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.
@@ -37,14 +37,34 @@
android:layout_height="wrap_content"
android:text="@string/gls_tester_require_google"/>
+
+
+
+
+
+
diff --git a/apps/Development/res/layout/process_info.xml b/apps/Development/res/layout/process_info.xml
new file mode 100755
index 000000000..b25f223e1
--- /dev/null
+++ b/apps/Development/res/layout/process_info.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/Development/res/values/strings.xml b/apps/Development/res/values/strings.xml
index 878e95f76..8d343ae70 100644
--- a/apps/Development/res/values/strings.xml
+++ b/apps/Development/res/values/strings.xml
@@ -21,10 +21,10 @@
Upload Exceptions
Clear Exceptions
- unknown
- Uptime
- Awake Time
- Asleep Time
+ unknown
+ Uptime
+ Awake Time
+ Asleep Time
Build ID
Build Date
@@ -78,7 +78,7 @@
Show running processes
Show screen updates
Enable OpenGL ES (reboot needed)
- Enable ADB
+ Allow mock locations for testing
Wait for debugger
Show background
Show GTalk service connection status
@@ -105,11 +105,22 @@
End Button Behavior
GLS Tester
- Prefer Hosted
- Require Google
+ Hosted
+ Google
+ List
Clear
+ Go
Notify on failure
Run intent
Wipe passwords
+ Process Name:
+ Packages in process:
+ Package Name:
+
+ touchscreen:
+ inputMethod:
+ hardKeyboard:
+ navigation:
+ five way nav:
diff --git a/apps/Development/src/com/android/development/AppHwConfigList.java b/apps/Development/src/com/android/development/AppHwConfigList.java
new file mode 100755
index 000000000..52aff0dfd
--- /dev/null
+++ b/apps/Development/src/com/android/development/AppHwConfigList.java
@@ -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 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();
+ }
+ 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 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;
+}
+
diff --git a/apps/Development/src/com/android/development/AppHwPref.java b/apps/Development/src/com/android/development/AppHwPref.java
new file mode 100644
index 000000000..bf0f84fa3
--- /dev/null
+++ b/apps/Development/src/com/android/development/AppHwPref.java
@@ -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 list = new HashSet();
+ 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();
+ }
+}
+
diff --git a/apps/Development/src/com/android/development/DevelopmentSettings.java b/apps/Development/src/com/android/development/DevelopmentSettings.java
index 03536bbe7..cdc1e0a27 100644
--- a/apps/Development/src/com/android/development/DevelopmentSettings.java
+++ b/apps/Development/src/com/android/development/DevelopmentSettings.java
@@ -49,7 +49,6 @@ public class DevelopmentSettings extends Activity {
private static final int DEBUG_APP_REQUEST = 1;
private Button mDebugAppButton;
- private CheckBox mEnableAdbCB;
private CheckBox mWaitForDebuggerCB;
private CheckBox mAlwaysFinishCB;
private CheckBox mShowLoadCB;
@@ -59,7 +58,6 @@ public class DevelopmentSettings extends Activity {
private CheckBox mShowBackgroundCB;
private CheckBox mShowSleepCB;
private CheckBox mShowMapsCompassCB;
- private CheckBox mKeepScreenOnCB;
private CheckBox mShowXmppCB;
private Spinner mMaxProcsSpinner;
private Spinner mWindowAnimationScaleSpinner;
@@ -67,13 +65,11 @@ public class DevelopmentSettings extends Activity {
private Spinner mFontHintingSpinner;
private String mDebugApp;
- private boolean mEnableAdb;
private boolean mWaitForDebugger;
private boolean mAlwaysFinish;
private int mProcessLimit;
private boolean mShowSleep;
private boolean mShowMapsCompass;
- private boolean mKeepScreenOn;
private boolean mShowXmpp;
private AnimationScaleSelectedListener mWindowAnimationScale
= new AnimationScaleSelectedListener(0);
@@ -93,8 +89,6 @@ public class DevelopmentSettings extends Activity {
mDebugAppButton = (Button)findViewById(R.id.debug_app);
mDebugAppButton.setOnClickListener(mDebugAppClicked);
- mEnableAdbCB = (CheckBox)findViewById(R.id.enable_adb);
- mEnableAdbCB.setOnClickListener(mEnableAdbClicked);
mWaitForDebuggerCB = (CheckBox)findViewById(R.id.wait_for_debugger);
mWaitForDebuggerCB.setOnClickListener(mWaitForDebuggerClicked);
mAlwaysFinishCB = (CheckBox)findViewById(R.id.always_finish);
@@ -114,8 +108,6 @@ public class DevelopmentSettings extends Activity {
mShowSleepCB.setOnClickListener(mShowSleepClicked);
mShowMapsCompassCB = (CheckBox)findViewById(R.id.show_maps_compass);
mShowMapsCompassCB.setOnClickListener(mShowMapsCompassClicked);
- mKeepScreenOnCB = (CheckBox)findViewById(R.id.keep_screen_on);
- mKeepScreenOnCB.setOnClickListener(mKeepScreenOnClicked);
mShowXmppCB = (CheckBox)findViewById(R.id.show_xmpp);
mShowXmppCB.setOnClickListener(mShowXmppClicked);
mMaxProcsSpinner = (Spinner)findViewById(R.id.max_procs);
@@ -181,7 +173,6 @@ public class DevelopmentSettings extends Activity {
updateFlingerOptions();
updateSleepOptions();
updateMapsCompassOptions();
- updateKeepScreenOnOptions();
updateXmppOptions();
try {
@@ -210,13 +201,10 @@ public class DevelopmentSettings extends Activity {
getContentResolver(), Settings.System.DEBUG_APP);
mWaitForDebugger = Settings.System.getInt(
getContentResolver(), Settings.System.WAIT_FOR_DEBUGGER, 0) != 0;
- mEnableAdb = Settings.System.getInt(
- getContentResolver(), Settings.System.ADB_ENABLED, 0) != 0;
mDebugAppButton.setText(
mDebugApp == null || mDebugApp.length() == 0 ? "(none)" : mDebugApp);
mWaitForDebuggerCB.setChecked(mWaitForDebugger);
- mEnableAdbCB.setChecked(mEnableAdb);
}
private void writeFinishOptions() {
@@ -330,17 +318,6 @@ public class DevelopmentSettings extends Activity {
mShowMapsCompassCB.setChecked(mShowMapsCompass);
}
- private void writeKeepScreenOnOptions() {
- Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN,
- mKeepScreenOn ? 1 : 0);
- }
-
- private void updateKeepScreenOnOptions() {
- mKeepScreenOn = Settings.System.getInt(getContentResolver(),
- Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0;
- mKeepScreenOnCB.setChecked(mKeepScreenOn);
- }
-
private void writeXmppOptions() {
Settings.System.setShowGTalkServiceStatus(getContentResolver(), mShowXmpp);
}
@@ -367,13 +344,6 @@ public class DevelopmentSettings extends Activity {
}
}
- private View.OnClickListener mEnableAdbClicked = new View.OnClickListener() {
- public void onClick(View v) {
- Settings.System.putInt(getContentResolver(), Settings.System.ADB_ENABLED,
- ((CheckBox)v).isChecked() ? 1 : 0);
- }
- };
-
private View.OnClickListener mWaitForDebuggerClicked =
new View.OnClickListener() {
public void onClick(View v) {
@@ -450,15 +420,6 @@ public class DevelopmentSettings extends Activity {
};
- private View.OnClickListener mKeepScreenOnClicked =
- new View.OnClickListener() {
- public void onClick(View v) {
- mKeepScreenOn = ((CheckBox)v).isChecked();
- writeKeepScreenOnOptions();
- updateKeepScreenOnOptions();
- }
- };
-
private View.OnClickListener mShowXmppClicked = new View.OnClickListener() {
public void onClick(View v) {
mShowXmpp = ((CheckBox)v).isChecked();
diff --git a/apps/Development/src/com/android/development/EnterURL.java b/apps/Development/src/com/android/development/EnterURL.java
index 72f58de82..76b8a34c5 100644
--- a/apps/Development/src/com/android/development/EnterURL.java
+++ b/apps/Development/src/com/android/development/EnterURL.java
@@ -24,9 +24,9 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Bundle;
-import android.pim.DateUtils;
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;
diff --git a/apps/Development/src/com/android/development/GLSTester.java b/apps/Development/src/com/android/development/GLSTester.java
index 57b812083..4995b4d04 100644
--- a/apps/Development/src/com/android/development/GLSTester.java
+++ b/apps/Development/src/com/android/development/GLSTester.java
@@ -27,12 +27,13 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
-import android.os.RemoteException;
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;
/**
@@ -52,12 +53,10 @@ public class GLSTester extends Activity {
CheckBox mDoNotify = null;
CheckBox mRunIntent = null;
Spinner mService = null;
+ EditText mUsernameEdit = null;
private class Listener implements View.OnClickListener {
- private boolean mRequireGoogle;
-
- public Listener(boolean requireGoogle) {
- mRequireGoogle = requireGoogle;
+ public Listener() {
}
public void onClick(View v) {
@@ -69,7 +68,10 @@ public class GLSTester extends Activity {
String service = (String) mService.getSelectedItem();
mText.append("service: " + service + "\n");
- String account = mGls.getAccount(mRequireGoogle);
+ String account = mUsernameEdit.getText().toString();
+ if (account.length() == 0) {
+ account = null;
+ }
mText.append("account: " + account + "\n");
GoogleLoginCredentialsResult result =
mGls.blockingGetCredentials(account, service, mDoNotify.isChecked());
@@ -120,6 +122,8 @@ public class GLSTester extends Activity {
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);
@@ -127,11 +131,47 @@ public class GLSTester extends Activity {
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 Listener(GoogleLoginServiceConstants.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 Listener(GoogleLoginServiceConstants.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() {
@@ -139,6 +179,9 @@ public class GLSTester extends Activity {
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) {
diff --git a/apps/Development/src/com/android/development/ProcessInfo.java b/apps/Development/src/com/android/development/ProcessInfo.java
new file mode 100755
index 000000000..5ece1a446
--- /dev/null
+++ b/apps/Development/src/com/android/development/ProcessInfo.java
@@ -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();
+ }
+}
+
diff --git a/apps/Development/src/com/android/development/RadioIssueReport.java b/apps/Development/src/com/android/development/RadioIssueReport.java
index e1d1ec880..b1a95f414 100644
--- a/apps/Development/src/com/android/development/RadioIssueReport.java
+++ b/apps/Development/src/com/android/development/RadioIssueReport.java
@@ -19,11 +19,11 @@ package com.android.development;
import android.app.Activity;
import android.os.Bundle;
import android.os.SystemProperties;
-import android.pim.DateFormat;
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;
diff --git a/apps/Development/src/com/android/development/RunningProcesses.java b/apps/Development/src/com/android/development/RunningProcesses.java
new file mode 100755
index 000000000..7b56be90b
--- /dev/null
+++ b/apps/Development/src/com/android/development/RunningProcesses.java
@@ -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 appList = am.getRunningAppProcesses();
+ for (ActivityManager.RunningAppProcessInfo app : appList) {
+ if(mList == null) {
+ mList = new ArrayList();
+ }
+ 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 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;
+}
+
diff --git a/apps/Fallback/res/values-de-rDE/strings.xml b/apps/Fallback/res/values-de-rDE/strings.xml
deleted file mode 100644
index e7256ef46..000000000
--- a/apps/Fallback/res/values-de-rDE/strings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- Rückgriff
- Dieser Vorgang wird derzeit nicht unterstützt.
- Nicht unterstützter Vorgang
-
diff --git a/apps/Fallback/res/values-de/strings.xml b/apps/Fallback/res/values-de/strings.xml
new file mode 100644
index 000000000..0889ced7f
--- /dev/null
+++ b/apps/Fallback/res/values-de/strings.xml
@@ -0,0 +1,7 @@
+
+
+ "Fallback"
+ "Nicht unterstützte Aktion"
+ "Diese Aktion wird zurzeit nicht unterstützt."
+
diff --git a/apps/Fallback/res/values-es-rUS/strings.xml b/apps/Fallback/res/values-es-rUS/strings.xml
deleted file mode 100644
index 028a9ac10..000000000
--- a/apps/Fallback/res/values-es-rUS/strings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- Seguridad
- En estos momentos, la acción no es compatible.
- Acción no compatible
-
diff --git a/apps/Fallback/res/values-fr-rFR/strings.xml b/apps/Fallback/res/values-fr-rFR/strings.xml
deleted file mode 100644
index 70fc6f1ae..000000000
--- a/apps/Fallback/res/values-fr-rFR/strings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- Secours
- Cette action n\'est pas actuellement prise en charge.
- Action non prise en charge
-
diff --git a/apps/Fallback/res/values-it-rIT/strings.xml b/apps/Fallback/res/values-it-rIT/strings.xml
deleted file mode 100644
index 939094968..000000000
--- a/apps/Fallback/res/values-it-rIT/strings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- Fallback
- L'azione non è attualmente supportata.
- Azione non supportata
-
diff --git a/apps/Fallback/res/values-ja/strings.xml b/apps/Fallback/res/values-ja/strings.xml
new file mode 100644
index 000000000..6629b3385
--- /dev/null
+++ b/apps/Fallback/res/values-ja/strings.xml
@@ -0,0 +1,7 @@
+
+
+ "Fallback"
+ "サポートされていない操作"
+ "現在サポートされていない操作です。"
+
diff --git a/apps/Fallback/res/values-zh-rTW/strings.xml b/apps/Fallback/res/values-zh-rTW/strings.xml
deleted file mode 100644
index 84a5abdc5..000000000
--- a/apps/Fallback/res/values-zh-rTW/strings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- 還原
- 目前不支援此動作。
- 不支援的動作
-
diff --git a/apps/Fallback/res/values/strings.xml b/apps/Fallback/res/values/strings.xml
index d41ffd272..bc0b71d3b 100644
--- a/apps/Fallback/res/values/strings.xml
+++ b/apps/Fallback/res/values/strings.xml
@@ -15,7 +15,11 @@
-->
+
Fallback
+
Unsupported action
+
That action is not currently supported.
diff --git a/apps/SdkSetup/Android.mk b/apps/SdkSetup/Android.mk
index daab48d43..b89baaf8f 100644
--- a/apps/SdkSetup/Android.mk
+++ b/apps/SdkSetup/Android.mk
@@ -1,7 +1,7 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := samples
+LOCAL_MODULE_TAGS := foo
LOCAL_SRC_FILES := $(call all-subdir-java-files)
diff --git a/apps/SdkSetup/AndroidManifest.xml b/apps/SdkSetup/AndroidManifest.xml
index 9bb292c64..9cd20a82d 100644
--- a/apps/SdkSetup/AndroidManifest.xml
+++ b/apps/SdkSetup/AndroidManifest.xml
@@ -17,8 +17,8 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/SpareParts/res/drawable/app_icon.png b/apps/SpareParts/res/drawable/app_icon.png
new file mode 100644
index 000000000..cb40a1988
Binary files /dev/null and b/apps/SpareParts/res/drawable/app_icon.png differ
diff --git a/apps/SpareParts/res/layout/spare_parts.xml b/apps/SpareParts/res/layout/spare_parts.xml
new file mode 100644
index 000000000..f39298b4e
--- /dev/null
+++ b/apps/SpareParts/res/layout/spare_parts.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/SpareParts/res/values/arrays.xml b/apps/SpareParts/res/values/arrays.xml
new file mode 100644
index 000000000..e6026dac2
--- /dev/null
+++ b/apps/SpareParts/res/values/arrays.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+ - Off
+ - Fast
+ - Normal
+ - Slow
+ - Very Slow
+
+
+
+ - 0.0
+ - 0.5
+ - 1.0
+ - 1.5
+ - 2.0
+
+
+
+ - Extremely Small
+ - Extra Small
+ - Small
+ - Normal
+ - Large
+ - Extra Large
+ - Extremely Large
+
+
+
+ - 0.70
+ - 0.85
+ - 0.95
+ - 1.0
+ - 1.05
+ - 1.15
+ - 1.30
+
+
+
+ - Nothing
+ - Go to home
+ - Go to sleep
+ - Home, then sleep
+
+
+
+ - 0
+ - 1
+ - 2
+ - 3
+
+
diff --git a/apps/SpareParts/res/values/strings.xml b/apps/SpareParts/res/values/strings.xml
new file mode 100644
index 000000000..8565a52ef
--- /dev/null
+++ b/apps/SpareParts/res/values/strings.xml
@@ -0,0 +1,52 @@
+
+
+
+ Spare Parts
+
+ General
+
+ Window animations
+ Speed of animations in individual windows
+ Select window speed
+
+ Transition animations
+ Speed of animations moving between screens
+ Select transition speed
+
+ Font size
+ Overall size of fonts
+ Select font size
+
+ End button behavior
+ Select End (red) button action
+ Select End button
+
+ Display rotation
+ Display rotates from orientation
+ Display rotates when lid is open
+
+ Applications
+
+ Show compass in Maps
+ Compass is displayed in Maps
+ Compass is not displayed in Maps
+
+ Show compass in Maps
+
diff --git a/apps/SpareParts/res/xml/spare_parts.xml b/apps/SpareParts/res/xml/spare_parts.xml
new file mode 100644
index 000000000..ce673e340
--- /dev/null
+++ b/apps/SpareParts/res/xml/spare_parts.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/SpareParts/src/com/android/spare_parts/SpareParts.java b/apps/SpareParts/src/com/android/spare_parts/SpareParts.java
new file mode 100644
index 000000000..9de9a457c
--- /dev/null
+++ b/apps/SpareParts/src/com/android/spare_parts/SpareParts.java
@@ -0,0 +1,207 @@
+/* //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.spare_parts;
+
+import android.app.ActivityManagerNative;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Configuration;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceScreen;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.IWindowManager;
+
+public class SpareParts extends PreferenceActivity
+ implements Preference.OnPreferenceChangeListener,
+ SharedPreferences.OnSharedPreferenceChangeListener {
+ private static final String TAG = "SpareParts";
+
+ private static final String WINDOW_ANIMATIONS_PREF = "window_animations";
+ private static final String TRANSITION_ANIMATIONS_PREF = "transition_animations";
+ private static final String FONT_SIZE_PREF = "font_size";
+ private static final String END_BUTTON_PREF = "end_button";
+ private static final String ACCELEROMETER_PREF = "accelerometer";
+ private static final String MAPS_COMPASS_PREF = "maps_compass";
+
+ private final Configuration mCurConfig = new Configuration();
+
+ private ListPreference mWindowAnimationsPref;
+ private ListPreference mTransitionAnimationsPref;
+ private ListPreference mFontSizePref;
+ private ListPreference mEndButtonPref;
+ private CheckBoxPreference mAccelerometerPref;
+ private CheckBoxPreference mShowMapsCompassPref;
+
+ private IWindowManager mWindowManager;
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ addPreferencesFromResource(R.xml.spare_parts);
+
+ PreferenceScreen prefSet = getPreferenceScreen();
+
+ mWindowAnimationsPref = (ListPreference) prefSet.findPreference(WINDOW_ANIMATIONS_PREF);
+ mWindowAnimationsPref.setOnPreferenceChangeListener(this);
+ mTransitionAnimationsPref = (ListPreference) prefSet.findPreference(TRANSITION_ANIMATIONS_PREF);
+ mTransitionAnimationsPref.setOnPreferenceChangeListener(this);
+ mFontSizePref = (ListPreference) prefSet.findPreference(FONT_SIZE_PREF);
+ mFontSizePref.setOnPreferenceChangeListener(this);
+ mEndButtonPref = (ListPreference) prefSet.findPreference(END_BUTTON_PREF);
+ mEndButtonPref.setOnPreferenceChangeListener(this);
+ mAccelerometerPref = (CheckBoxPreference) prefSet.findPreference(ACCELEROMETER_PREF);
+ mShowMapsCompassPref = (CheckBoxPreference) prefSet.findPreference(MAPS_COMPASS_PREF);
+
+ mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
+
+ getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
+ }
+
+ private void updateToggles() {
+ try {
+ mAccelerometerPref.setChecked(Settings.System.getInt(
+ getContentResolver(),
+ Settings.System.ACCELEROMETER_ROTATION, 0) != 0);
+ Context c = createPackageContext("com.google.android.apps.maps", 0);
+ mShowMapsCompassPref.setChecked(c.getSharedPreferences("extra-features", MODE_WORLD_READABLE)
+ .getBoolean("compass", false));
+ } catch (NameNotFoundException e) {
+ Log.w(TAG, "Failed reading maps compass");
+ e.printStackTrace();
+ }
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object objValue) {
+ if (preference == mWindowAnimationsPref) {
+ writeAnimationPreference(0, objValue);
+ } else if (preference == mTransitionAnimationsPref) {
+ writeAnimationPreference(1, objValue);
+ } else if (preference == mFontSizePref) {
+ writeFontSizePreference(objValue);
+ } else if (preference == mEndButtonPref) {
+ writeEndButtonPreference(objValue);
+ }
+
+ // always let the preference setting proceed.
+ return true;
+ }
+
+ public void writeAnimationPreference(int which, Object objValue) {
+ try {
+ float val = Float.parseFloat(objValue.toString());
+ mWindowManager.setAnimationScale(which, val);
+ } catch (NumberFormatException e) {
+ } catch (RemoteException e) {
+ }
+ }
+
+ public void writeFontSizePreference(Object objValue) {
+ try {
+ mCurConfig.fontScale = Float.parseFloat(objValue.toString());
+ ActivityManagerNative.getDefault().updateConfiguration(mCurConfig);
+ } catch (RemoteException e) {
+ }
+ }
+
+ public void writeEndButtonPreference(Object objValue) {
+ try {
+ int val = Integer.parseInt(objValue.toString());
+ Settings.System.putInt(getContentResolver(),
+ Settings.System.END_BUTTON_BEHAVIOR, val);
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ int floatToIndex(float val, int resid) {
+ String[] indices = getResources().getStringArray(resid);
+ float lastVal = Float.parseFloat(indices[0]);
+ for (int i=1; i
-
+ android:label="@string/application_terminal">
+
diff --git a/apps/Term/res/menu/main.xml b/apps/Term/res/menu/main.xml
new file mode 100644
index 000000000..5f6e9d808
--- /dev/null
+++ b/apps/Term/res/menu/main.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
diff --git a/apps/Term/res/values/arrays.xml b/apps/Term/res/values/arrays.xml
new file mode 100644
index 000000000..b4857a2ea
--- /dev/null
+++ b/apps/Term/res/values/arrays.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+ - 4 x 8 pixels
+ - 6 pt
+ - 7 pt
+ - 8 pt
+ - 9 pt
+ - 10 pt
+ - 12 pt
+ - 14 pt
+ - 16 pt
+ - 20 pt
+
+
+
+
+ - 0
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
+ - 12
+ - 14
+ - 16
+ - 20
+
+
+
+ - Black text on white
+ - White text on black
+ - White text on blue
+
+
+
+
+ - 0
+ - 1
+ - 2
+
+
+
+ - Jog ball
+ - \@ key
+ - Left Alt key
+ - Right Alt key
+
+
+
+
+ - 0
+ - 1
+ - 2
+ - 3
+
+
diff --git a/apps/Term/res/values/strings.xml b/apps/Term/res/values/strings.xml
new file mode 100644
index 000000000..e3f8fcf91
--- /dev/null
+++ b/apps/Term/res/values/strings.xml
@@ -0,0 +1,55 @@
+
+
+
+ Terminal Emulator
+ Preferences
+ Reset term
+ Email to
+ Special keys
+
+
+ Text
+
+ Font size
+ Choose character height in pixels.
+ Font size
+
+ Colors
+ Choose text color.
+ Text color
+
+ Keyboard
+ Control key
+ Choose control key.
+ Control key
+
+ Shell
+ Command line
+ Specify the shell command line.
+ Shell
+
+ Initial command
+ Sent to the shell when it starts.
+ Initial Command
+
+
+ 10
+ 2
+ 0
+ /system/bin/sh -
+ export PATH=/data/local/bin:$PATH
+
diff --git a/apps/Term/res/xml/preferences.xml b/apps/Term/res/xml/preferences.xml
new file mode 100644
index 000000000..779215325
--- /dev/null
+++ b/apps/Term/res/xml/preferences.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/Term/src/com/android/term/Term.java b/apps/Term/src/com/android/term/Term.java
index 61e85e946..b3bb7eef1 100644
--- a/apps/Term/src/com/android/term/Term.java
+++ b/apps/Term/src/com/android/term/Term.java
@@ -20,16 +20,13 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.ColorMatrix;
-import android.graphics.LightingColorFilter;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.PorterDuff;
@@ -50,14 +47,13 @@ import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
-import android.view.SubMenu;
import android.view.View;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.util.Map;
+import java.util.ArrayList;
/**
* A terminal emulator activity.
@@ -65,12 +61,6 @@ import java.util.Map;
public class Term extends Activity {
- /**
- * Set to true to configure a test mode where the terminal emulator talks
- * directly to a test application, rather than to a shell.
- */
- public static final boolean TEST_MODE = false;
-
/**
* Set to true to log each character received from the remote process to the
* android log, which makes it easier to debug some kinds of problems with
@@ -99,6 +89,8 @@ public class Term extends Activity {
*/
private FileDescriptor mTermFd;
+ private boolean mShellRunning;
+
/**
* Used to send data to the remote process.
*/
@@ -110,117 +102,262 @@ public class Term extends Activity {
*/
private TermKeyListener mKeyListener;
- private boolean mWhiteOnBlue = true;
-
- private float mRotation;
-
/**
* The name of our emulator view in the view resource.
*/
private static final int EMULATOR_VIEW = R.id.emulatorView;
- // Menu IDs:
+ private int mFontSize = 9;
+ private int mColorId = 2;
+ private int mControlKeyId = 0;
- private static final int MENU_GROUP_NONE = Menu.FIRST;
- private static final int MENU_SCREEN_SIZE_ID = 0;
- private static final int MENU_SCREEN_SIZE_ITEM_ID = 1;
- private static final int MENU_SCREEN_SIZE_ITEM_COUNT = 10;
- private static final int MENU_SCREEN_SIZE_ITEM_ID_END =
- MENU_SCREEN_SIZE_ITEM_ID + MENU_SCREEN_SIZE_ITEM_COUNT;
-
- private static final int MENU_WHITE_ON_BLUE_ID =
- MENU_SCREEN_SIZE_ITEM_ID_END;
- private static final int MENU_RESET_TERMINAL_ID =
- MENU_SCREEN_SIZE_ITEM_ID_END + 1;
- private static final int MENU_EMAIL_TRANSCRIPT_ID =
- MENU_SCREEN_SIZE_ITEM_ID_END + 2;
-
- private static final int MENU_DOCUMENT_KEYS_ID =
- MENU_EMAIL_TRANSCRIPT_ID + 1;
-
- private static final String[] MENU_SCREEN_SIZE_LABELS = {
- "4 x 8", "6 pt", "7 pt", "8 pt", "9 pt", "10 pt", "12 pt",
- "14 pt", "16 pt", "20 pt"};
-
- private static final int[] TEXT_SIZE = {0, 6, 7, 8, 9, 10, 12, 14, 16, 20};
-
- private int mFontSelection = 3;
-
- private static final String FONT_SELECTION_KEY = "font selection";
- private static final String ROTATION_KEY = "rotation";
- private static final String WHITE_ON_BLUE_KEY = "whiteOnBlue";
+ private static final String FONTSIZE_KEY = "fontsize";
+ private static final String COLOR_KEY = "color";
+ private static final String CONTROLKEY_KEY = "controlkey";
+ private static final String SHELL_KEY = "shell";
+ private static final String INITIALCOMMAND_KEY = "initialcommand";
public static final int WHITE = 0xffffffff;
public static final int BLACK = 0xff000000;
public static final int BLUE = 0xff344ebd;
+ private static final int[][] COLOR_SCHEMES = {
+ {BLACK, WHITE}, {WHITE, BLACK}, {WHITE, BLUE}};
+
+ private static final int[] CONTROL_KEY_SCHEMES = {
+ KeyEvent.KEYCODE_DPAD_CENTER,
+ KeyEvent.KEYCODE_AT,
+ KeyEvent.KEYCODE_ALT_LEFT,
+ KeyEvent.KEYCODE_ALT_RIGHT
+ };
+ private static final String[] CONTROL_KEY_NAME = {
+ "Ball", "@", "Left-Alt", "Right-Alt"
+ };
+
+ private int mControlKeyCode;
+
+ private final static String DEFAULT_SHELL = "/system/bin/sh -";
+ private String mShell;
+
+ private final static String DEFAULT_INITIAL_COMMAND =
+ "export PATH=/data/local/bin:$PATH";
+ private String mInitialCommand;
+
private SharedPreferences mPrefs;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Log.e(Term.LOG_TAG, "onCreate");
+ mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
+ mPrefs.registerOnSharedPreferenceChangeListener(
+ new SharedPreferences.OnSharedPreferenceChangeListener(){
+
+ public void onSharedPreferenceChanged(
+ SharedPreferences sharedPreferences, String key) {
+ readPrefs();
+ updatePrefs();
+ }});
+ readPrefs();
setContentView(R.layout.term_activity);
mEmulatorView = (EmulatorView) findViewById(EMULATOR_VIEW);
+ startListening();
+
+ mKeyListener = new TermKeyListener();
+
+ updatePrefs();
+ }
+
+ private void startListening() {
int[] processId = new int[1];
- if (TEST_MODE) {
- // This is a vt100 test suite.
- mTermFd = Exec.createSubprocess("/sbin/vttest", null, null);
- } else {
- // This is the standard Android shell.
- mTermFd = Exec.createSubprocess("/system/bin/sh", "-", null,
- processId);
- }
+ createSubprocess(processId);
+ mShellRunning = true;
final int procId = processId[0];
- final Term me = this;
final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
- me.finish();
+ mShellRunning = false;
}
};
Runnable watchForDeath = new Runnable() {
public void run() {
- Log.e(Term.LOG_TAG, "waiting for: " + procId);
+ Log.i(Term.LOG_TAG, "waiting for: " + procId);
int result = Exec.waitFor(procId);
- Log.e(Term.LOG_TAG, "Subprocess exited: " + result);
- handler.sendEmptyMessage(0);
+ Log.i(Term.LOG_TAG, "Subprocess exited: " + result);
+ handler.sendEmptyMessage(result);
}
};
Thread watcher = new Thread(watchForDeath);
watcher.start();
- mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
- mFontSelection = mPrefs.getInt(FONT_SELECTION_KEY, mFontSelection);
- mWhiteOnBlue = mPrefs.getBoolean(WHITE_ON_BLUE_KEY, mWhiteOnBlue);
- mRotation = mPrefs.getFloat(ROTATION_KEY, mRotation);
-
mTermOut = new FileOutputStream(mTermFd);
mEmulatorView.initialize(mTermFd, mTermOut);
- mEmulatorView.setTextSize(TEXT_SIZE[mFontSelection]);
- mEmulatorView.setRotation(mRotation);
- setColors();
- mKeyListener = new TermKeyListener();
+ sendInitialCommand();
+ }
+
+ private void sendInitialCommand() {
+ String initialCommand = mInitialCommand;
+ if (initialCommand == null) {
+ initialCommand = DEFAULT_INITIAL_COMMAND;
+ }
+ if (initialCommand.length() > 0) {
+ write(initialCommand + '\r');
+ }
+ }
+
+ private void restart() {
+ startActivity(getIntent());
+ finish();
+ }
+
+ private void write(String data) {
+ try {
+ mTermOut.write(data.getBytes());
+ mTermOut.flush();
+ } catch (IOException e) {
+ // Ignore exception
+ // We don't really care if the receiver isn't listening.
+ // We just make a best effort to answer the query.
+ }
+ }
+
+ private void createSubprocess(int[] processId) {
+ String shell = mShell;
+ if (shell == null) {
+ shell = DEFAULT_SHELL;
+ }
+ ArrayList args = parse(shell);
+ String arg0 = args.get(0);
+ String arg1 = null;
+ String arg2 = null;
+ if (args.size() >= 2) {
+ arg1 = args.get(1);
+ }
+ if (args.size() >= 3) {
+ arg2 = args.get(2);
+ }
+ mTermFd = Exec.createSubprocess(arg0, arg1, arg2, processId);
+ }
+
+ private ArrayList parse(String cmd) {
+ final int PLAIN = 0;
+ final int WHITESPACE = 1;
+ final int INQUOTE = 2;
+ int state = WHITESPACE;
+ ArrayList result = new ArrayList();
+ int cmdLen = cmd.length();
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < cmdLen; i++) {
+ char c = cmd.charAt(i);
+ if (state == PLAIN) {
+ if (Character.isWhitespace(c)) {
+ result.add(builder.toString());
+ builder.delete(0,builder.length());
+ state = WHITESPACE;
+ } else if (c == '"') {
+ state = INQUOTE;
+ } else {
+ builder.append(c);
+ }
+ } else if (state == WHITESPACE) {
+ if (Character.isWhitespace(c)) {
+ // do nothing
+ } else if (c == '"') {
+ state = INQUOTE;
+ } else {
+ state = PLAIN;
+ builder.append(c);
+ }
+ } else if (state == INQUOTE) {
+ if (c == '\\') {
+ if (i + 1 < cmdLen) {
+ i += 1;
+ builder.append(cmd.charAt(i));
+ }
+ } else if (c == '"') {
+ state = PLAIN;
+ } else {
+ builder.append(c);
+ }
+ }
+ }
+ if (builder.length() > 0) {
+ result.add(builder.toString());
+ }
+ return result;
+ }
+
+ private void readPrefs() {
+ mFontSize = readIntPref(FONTSIZE_KEY, mFontSize, 20);
+ mColorId = readIntPref(COLOR_KEY, mColorId, COLOR_SCHEMES.length - 1);
+ mControlKeyId = readIntPref(CONTROLKEY_KEY, mControlKeyId,
+ CONTROL_KEY_SCHEMES.length - 1);
+ {
+ String newShell = readStringPref(SHELL_KEY, mShell);
+ if ((newShell == null) || ! newShell.equals(mShell)) {
+ if (mShell != null) {
+ Log.i(Term.LOG_TAG, "New shell set. Restarting.");
+ restart();
+ }
+ mShell = newShell;
+ }
+ }
+ {
+ String newInitialCommand = readStringPref(INITIALCOMMAND_KEY,
+ mInitialCommand);
+ if ((newInitialCommand == null)
+ || ! newInitialCommand.equals(mInitialCommand)) {
+ if (mInitialCommand != null) {
+ Log.i(Term.LOG_TAG, "New initial command set. Restarting.");
+ restart();
+ }
+ mInitialCommand = newInitialCommand;
+ }
+ }
+ }
+
+ private void updatePrefs() {
+ mEmulatorView.setTextSize(mFontSize);
+ setColors();
+ mControlKeyCode = CONTROL_KEY_SCHEMES[mControlKeyId];
+ }
+
+ private int readIntPref(String key, int defaultValue, int maxValue) {
+ int val;
+ try {
+ val = Integer.parseInt(
+ mPrefs.getString(key, Integer.toString(defaultValue)));
+ } catch (NumberFormatException e) {
+ val = defaultValue;
+ }
+ val = Math.max(0, Math.min(val, maxValue));
+ return val;
+ }
+
+ private String readStringPref(String key, String defaultValue) {
+ return mPrefs.getString(key, defaultValue);
}
@Override
public void onPause() {
SharedPreferences.Editor e = mPrefs.edit();
e.clear();
- e.putInt(FONT_SELECTION_KEY, mFontSelection);
- e.putBoolean(WHITE_ON_BLUE_KEY, mWhiteOnBlue);
- e.putFloat(ROTATION_KEY, mRotation);
+ e.putString(FONTSIZE_KEY, Integer.toString(mFontSize));
+ e.putString(COLOR_KEY, Integer.toString(mColorId));
+ e.putString(CONTROLKEY_KEY, Integer.toString(mControlKeyId));
+ e.putString(SHELL_KEY, mShell);
+ e.putString(INITIALCOMMAND_KEY, mInitialCommand);
e.commit();
super.onPause();
@@ -235,7 +372,9 @@ public class Term extends Activity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (isSystemKey(keyCode, event)) {
+ if (handleControlKey(keyCode, true)) {
+ return true;
+ } else if (isSystemKey(keyCode, event)) {
// Don't intercept the system keys
return super.onKeyDown(keyCode, event);
} else if (handleDPad(keyCode, true)) {
@@ -257,7 +396,9 @@ public class Term extends Activity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
- if (isSystemKey(keyCode, event)) {
+ if (handleControlKey(keyCode, false)) {
+ return true;
+ } else if (isSystemKey(keyCode, event)) {
// Don't intercept the system keys
return super.onKeyUp(keyCode, event);
} else if (handleDPad(keyCode, false)) {
@@ -268,44 +409,55 @@ public class Term extends Activity {
return true;
}
+ private boolean handleControlKey(int keyCode, boolean down) {
+ if (keyCode == mControlKeyCode) {
+ mKeyListener.handleControlKey(down);
+ return true;
+ }
+ return false;
+ }
+
/**
* Handle dpad left-right-up-down events. Don't handle
* dpad-center, that's our control key.
* @param keyCode
* @param down
- * @return
*/
private boolean handleDPad(int keyCode, boolean down) {
if (keyCode < KeyEvent.KEYCODE_DPAD_UP ||
- keyCode > KeyEvent.KEYCODE_DPAD_RIGHT) {
+ keyCode > KeyEvent.KEYCODE_DPAD_CENTER) {
return false;
}
if (down) {
try {
- char code;
- switch (keyCode) {
- case KeyEvent.KEYCODE_DPAD_UP:
- code = 'A';
- break;
- case KeyEvent.KEYCODE_DPAD_DOWN:
- code = 'B';
- break;
- case KeyEvent.KEYCODE_DPAD_LEFT:
- code = 'D';
- break;
- default:
- case KeyEvent.KEYCODE_DPAD_RIGHT:
- code = 'C';
- break;
- }
- mTermOut.write(27); // ESC
- if (mEmulatorView.getKeypadApplicationMode()) {
- mTermOut.write('O');
+ if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
+ mTermOut.write('\r');
} else {
- mTermOut.write('[');
+ char code;
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_DPAD_UP:
+ code = 'A';
+ break;
+ case KeyEvent.KEYCODE_DPAD_DOWN:
+ code = 'B';
+ break;
+ case KeyEvent.KEYCODE_DPAD_LEFT:
+ code = 'D';
+ break;
+ default:
+ case KeyEvent.KEYCODE_DPAD_RIGHT:
+ code = 'C';
+ break;
+ }
+ mTermOut.write(27); // ESC
+ if (mEmulatorView.getKeypadApplicationMode()) {
+ mTermOut.write('O');
+ } else {
+ mTermOut.write('[');
+ }
+ mTermOut.write(code);
}
- mTermOut.write(code);
} catch (IOException e) {
// Ignore
}
@@ -319,82 +471,36 @@ public class Term extends Activity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- SubMenu screenSize = menu.addSubMenu(MENU_GROUP_NONE,
- MENU_SCREEN_SIZE_ID, 0, "Font Size");
- String[] labels = MENU_SCREEN_SIZE_LABELS;
- for (int i = 0; i < MENU_SCREEN_SIZE_ITEM_COUNT; i++) {
- MenuItem item = screenSize.add(i, MENU_SCREEN_SIZE_ITEM_ID + i, 0,
- labels[i]);
- item.setCheckable(true);
- }
- {
- MenuItem item = menu.add(MENU_WHITE_ON_BLUE_ID, MENU_WHITE_ON_BLUE_ID,
- 0, "Toggle White on Blue");
- }
- menu.add(MENU_RESET_TERMINAL_ID, MENU_RESET_TERMINAL_ID,
- 0, "Reset Terminal");
- menu.add(MENU_EMAIL_TRANSCRIPT_ID, MENU_EMAIL_TRANSCRIPT_ID,
- 0, "Email To...");
- menu.add(MENU_DOCUMENT_KEYS_ID, MENU_DOCUMENT_KEYS_ID,
- 0, "Special keys...");
- return true;
- }
-
- @Override
- public boolean onPrepareOptionsMenu(Menu menu) {
- super.onPrepareOptionsMenu(menu);
- for (int i = 0; i < MENU_SCREEN_SIZE_ITEM_COUNT; i++) {
- menu.findItem(MENU_SCREEN_SIZE_ITEM_ID + i).setChecked(i == mFontSelection);
- }
+ getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
- if (id >= MENU_SCREEN_SIZE_ITEM_ID
- && id < MENU_SCREEN_SIZE_ITEM_ID_END) {
- doSetFontSize(id - MENU_SCREEN_SIZE_ITEM_ID);
- return true;
- } else if (id == MENU_WHITE_ON_BLUE_ID) {
- doWhiteOnBlue();
- } else if (id == MENU_RESET_TERMINAL_ID) {
+ if (id == R.id.menu_preferences) {
+ doPreferences();
+ } else if (id == R.id.menu_reset) {
doResetTerminal();
- } else if (id == MENU_EMAIL_TRANSCRIPT_ID) {
+ } else if (id == R.id.menu_send_email) {
doEmailTranscript();
- } else if (id == MENU_DOCUMENT_KEYS_ID) {
+ } else if (id == R.id.menu_special_keys) {
doDocumentKeys();
}
return super.onOptionsItemSelected(item);
}
- private void doWhiteOnBlue() {
- mWhiteOnBlue = ! mWhiteOnBlue;
- setColors();
- }
-
- private void doRotate90() {
- mRotation = mRotation != 0.0f ? 0.0f : 90.0f;
- mEmulatorView.setRotation(mRotation);
+ private void doPreferences() {
+ startActivity(new Intent(this, TermPreferences.class));
}
private void setColors() {
- if (mWhiteOnBlue) {
- mEmulatorView.setColors(WHITE, BLUE);
- } else {
- mEmulatorView.setColors(BLACK, WHITE);
- }
- }
-
- private void doSetFontSize(int i) {
- if (mFontSelection != i) {
- mFontSelection = i;
- mEmulatorView.setTextSize(TEXT_SIZE[i]);
- }
+ int[] scheme = COLOR_SCHEMES[mColorId];
+ mEmulatorView.setColors(scheme[0], scheme[1]);
}
private void doResetTerminal() {
- mEmulatorView.resetTerminal();
+ restart();
}
private void doEmailTranscript() {
@@ -411,15 +517,16 @@ public class Term extends Activity {
}
private void doDocumentKeys() {
+ String controlKey = CONTROL_KEY_NAME[mControlKeyId];
new AlertDialog.Builder(this).
- setTitle("Press Jog Ball and Key").
- setMessage("Ball Space ==> Control-@ (NUL)\n"
- + "Ball A..Z ==> Control-A..Z\n"
- + "Ball 1 ==> Control-[ (ESC)\n"
- + "Ball 5 ==> Control-_\n"
- + "Ball . ==> Control-\\\n"
- + "Ball 0 ==> Control-]\n"
- + "Ball 6 ==> Control-^").
+ setTitle("Press " + controlKey + " and Key").
+ setMessage(controlKey + " Space ==> Control-@ (NUL)\n"
+ + controlKey + " A..Z ==> Control-A..Z\n"
+ + controlKey + " 1 ==> Control-[ (ESC)\n"
+ + controlKey + " 5 ==> Control-_\n"
+ + controlKey + " . ==> Control-\\\n"
+ + controlKey + " 0 ==> Control-]\n"
+ + controlKey + " 6 ==> Control-^").
show();
}
@@ -1857,6 +1964,10 @@ class TerminalEmulator {
write(attributes);
}
+ /**
+ * Send data to the shell process
+ * @param data
+ */
private void write(byte[] data) {
try {
mTermOut.write(data);
@@ -2245,6 +2356,108 @@ class PaintRenderer extends BaseTextRenderer {
private static final char[] EXAMPLE_CHAR = {'X'};
}
+/**
+ * A multi-thread-safe produce-consumer byte array.
+ * Only allows one producer and one consumer.
+ */
+
+class ByteQueue {
+ public ByteQueue(int size) {
+ mBuffer = new byte[size];
+ }
+
+ public int getBytesAvailable() {
+ synchronized(this) {
+ return mStoredBytes;
+ }
+ }
+
+ public int read(byte[] buffer, int offset, int length)
+ throws InterruptedException {
+ if (length + offset > buffer.length) {
+ throw
+ new IllegalArgumentException("length + offset > buffer.length");
+ }
+ if (length < 0) {
+ throw
+ new IllegalArgumentException("length < 0");
+
+ }
+ if (length == 0) {
+ return 0;
+ }
+ synchronized(this) {
+ while (mStoredBytes == 0) {
+ wait();
+ }
+ int totalRead = 0;
+ int bufferLength = mBuffer.length;
+ boolean wasFull = bufferLength == mStoredBytes;
+ while (length > 0 && mStoredBytes > 0) {
+ int oneRun = Math.min(bufferLength - mHead, mStoredBytes);
+ int bytesToCopy = Math.min(length, oneRun);
+ System.arraycopy(mBuffer, mHead, buffer, offset, bytesToCopy);
+ mHead += bytesToCopy;
+ if (mHead >= bufferLength) {
+ mHead = 0;
+ }
+ mStoredBytes -= bytesToCopy;
+ length -= bytesToCopy;
+ offset += bytesToCopy;
+ totalRead += bytesToCopy;
+ }
+ if (wasFull) {
+ notify();
+ }
+ return totalRead;
+ }
+ }
+
+ public void write(byte[] buffer, int offset, int length)
+ throws InterruptedException {
+ if (length + offset > buffer.length) {
+ throw
+ new IllegalArgumentException("length + offset > buffer.length");
+ }
+ if (length < 0) {
+ throw
+ new IllegalArgumentException("length < 0");
+
+ }
+ if (length == 0) {
+ return;
+ }
+ synchronized(this) {
+ int bufferLength = mBuffer.length;
+ boolean wasEmpty = mStoredBytes == 0;
+ while (length > 0) {
+ while(bufferLength == mStoredBytes) {
+ wait();
+ }
+ int tail = mHead + mStoredBytes;
+ int oneRun;
+ if (tail >= bufferLength) {
+ tail = tail - bufferLength;
+ oneRun = mHead - tail;
+ } else {
+ oneRun = bufferLength - tail;
+ }
+ int bytesToCopy = Math.min(oneRun, length);
+ System.arraycopy(buffer, offset, mBuffer, tail, bytesToCopy);
+ offset += bytesToCopy;
+ mStoredBytes += bytesToCopy;
+ length -= bytesToCopy;
+ }
+ if (wasEmpty) {
+ notify();
+ }
+ }
+ }
+
+ private byte[] mBuffer;
+ private int mHead;
+ private int mStoredBytes;
+}
/**
* A view on a transcript and a terminal emulator. Displays the text of the
* transcript and the current cursor position of the terminal emulator.
@@ -2340,6 +2553,9 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
private FileOutputStream mTermOut;
+ private ByteQueue mByteQueue;
+ private final static int MAX_BYTES_PER_UPDATE = 4 * 1024;
+
/**
* Used to temporarily hold data received from the remote process. Allocated
* once and used permanently to minimize heap thrashing.
@@ -2347,25 +2563,16 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
private byte[] mReceiveBuffer;
/**
- * Our private message id, which we use to check for new input from the
+ * Our private message id, which we use to receive new input from the
* remote process.
*/
private static final int UPDATE = 1;
/**
- * The period in milliseconds between updates.
+ * Thread that polls for input from the remote process
*/
- private static final int UPDATE_PERIOD_MS = 20;
- /**
- * The target time for our next update.
- */
- private long mNextTime;
-
- /**
- * Rotation amount for manual portrait/landscape rotation
- */
- private float mRotation;
+ private Thread mPollingThread;
private GestureDetector mGestureDetector;
private float mScrollRemainder;
@@ -2376,21 +2583,13 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
private final Handler mHandler = new Handler() {
/**
* Handle the callback message. Call our enclosing class's update
- * method, and then reschedule another callback in the future. In this
- * way we implement a periodic callback.
+ * method.
*
* @param msg The callback message.
*/
public void handleMessage(Message msg) {
if (msg.what == UPDATE) {
update();
- msg = obtainMessage(UPDATE);
- long current = SystemClock.uptimeMillis();
- if (mNextTime < current) {
- mNextTime = current + UPDATE_PERIOD_MS;
- }
- sendMessageAtTime(msg, mNextTime);
- mNextTime += UPDATE_PERIOD_MS;
}
}
};
@@ -2465,18 +2664,17 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
*
* @param termFd the file descriptor
* @param termOut the output stream for the pseudo-teletype
- * @param textSize the point size of the text font
*/
public void initialize(FileDescriptor termFd, FileOutputStream termOut) {
mTermOut = termOut;
mTermFd = termFd;
mTextSize = 10;
- mRotation = 0.0f;
mForeground = Term.WHITE;
mBackground = Term.BLACK;
updateText();
mTermIn = new FileInputStream(mTermFd);
mReceiveBuffer = new byte[4 * 1024];
+ mByteQueue = new ByteQueue(4 * 1024);
}
/**
@@ -2529,17 +2727,6 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
updateText();
}
- /**
- * Set the rotation. Currently only 0 and 90 degrees are supported
- */
-
- public void setRotation(float angle) {
- mRotation = angle;
- if (mKnownSize) {
- updateSize(getWidth(), getHeight());
- }
- }
-
// Begin GestureDetector.OnGestureListener methods
public boolean onSingleTapUp(MotionEvent e) {
@@ -2625,21 +2812,31 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
if (!mKnownSize) {
mKnownSize = true;
- // Set a timer so we're called back to check for input from the
+ // Set up a thread to read input from the
// pseudo-teletype:
- Message msg = mHandler.obtainMessage(UPDATE);
- mNextTime = SystemClock.uptimeMillis() + UPDATE_PERIOD_MS;
- mHandler.sendMessageAtTime(msg, mNextTime);
+
+ mPollingThread = new Thread(new Runnable() {
+
+ public void run() {
+ try {
+ while(true) {
+ int read = mTermIn.read(mBuffer);
+ mByteQueue.write(mBuffer, 0, read);
+ mHandler.sendMessage(
+ mHandler.obtainMessage(UPDATE));
+ }
+ } catch (IOException e) {
+ } catch (InterruptedException e) {
+ }
+ }
+ private byte[] mBuffer = new byte[4096];
+ });
+ mPollingThread.setName("Input reader");
+ mPollingThread.start();
}
}
private void updateSize(int w, int h) {
- if (mRotation != 0.0f) {
- int temp = w;
- w = h;
- h = temp;
- }
-
mColumns = w / mCharacterWidth;
mRows = h / mCharacterHeight;
@@ -2674,26 +2871,12 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
* Look for new input from the ptty, send it to the terminal emulator.
*/
private void update() {
+ int bytesAvailable = mByteQueue.getBytesAvailable();
+ int bytesToRead = Math.min(bytesAvailable, mReceiveBuffer.length);
try {
- // To avoid starving user input, only process 20 KB
- // of input at once
- int processed = 0;
- while (processed < 20000) {
- int available =
- Math.min(mReceiveBuffer.length, mTermIn.available());
- if (available <= 0) {
- break;
- }
-
- int received = mTermIn.read(mReceiveBuffer, 0, available);
- if (received > 0) {
- append(mReceiveBuffer, 0, received);
- }
- processed += received;
- }
- } catch (IOException e) {
- // I/O exceptions break out of the input loop, but we don't
- // report them to the user.
+ int bytesRead = mByteQueue.read(mReceiveBuffer, 0, bytesToRead);
+ append(mReceiveBuffer, 0, bytesRead);
+ } catch (InterruptedException e) {
}
}
@@ -2701,14 +2884,6 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
protected void onDraw(Canvas canvas) {
int w = getWidth();
int h = getHeight();
- if (mRotation != 0.0f) {
- canvas.save(Canvas.MATRIX_SAVE_FLAG);
- int pivot = Math.min(w, h) >> 1;
- canvas.rotate(mRotation, pivot, pivot);
- int temp = w;
- w = h;
- h = temp;
- }
canvas.drawRect(0, 0, w, h, mBackgroundPaint);
mVisibleColumns = w / mCharacterWidth;
float x = -mLeftColumn * mCharacterWidth;
@@ -2724,9 +2899,6 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
mTranscriptScreen.drawText(i, canvas, x, y, mTextRenderer, cursorX);
y += mCharacterHeight;
}
- if (mRotation != 0.0f) {
- canvas.restore();
- }
}
private void ensureCursorVisible() {
@@ -2842,6 +3014,14 @@ class TermKeyListener {
public TermKeyListener() {
}
+ public void handleControlKey(boolean down) {
+ if (down) {
+ mControlKey.onPress();
+ } else {
+ mControlKey.onRelease();
+ }
+ }
+
/**
* Handle a keyDown event.
*
@@ -2862,10 +3042,6 @@ class TermKeyListener {
mCapKey.onPress();
break;
- case KeyEvent.KEYCODE_DPAD_CENTER:
- mControlKey.onPress();
- break;
-
case KeyEvent.KEYCODE_ENTER:
// Convert newlines into returns. The vt100 sends a
// '\r' when the 'Return' key is pressed, but our
@@ -2929,9 +3105,6 @@ class TermKeyListener {
case KeyEvent.KEYCODE_SHIFT_RIGHT:
mCapKey.onRelease();
break;
- case KeyEvent.KEYCODE_DPAD_CENTER:
- mControlKey.onRelease();
- break;
default:
// Ignore other keyUps
break;
diff --git a/apps/Term/src/com/android/term/TermPreferences.java b/apps/Term/src/com/android/term/TermPreferences.java
new file mode 100644
index 000000000..3102963a4
--- /dev/null
+++ b/apps/Term/src/com/android/term/TermPreferences.java
@@ -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.term;
+
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+
+public class TermPreferences extends PreferenceActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.preferences);
+ }
+
+}
diff --git a/build/Android.mk b/build/Android.mk
index a8a849df7..cba96c631 100644
--- a/build/Android.mk
+++ b/build/Android.mk
@@ -4,7 +4,7 @@ LOCAL_PATH := $(call my-dir)
# anywhere else, and the rules don't support. Aditionally, the depenencies on
# these files don't really matter, because they are all generated as part of
# building the docs. So for the dependency, we just use the
-# framework-timestamp file, which is the $@ of the droiddoc rule.
+# offline-sdk-timestamp file, which is the $@ of the droiddoc rule.
# We also need to depend on framework-res.apk, in order to pull the
# resource files out of there for aapt.
#
@@ -22,7 +22,7 @@ $(full_target): PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(full_target): PRIVATE_CLASS_INTERMEDIATES_DIR := $(classes_dir)
$(full_target): PRIVATE_FRAMEWORK_RES_PACKAGE := $(framework_res_package)
-$(full_target): $(OUT_DOCS)/framework-timestamp $(framework_res_package)
+$(full_target): $(OUT_DOCS)/offline-sdk-timestamp $(framework_res_package)
@echo Compiling SDK Stubs: $@
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
diff --git a/build/sdk.atree b/build/sdk.atree
index ab6076e98..2df42bc8d 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -30,41 +30,43 @@ bin/mksdcard tools/mksdcard
development/tools/scripts/add-accounts-sdk tools/add-accounts.py
# the uper-jar file that apps link against
-out/target/common/obj/PACKAGING/android_jar_intermediates/android.jar android.jar
+out/target/common/obj/PACKAGING/android_jar_intermediates/android.jar platforms/${PLATFORM_NAME}/android.jar
-sdk/sdk-build.prop tools/lib/build.prop
+sdk/sdk-build.prop platforms/${PLATFORM_NAME}/build.prop
development/tools/scripts/plugin.prop tools/lib/plugin.prop
# the aidl precompiled include
-obj/framework.aidl tools/lib/framework.aidl
+obj/framework.aidl platforms/${PLATFORM_NAME}/framework.aidl
# sdk scripts
-development/tools/scripts/AndroidManifest.template tools/lib/AndroidManifest.template
-development/tools/scripts/AndroidManifest.alias.template tools/lib/AndroidManifest.alias.template
-development/tools/scripts/AndroidManifest.tests.template tools/lib/AndroidManifest.tests.template
+development/tools/scripts/AndroidManifest.template platforms/${PLATFORM_NAME}/templates/AndroidManifest.template
+development/tools/scripts/AndroidManifest.alias.template platforms/${PLATFORM_NAME}/templates/AndroidManifest.alias.template
+development/tools/scripts/AndroidManifest.tests.template platforms/${PLATFORM_NAME}/templates/AndroidManifest.tests.template
+development/tools/scripts/iml.template platforms/${PLATFORM_NAME}/templates/iml.template
+development/tools/scripts/ipr.template platforms/${PLATFORM_NAME}/templates/ipr.template
+development/tools/scripts/iws.template platforms/${PLATFORM_NAME}/templates/iws.template
+development/tools/scripts/java_file.template platforms/${PLATFORM_NAME}/templates/java_file.template
+development/tools/scripts/java_tests_file.template platforms/${PLATFORM_NAME}/templates/java_tests_file.template
+development/tools/scripts/layout.template platforms/${PLATFORM_NAME}/templates/layout.template
+development/tools/scripts/strings.template platforms/${PLATFORM_NAME}/templates/strings.template
+development/tools/scripts/alias.template platforms/${PLATFORM_NAME}/templates/alias.template
development/tools/scripts/build.template tools/lib/build.template
development/tools/scripts/build.alias.template tools/lib/build.alias.template
development/tools/scripts/default.properties.template tools/lib/default.properties.template
-development/tools/scripts/iml.template tools/lib/iml.template
-development/tools/scripts/ipr.template tools/lib/ipr.template
-development/tools/scripts/iws.template tools/lib/iws.template
-development/tools/scripts/java_file.template tools/lib/java_file.template
-development/tools/scripts/java_tests_file.template tools/lib/java_tests_file.template
-development/tools/scripts/layout.template tools/lib/layout.template
-development/tools/scripts/strings.template tools/lib/strings.template
-development/tools/scripts/alias.template tools/lib/alias.template
+development/tools/scripts/android_rules.xml tools/lib/android_rules.xml
+development/tools/scripts/alias_rules.xml tools/lib/alias_rules.xml
# emacs support
development/tools/scripts/android.el tools/lib/android.el
# samples
-development/samples/HelloActivity
-development/samples/Home
-development/samples/LunarLander
-development/samples/NotePad
-development/samples/ApiDemos
-development/samples/SkeletonApp
-development/samples/Snake
+development/samples/HelloActivity platforms/${PLATFORM_NAME}/samples/HelloActivity
+development/samples/Home platforms/${PLATFORM_NAME}/samples/Home
+development/samples/LunarLander platforms/${PLATFORM_NAME}/samples/LunarLander
+development/samples/NotePad platforms/${PLATFORM_NAME}/samples/NotePad
+development/samples/ApiDemos platforms/${PLATFORM_NAME}/samples/ApiDemos
+development/samples/SkeletonApp platforms/${PLATFORM_NAME}/samples/SkeletonApp
+development/samples/Snake platforms/${PLATFORM_NAME}/samples/Snake
# dx
bin/dx tools/dx
@@ -115,47 +117,53 @@ framework/traceview.jar tools/lib/traceview.jar
bin/activitycreator tools/activitycreator
framework/activitycreator.jar tools/lib/activitycreator.jar
+# sdkmanager
+bin/android tools/android
+framework/sdklib.jar tools/lib/sdklib.jar
+framework/sdkmanager.jar tools/lib/sdkmanager.jar
+
# emulator
bin/emulator tools/emulator
-system.img tools/lib/images/system.img
-ramdisk.img tools/lib/images/ramdisk.img
-userdata.img tools/lib/images/userdata.img
-userdata.img tools/lib/images/userdata.img
-prebuilt/android-arm/kernel/kernel-qemu tools/lib/images/kernel-qemu
+system.img platforms/${PLATFORM_NAME}/images/system.img
+ramdisk.img platforms/${PLATFORM_NAME}/images/ramdisk.img
+userdata.img platforms/${PLATFORM_NAME}/images/userdata.img
+prebuilt/android-arm/kernel/kernel-qemu platforms/${PLATFORM_NAME}/images/kernel-qemu
+external/qemu/android/vm/hardware-properties.ini tools/lib/hardware-properties.ini
# emulator skins
-development/emulator/skins/HVGA tools/lib/images/skins/HVGA
-development/emulator/skins/HVGA-L tools/lib/images/skins/HVGA-L
-development/emulator/skins/HVGA-P tools/lib/images/skins/HVGA-P
-development/emulator/skins/QVGA-L tools/lib/images/skins/QVGA-L
-development/emulator/skins/QVGA-P tools/lib/images/skins/QVGA-P
+development/emulator/skins/HVGA platforms/${PLATFORM_NAME}/skins/HVGA
+development/emulator/skins/HVGA-L platforms/${PLATFORM_NAME}/skins/HVGA-L
+development/emulator/skins/HVGA-P platforms/${PLATFORM_NAME}/skins/HVGA-P
+development/emulator/skins/QVGA-L platforms/${PLATFORM_NAME}/skins/QVGA-L
+development/emulator/skins/QVGA-P platforms/${PLATFORM_NAME}/skins/QVGA-P
-# NOTICE files are copied by config/Makefile
+# NOTICE files are copied by build/core/Makefile
# the readme
development/docs/SDK_RELEASE_NOTES RELEASE_NOTES.txt
# the docs
-docs/framework docs
+docs/offline-sdk docs
frameworks/base/docs/docs-redirect.html documentation.html
frameworks/base/docs/docs-samples-redirect.html docs/samples/index.html
# tools support
-docs/activity_actions.txt tools/lib/activity_actions.txt
-docs/broadcast_actions.txt tools/lib/broadcast_actions.txt
-docs/service_actions.txt tools/lib/service_actions.txt
-docs/categories.txt tools/lib/categories.txt
-docs/widgets.txt tools/lib/widgets.txt
-framework/layoutlib.jar tools/lib/layoutlib.jar
-frameworks/base/core/res tools/lib/res/default
-frameworks/base/data/fonts/fonts.xml tools/lib/fonts/default/fonts.xml
-frameworks/base/data/fonts/DroidSans.ttf tools/lib/fonts/default/DroidSans.ttf
-frameworks/base/data/fonts/DroidSans-Bold.ttf tools/lib/fonts/default/DroidSans-Bold.ttf
-frameworks/base/data/fonts/DroidSansFallback.ttf tools/lib/fonts/default/DroidSansFallback.ttf
-frameworks/base/data/fonts/DroidSansMono.ttf tools/lib/fonts/default/DroidSansMono.ttf
-frameworks/base/data/fonts/DroidSerif-Bold.ttf tools/lib/fonts/default/DroidSerif-Bold.ttf
-frameworks/base/data/fonts/DroidSerif-BoldItalic.ttf tools/lib/fonts/default/DroidSerif-BoldItalic.ttf
-frameworks/base/data/fonts/DroidSerif-Italic.ttf tools/lib/fonts/default/DroidSerif-Italic.ttf
-frameworks/base/data/fonts/DroidSerif-Regular.ttf tools/lib/fonts/default/DroidSerif-Regular.ttf
-
+docs/activity_actions.txt platforms/${PLATFORM_NAME}/data/activity_actions.txt
+docs/broadcast_actions.txt platforms/${PLATFORM_NAME}/data/broadcast_actions.txt
+docs/service_actions.txt platforms/${PLATFORM_NAME}/data/service_actions.txt
+docs/categories.txt platforms/${PLATFORM_NAME}/data/categories.txt
+docs/widgets.txt platforms/${PLATFORM_NAME}/data/widgets.txt
+framework/layoutlib.jar platforms/${PLATFORM_NAME}/data/layoutlib.jar
+frameworks/base/core/res/res platforms/${PLATFORM_NAME}/data/res
+frameworks/base/data/fonts/fonts.xml platforms/${PLATFORM_NAME}/data/fonts/fonts.xml
+frameworks/base/data/fonts/DroidSans.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSans.ttf
+frameworks/base/data/fonts/DroidSans-Bold.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSans-Bold.ttf
+frameworks/base/data/fonts/DroidSansFallback.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSansFallback.ttf
+frameworks/base/data/fonts/DroidSansMono.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSansMono.ttf
+frameworks/base/data/fonts/DroidSerif-Bold.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Bold.ttf
+frameworks/base/data/fonts/DroidSerif-BoldItalic.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-BoldItalic.ttf
+frameworks/base/data/fonts/DroidSerif-Italic.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Italic.ttf
+frameworks/base/data/fonts/DroidSerif-Regular.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Regular.ttf
+# empty add-on folder with just a readme
+development/tools/scripts/README_add-ons.txt add-ons/README.txt
diff --git a/build/tools/make_windows_sdk.sh b/build/tools/make_windows_sdk.sh
new file mode 100755
index 000000000..f49165ce3
--- /dev/null
+++ b/build/tools/make_windows_sdk.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+# Quick semi-auto file to build Windows SDK tools.
+#
+# Limitations:
+# - Expects the emulator has been built first, will pick it up from prebuilt.
+# - Run in Cygwin
+# - Needs Cygwin package zip
+# - Expects to have one of the existing SDK (Darwin or Linux) to build the Windows one
+
+set -e # Fail this script as soon as a command fails -- fail early, fail fast
+
+SDK_ZIP="$1"
+DIST_DIR="$2"
+
+function die() {
+ echo "Error:" $*
+ echo "Aborting"
+ exit 1
+}
+
+function check() {
+ [ -f "$SDK_ZIP" ] || die "Pass the path of an existing Linux/Darwin SDK .zip as first parameter"
+ [ -d "$DIST_DIR" ] || die "Pass the output directory as second parameter"
+
+ # Use the BUILD_ID as SDK_NUMBER if defined, otherwise try to get it from the
+ # provided zip filename.
+ if [ -f config/build_id.make ]; then
+ BUILD_ID=`cat config/build_id.make | sed -n '/BUILD_ID=/s/^[^=]\+=\(.*\)$/\1/p'`
+ [ -n "$BUILD_ID" ] && SDK_NUMBER="$BUILD_ID"
+ fi
+ if [ -z "$SDK_NUMBER" ]; then
+ # Look for a pattern like "anything_sdknumber.extension"
+ # The pattern is now "any-thing_sdknumber_anything-else.extension"
+ #
+ # The bottom line is that the SDK number is whatever is enclosed by
+ # the LAST couple of underscores. You can have underscores *before* the
+ # SDK number if you want, but not after, e.g these are valid:
+ # android_sdk_4242_platform.zip or blah_42_.zip
+ #
+ # SDK_NUMBER will be empty if nothing matched.
+ filename=`basename "$SDK_ZIP"`
+ SDK_NUMBER=`echo $filename | sed -n 's/^.*_\([^_./]\+\)_[^_.]*\..*$/\1/p'`
+ fi
+
+ [ -n "$SDK_NUMBER" ] || die "Failed to extract the SDK number from $SDK_ZIP. Check its format."
+
+ [ $OSTYPE == "cygwin" ] || die "This expects to run under Cygwin"
+ [ -e `which zip` ] || die "Please install 'zip' package in Cygwin"
+ [ -f "build/envsetup.sh" ] || die "Please run this from the 'android' directory"
+
+ echo "Using SDK ${SDK_NUMBER}"
+}
+
+function build() {
+
+ echo
+ echo "Building..."
+ [ -n "$MAKE_OPT" ] && echo "Make options: $MAKE_OPT"
+ . build/envsetup.sh
+ make -j 4 emulator || die "Build failed"
+ # Disable parallel build: it generates "permission denied" issues when
+ # multiple "ar.exe" are running in parallel.
+ make prebuilt adb fastboot aidl aapt dexdump dmtracedump mksdcard sqlite3 || die "Build failed"
+}
+
+function package() {
+ echo
+ echo "Packaging..."
+ DEST_NAME="android-sdk_${SDK_NUMBER}_windows"
+ DEST="$DIST_DIR/$DEST_NAME"
+ DEST_NAME_ZIP="${DEST_NAME}.zip"
+
+ # Unzip current linux/mac SDK and rename using the windows name
+ [ -e "$DEST" ] && rm -rfv "$DEST" # cleanup dest first if exists
+ UNZIPPED=`basename "$SDK_ZIP"`
+ UNZIPPED="$DIST_DIR/${UNZIPPED/.zip/}"
+ [ -e "$UNZIPPED" ] && rm -rfv "$UNZIPPED" # cleanup unzip dir (if exists)
+ unzip "$SDK_ZIP" -d "$DIST_DIR"
+ mv -v "$UNZIPPED" "$DEST"
+
+ # USB Driver is not in tools
+ mkdir -pv $DEST/usb_driver
+ cp -rv development/host/windows/prebuilt/usb/driver/* $DEST/usb_driver
+
+ # Remove obsolete stuff from tools
+ TOOLS="$DEST/tools"
+ LIB="$DEST/tools/lib"
+ rm -v "$TOOLS"/{aapt,aidl,adb,emulator,traceview,draw9patch,hierarchyviewer,dx,dexdump,apkbuilder,ddms,dmtracedump,mksdcard,sqlite3,activitycreator,android}
+ rm -v --force "$LIB"/*.so "$LIB"/*.jnilib
+
+ # Copy all the new stuff in tools
+ cp -v out/host/windows-x86/bin/*.{exe,dll} "$TOOLS"
+ cp -v prebuilt/windows/swt/*.{jar,dll} "$LIB"
+ # Do we want the emulator NOTICE in the tools dir? Cf http://b/930608.
+ # If yes, uncomment the following line:
+ # cp -v external/qemu/NOTICE "$TOOLS"/emulator_NOTICE.txt
+
+
+ # We currently need libz from MinGW for aapt
+ cp -v /cygdrive/c/cygwin/bin/mgwz.dll "$TOOLS"
+
+ # Update a bunch of bat files
+ cp -v dalvik/dx/etc/dx.bat "$TOOLS"
+ cp -v development/tools/apkbuilder/etc/apkbuilder.bat "$TOOLS"
+ cp -v development/tools/ddms/app/etc/ddms.bat "$TOOLS"
+ cp -v development/tools/traceview/etc/traceview.bat "$TOOLS"
+ cp -v development/tools/hierarchyviewer/etc/hierarchyviewer.bat "$TOOLS"
+ cp -v development/tools/draw9patch/etc/draw9patch.bat "$TOOLS"
+ cp -v development/tools/activitycreator/etc/activitycreator.bat "$TOOLS"
+ cp -v development/tools/sdkmanager/app/etc/android.bat "$TOOLS"
+
+ # Fix EOL chars to make window users happy - fix all files at the top level only
+ find "$DIST_DIR" -maxdepth 1 -type f -print | xargs unix2dos -D
+
+ # Done.. Zip it
+ pushd "$DIST_DIR" > /dev/null
+ [ -e "$DEST_NAME_ZIP" ] && rm -rfv "$DEST_NAME_ZIP"
+ zip -9r "$DEST_NAME_ZIP" "$DEST_NAME" && rm -rfv "$DEST_NAME"
+ popd > /dev/null
+ echo "Done"
+ echo
+ echo "Resulting SDK is in $DIST_DIR/$DEST_NAME_ZIP"
+}
+
+check
+build
+package
+
+echo "Done"
diff --git a/cmds/monkey/src/com/android/commands/monkey/Monkey.java b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
index 5a8080cda..f6ab19d73 100644
--- a/cmds/monkey/src/com/android/commands/monkey/Monkey.java
+++ b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
@@ -28,13 +28,8 @@ import android.os.Debug;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.SystemClock;
import android.server.data.CrashData;
-import android.view.Display;
import android.view.IWindowManager;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.WindowManagerImpl;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -43,12 +38,10 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Random;
/**
* Application that injects random key events and other actions into the system.
@@ -62,117 +55,6 @@ public class Monkey {
*/
private final static int DEBUG_ALLOW_ANY_STARTS = 0;
private final static int DEBUG_ALLOW_ANY_RESTARTS = 0;
-
- /** Key events that move around the UI. */
- private final int[] NAV_KEYS = {
- KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_DPAD_DOWN,
- KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_RIGHT,
- };
- /**
- * Key events that perform major navigation options (so shouldn't be sent
- * as much).
- */
- private final int[] MAJOR_NAV_KEYS = {
- KeyEvent.KEYCODE_MENU, /*KeyEvent.KEYCODE_SOFT_RIGHT,*/
- KeyEvent.KEYCODE_DPAD_CENTER,
- };
- /** Key events that perform system operations. */
- private final int[] SYS_KEYS = {
- KeyEvent.KEYCODE_HOME, KeyEvent.KEYCODE_BACK,
- KeyEvent.KEYCODE_CALL, KeyEvent.KEYCODE_ENDCALL,
- KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN,
- };
- /** Nice names for all key events. */
- private final String[] KEY_NAMES = {
- "KEYCODE_UNKNOWN",
- "KEYCODE_MENU",
- "KEYCODE_SOFT_RIGHT",
- "KEYCODE_HOME",
- "KEYCODE_BACK",
- "KEYCODE_CALL",
- "KEYCODE_ENDCALL",
- "KEYCODE_0",
- "KEYCODE_1",
- "KEYCODE_2",
- "KEYCODE_3",
- "KEYCODE_4",
- "KEYCODE_5",
- "KEYCODE_6",
- "KEYCODE_7",
- "KEYCODE_8",
- "KEYCODE_9",
- "KEYCODE_STAR",
- "KEYCODE_POUND",
- "KEYCODE_DPAD_UP",
- "KEYCODE_DPAD_DOWN",
- "KEYCODE_DPAD_LEFT",
- "KEYCODE_DPAD_RIGHT",
- "KEYCODE_DPAD_CENTER",
- "KEYCODE_VOLUME_UP",
- "KEYCODE_VOLUME_DOWN",
- "KEYCODE_POWER",
- "KEYCODE_CAMERA",
- "KEYCODE_CLEAR",
- "KEYCODE_A",
- "KEYCODE_B",
- "KEYCODE_C",
- "KEYCODE_D",
- "KEYCODE_E",
- "KEYCODE_F",
- "KEYCODE_G",
- "KEYCODE_H",
- "KEYCODE_I",
- "KEYCODE_J",
- "KEYCODE_K",
- "KEYCODE_L",
- "KEYCODE_M",
- "KEYCODE_N",
- "KEYCODE_O",
- "KEYCODE_P",
- "KEYCODE_Q",
- "KEYCODE_R",
- "KEYCODE_S",
- "KEYCODE_T",
- "KEYCODE_U",
- "KEYCODE_V",
- "KEYCODE_W",
- "KEYCODE_X",
- "KEYCODE_Y",
- "KEYCODE_Z",
- "KEYCODE_COMMA",
- "KEYCODE_PERIOD",
- "KEYCODE_ALT_LEFT",
- "KEYCODE_ALT_RIGHT",
- "KEYCODE_SHIFT_LEFT",
- "KEYCODE_SHIFT_RIGHT",
- "KEYCODE_TAB",
- "KEYCODE_SPACE",
- "KEYCODE_SYM",
- "KEYCODE_EXPLORER",
- "KEYCODE_ENVELOPE",
- "KEYCODE_ENTER",
- "KEYCODE_DEL",
- "KEYCODE_GRAVE",
- "KEYCODE_MINUS",
- "KEYCODE_EQUALS",
- "KEYCODE_LEFT_BRACKET",
- "KEYCODE_RIGHT_BRACKET",
- "KEYCODE_BACKSLASH",
- "KEYCODE_SEMICOLON",
- "KEYCODE_APOSTROPHE",
- "KEYCODE_SLASH",
- "KEYCODE_AT",
- "KEYCODE_NUM",
- "KEYCODE_HEADSETHOOK",
- "KEYCODE_FOCUS",
- "KEYCODE_PLUS",
- "KEYCODE_MENU",
- "KEYCODE_NOTIFICATION",
- "KEYCODE_SEARCH",
-
- "TAG_LAST_KEYCODE" // EOL. used to keep the lists in sync
- };
-
private IActivityManager mAm;
private IWindowManager mWm;
private IPackageManager mPm;
@@ -238,25 +120,16 @@ public class Monkey {
long mDroppedKeyEvents = 0;
long mDroppedPointerEvents = 0;
long mDroppedTrackballEvents = 0;
-
- /** percentages for each type of event. These will be remapped to working
- * values after we read any optional values.
- **/
- public static final int FACTOR_TOUCH = 0;
- public static final int FACTOR_MOTION = 1;
- public static final int FACTOR_TRACKBALL = 2;
- public static final int FACTOR_NAV = 3;
- public static final int FACTOR_MAJORNAV = 4;
- public static final int FACTOR_SYSOPS = 5;
- public static final int FACTOR_APPSWITCH = 6;
- public static final int FACTOR_ANYTHING = 7;
-
- public static final int FACTORZ_COUNT = 8; // should be last+1
-
- float[] mFactors = new float[FACTORZ_COUNT];
+ long mDroppedFlipEvents = 0;
+
+ /** a filename to the script (if any) **/
+ private String mScriptFileName = null;
private static final File TOMBSTONES_PATH = new File("/data/tombstones");
private HashSet mTombstones = null;
+
+ float[] mFactors = new float[MonkeySourceRandom.FACTORZ_COUNT];
+ MonkeyEventSource mEventSource;
/**
* Monitor operations happening in the system.
@@ -440,21 +313,15 @@ public class Monkey {
mSeed = 0;
mThrottle = 0;
- // default values for random distributions
- // note, these are straight percentages, to match user input (cmd line args)
- // but they will be converted to 0..1 values before the main loop runs.
- mFactors[FACTOR_TOUCH] = 15.0f;
- mFactors[FACTOR_MOTION] = 10.0f;
- mFactors[FACTOR_TRACKBALL] = 15.0f;
- mFactors[FACTOR_NAV] = 25.0f;
- mFactors[FACTOR_MAJORNAV] = 15.0f;
- mFactors[FACTOR_SYSOPS] = 2.0f;
- mFactors[FACTOR_APPSWITCH] = 2.0f;
- mFactors[FACTOR_ANYTHING] = 16.0f;
-
// prepare for command-line processing
mArgs = args;
mNextArg = 0;
+
+ //set a positive value, indicating none of the factors is provided yet
+ for (int i = 0; i < MonkeySourceRandom.FACTORZ_COUNT; i++) {
+ mFactors[i] = 1.0f;
+ }
+
if (!processOptions()) {
return -1;
}
@@ -493,16 +360,40 @@ public class Monkey {
return -4;
}
- if (!adjustEventFactors()) {
- return -5;
+ if (mScriptFileName != null) {
+ // script mode, ignore other options
+ mEventSource = new MonkeySourceScript(mScriptFileName);
+ mEventSource.setVerbose(mVerbose);
+ } else {
+ // random source by default
+ if (mVerbose >= 2) { // check seeding performance
+ System.out.println("// Seeded: " + mSeed);
+ }
+ mEventSource = new MonkeySourceRandom(mSeed, mMainApps);
+ mEventSource.setVerbose(mVerbose);
+ //set any of the factors that has been set
+ for (int i = 0; i < MonkeySourceRandom.FACTORZ_COUNT; i++) {
+ if (mFactors[i] <= 0.0f) {
+ ((MonkeySourceRandom) mEventSource).setFactors(i, mFactors[i]);
+ }
+ }
+
+ //in random mode, we start with a random activity
+ ((MonkeySourceRandom) mEventSource).generateActivity();
}
- // Java's Random doesn't scramble well at all on seeding, so we'll use
- // the better random source here.
- SecureRandom random = new SecureRandom();
- random.setSeed((mSeed == 0) ? -1 : mSeed);
- if (mVerbose >= 2) { // check seeding performance
- System.out.println("// Seeded: " + mSeed + " and pulling: " + random.nextFloat());
+ //validate source generator
+ if (!mEventSource.validate()) {
+ return -5;
+ }
+
+ if (mScriptFileName != null) {
+ // in random mode, count is the number of single events
+ // while in script mode, count is the number of repetition
+ // for a sequence of events, so we need do multiply the length of
+ // that sequence
+ mCount = mCount * ((MonkeySourceScript) mEventSource)
+ .getOneRoundEventCount();
}
// If we're profiling, do it immediately before/after the main monkey loop
@@ -510,7 +401,7 @@ public class Monkey {
signalPersistentProcesses();
}
- int crashedAtCycle = runMonkeyCycles(random);
+ int crashedAtCycle = runMonkeyCycles();
synchronized (this) {
if (mRequestAnrTraces) {
@@ -536,7 +427,7 @@ public class Monkey {
// just in case this was latent (after mCount cycles), make sure
// we report it
if (crashedAtCycle >= mCount) {
- crashedAtCycle = mCount -1;
+ crashedAtCycle = mCount - 1;
}
}
@@ -547,10 +438,12 @@ public class Monkey {
System.out.print(" pointers=");
System.out.print(mDroppedPointerEvents);
System.out.print(" trackballs=");
- System.out.println(mDroppedTrackballEvents);
+ System.out.print(mDroppedTrackballEvents);
+ System.out.print(" flips=");
+ System.out.println(mDroppedFlipEvents);
}
- if (crashedAtCycle < mCount) {
+ if (crashedAtCycle < mCount - 1) {
System.err.println("** System appears to have crashed at event "
+ crashedAtCycle + " of " + mCount + " using seed " + mSeed);
return crashedAtCycle;
@@ -576,7 +469,7 @@ public class Monkey {
try {
String opt;
- while ((opt=nextOption()) != null) {
+ while ((opt = nextOption()) != null) {
if (opt.equals("-s")) {
mSeed = nextOptionLong("Seed");
} else if (opt.equals("-p")) {
@@ -598,27 +491,37 @@ public class Monkey {
} else if (opt.equals("--hprof")) {
mGenerateHprof = true;
} else if (opt.equals("--pct-touch")) {
- mFactors[FACTOR_TOUCH] = -nextOptionLong("touch events percentage");
+ mFactors[MonkeySourceRandom.FACTOR_TOUCH] =
+ -nextOptionLong("touch events percentage");
} else if (opt.equals("--pct-motion")) {
- mFactors[FACTOR_MOTION] = -nextOptionLong("motion events percentage");
+ mFactors[MonkeySourceRandom.FACTOR_MOTION] =
+ -nextOptionLong("motion events percentage");
} else if (opt.equals("--pct-trackball")) {
- mFactors[FACTOR_TRACKBALL] = -nextOptionLong("trackball events percentage");
- } else if (opt.equals("--pct-syskeys")) {
- mFactors[FACTOR_SYSOPS] = -nextOptionLong("system key events percentage");
+ mFactors[MonkeySourceRandom.FACTOR_TRACKBALL] =
+ -nextOptionLong("trackball events percentage");
} else if (opt.equals("--pct-nav")) {
- mFactors[FACTOR_NAV] = -nextOptionLong("nav events percentage");
+ mFactors[MonkeySourceRandom.FACTOR_NAV] =
+ -nextOptionLong("nav events percentage");
} else if (opt.equals("--pct-majornav")) {
- mFactors[FACTOR_MAJORNAV] = -nextOptionLong("major nav events percentage");
+ mFactors[MonkeySourceRandom.FACTOR_MAJORNAV] =
+ -nextOptionLong("major nav events percentage");
} else if (opt.equals("--pct-appswitch")) {
- mFactors[FACTOR_APPSWITCH] = -nextOptionLong("app switch events percentage");
+ mFactors[MonkeySourceRandom.FACTOR_APPSWITCH] =
+ -nextOptionLong("app switch events percentage");
+ } else if (opt.equals("--pct-flip")) {
+ mFactors[MonkeySourceRandom.FACTOR_FLIP] =
+ -nextOptionLong("keyboard flip percentage");
} else if (opt.equals("--pct-anyevent")) {
- mFactors[FACTOR_ANYTHING] = -nextOptionLong("any events percentage");
+ mFactors[MonkeySourceRandom.FACTOR_ANYTHING] =
+ -nextOptionLong("any events percentage");
} else if (opt.equals("--throttle")) {
- mThrottle = nextOptionLong("delay (in milliseconds) to wait between events");
+ mThrottle = nextOptionLong("delay (in milliseconds) to wait between events");
} else if (opt.equals("--wait-dbg")) {
// do nothing - it's caught at the very start of run()
} else if (opt.equals("--dbg-no-events")) {
mSendNoEvents = true;
+ } else if (opt.equals("-f")) {
+ mScriptFileName = nextOptionData();
} else if (opt.equals("-h")) {
showUsage();
return false;
@@ -648,10 +551,10 @@ public class Monkey {
showUsage();
return false;
}
-
+
return true;
}
-
+
/**
* Check for any internal configuration (primarily build-time) errors.
*
@@ -659,13 +562,13 @@ public class Monkey {
*/
private boolean checkInternalConfiguration() {
// Check KEYCODE name array, make sure it's up to date.
-
+
String lastKeyName = null;
try {
- lastKeyName = KEY_NAMES[KeyEvent.MAX_KEYCODE+1];
+ lastKeyName = MonkeySourceRandom.getLastKeyName();
} catch (RuntimeException e) {
}
- if (! "TAG_LAST_KEYCODE".equals(lastKeyName)) {
+ if (!"TAG_LAST_KEYCODE".equals(lastKeyName)) {
System.err.println("** Error: Key names array malformed (internal error).");
return false;
}
@@ -685,8 +588,7 @@ public class Monkey {
return false;
}
- mWm = IWindowManager.Stub.asInterface(
- ServiceManager.getService("window"));
+ mWm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
if (mWm == null) {
System.err.println("** Error: Unable to connect to window manager; is the system running?");
return false;
@@ -697,7 +599,7 @@ public class Monkey {
System.err.println("** Error: Unable to connect to package manager; is the system running?");
return false;
}
-
+
try {
mAm.setActivityWatcher(new ActivityWatcher());
} catch (RemoteException e) {
@@ -707,7 +609,7 @@ public class Monkey {
return true;
}
-
+
/**
* Using the restrictions provided (categories & packages), generate a list of activities
* that we can actually switch to.
@@ -717,7 +619,7 @@ public class Monkey {
private boolean getMainApps() {
try {
final int N = mMainCategories.size();
- for (int i=0; i 0) {
@@ -732,7 +634,7 @@ public class Monkey {
System.out.println("// Selecting main activities from category " + category);
}
final int NA = mainApps.size();
- for (int a=0; a 100%, reject it
- if (userSum > 100.0f) {
- System.err.println("** Event weights > 100%");
- showUsage();
- return false;
- }
-
- // if the user specified all of the weights, then they need to be 100%
- if (defaultCount == 0 && (userSum < 99.9f || userSum > 100.1f)) {
- System.err.println("** Event weights != 100%");
- showUsage();
- return false;
- }
-
- // compute the adjustment necessary
- float defaultsTarget = (100.0f - userSum);
- float defaultsAdjustment = defaultsTarget / defaultSum;
-
- // fix all values, by adjusting defaults, or flipping user values back to >0
- for (int i = 0; i < FACTORZ_COUNT; ++i) {
- if (mFactors[i] <= 0.0f) { // user values are zero or negative
- mFactors[i] = -mFactors[i];
- } else {
- mFactors[i] *= defaultsAdjustment;
- }
- }
-
- // if verbose, show factors
- if (mVerbose > 0) {
- System.out.println("// Event percentages:");
- for (int i = 0; i < FACTORZ_COUNT; ++i) {
- System.out.println("// " + i + ": " + mFactors[i] + "%");
- }
- }
-
- // finally, normalize and convert to running sum
- float sum = 0.0f;
- for (int i = 0; i < FACTORZ_COUNT; ++i) {
- sum += mFactors[i] / 100.0f;
- mFactors[i] = sum;
- }
-
- return true;
- }
-
+
/**
* Run mCount cycles and see if we hit any crashers.
*
- * TODO: Meta state on keys
+ * TODO: Meta state on keys
*
- * @param random The random source to use
- * @return Returns the last cycle which executed. If the value == mCount, no errors detected.
+ * @return Returns the last cycle which executed. If the value == mCount, no errors detected.
*/
- private int runMonkeyCycles(Random random) {
+ private int runMonkeyCycles() {
int i = 0;
int lastKey = 0;
boolean systemCrashed = false;
- if (!startRandomActivity(random)) {
- systemCrashed = true;
- }
-
while (!systemCrashed && i < mCount) {
synchronized (this) {
if (mRequestAnrTraces) {
@@ -873,14 +708,14 @@ public class Monkey {
return i;
}
}
-
+
try {
- Thread.sleep(mThrottle);
+ Thread.sleep(mThrottle);
} catch (InterruptedException e1) {
- System.out.println("** Monkey interrupted in sleep.");
- return i;
+ System.out.println("** Monkey interrupted in sleep.");
+ return i;
}
-
+
// In this debugging mode, we never send any events. This is primarily
// here so you can manually test the package or category limits, while manually
// exercising the system.
@@ -889,220 +724,34 @@ public class Monkey {
continue;
}
- if ((mVerbose > 0) && (i%100) == 0 && i != 0 && lastKey == 0) {
+ if ((mVerbose > 0) && (i % 100) == 0 && i != 0 && lastKey == 0) {
System.out.println(" // Sending event #" + i);
}
- // if the last event was a keydown, then this event is a key-up
- if (lastKey != 0) {
- if (mVerbose > 1) {
- try {
- System.out.println(":SendKey (ACTION_UP):" + lastKey + " // " + KEY_NAMES[lastKey]);
- } catch (ArrayIndexOutOfBoundsException e) {
- System.out.println(":SendKey (ACTION_UP): " + lastKey + " // Unknown key event");
- }
- }
- try {
- if (! mWm.injectKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, lastKey), false)) {
+ MonkeyEvent ev = mEventSource.getNextEvent();
+ if (ev != null) {
+ i++;
+ int injectCode = ev.injectEvent(mWm, mAm, mVerbose);
+ if (injectCode == MonkeyEvent.INJECT_FAIL) {
+ if (ev instanceof MonkeyKeyEvent) {
mDroppedKeyEvents++;
+ } else if (ev instanceof MonkeyMotionEvent) {
+ mDroppedPointerEvents++;
+ } else if (ev instanceof MonkeyFlipEvent) {
+ mDroppedFlipEvents++;
}
- } catch (RemoteException ex) {
+ } else if (injectCode == MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION) {
systemCrashed = true;
- break;
+ } else if (injectCode == MonkeyEvent.INJECT_ERROR_SECURITY_EXCEPTION) {
+ systemCrashed = !mIgnoreSecurityExceptions;
}
- lastKey = 0;
- i++;
- continue;
- }
-
- // otherwise begin a new event cycle
- float cls = random.nextFloat();
-
- boolean touchEvent = cls < mFactors[FACTOR_TOUCH];
- boolean motionEvent = !touchEvent && (cls < mFactors[FACTOR_MOTION]);
- if (touchEvent || motionEvent) {
- try {
- generateMotionEvent(random, motionEvent);
- } catch (RemoteException ex) {
- systemCrashed = true;
- break;
- }
- i++;
- continue;
- }
-
- if (cls < mFactors[FACTOR_TRACKBALL]) {
- try {
- generateTrackballEvent(random);
- } catch (RemoteException ex) {
- systemCrashed = true;
- break;
- }
- i++;
- continue;
- }
-
- // The remaining event categories are injected as key events
- if (cls < mFactors[FACTOR_NAV]) {
- lastKey = NAV_KEYS[random.nextInt(NAV_KEYS.length)];
- } else if (cls < mFactors[FACTOR_MAJORNAV]) {
- lastKey = MAJOR_NAV_KEYS[random.nextInt(MAJOR_NAV_KEYS.length)];
- } else if (cls < mFactors[FACTOR_SYSOPS]) {
- lastKey = SYS_KEYS[random.nextInt(SYS_KEYS.length)];
- } else if (cls < mFactors[FACTOR_APPSWITCH]) {
- if (!startRandomActivity(random)) {
- systemCrashed = true;
- break;
- }
- i++;
- continue;
- } else {
- lastKey = 1 + random.nextInt(KeyEvent.MAX_KEYCODE - 1);
- }
- if (mVerbose > 0) {
- try {
- System.out.println(":SendKey: " + lastKey + " // " + KEY_NAMES[lastKey]);
- } catch (ArrayIndexOutOfBoundsException e) {
- System.out.println(":SendKey: " + lastKey + " // Unknown key event");
- }
- }
- try {
- if (! mWm.injectKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, lastKey), false)) {
- mDroppedKeyEvents++;
- }
- } catch (RemoteException ex) {
- systemCrashed = true;
- break;
}
}
-
+
// If we got this far, we succeeded!
return mCount;
}
- /**
- * Generates a random motion event. This method counts a down, move, and up as one event.
- *
- * TODO: Test & fix the selectors when non-zero percentages
- * TODO: Longpress.
- * TODO: Fling.
- * TODO: Meta state
- * TODO: More useful than the random walk here would be to pick a single random direction
- * and distance, and divvy it up into a random number of segments. (This would serve to
- * generate fling gestures, which are important).
- *
- * @param random Random number source for positioning
- * @param motionEvent If false, touch/release. If true, touch/move/release.
- *
- * @throws RemoteException
- */
- private void generateMotionEvent(Random random, boolean motionEvent) throws RemoteException {
- Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
-
- float x = Math.abs(random.nextInt() % display.getWidth());
- float y = Math.abs(random.nextInt() % display.getHeight());
- long downAt = SystemClock.uptimeMillis();
- boolean drop = false;
- drop = sendMotionEvent(MotionEvent.ACTION_DOWN, x, y, downAt, "Pointer ACTION_DOWN", false,
- true);
-
- // sometimes we'll move during the touch
- if (motionEvent) {
- int count = random.nextInt(10);
- for (int i = 0 ; i < count ; i++) {
- // generate some slop in the up event
- x = (x + (random.nextInt() % 10)) % display.getWidth();
- y = (y + (random.nextInt() % 10)) % display.getHeight();
- drop |= sendMotionEvent(MotionEvent.ACTION_MOVE, x, y, downAt,
- "Pointer ACTION_MOVE", true, true);
- }
- }
-
- // TODO generate some slop in the up event
- drop |= sendMotionEvent(MotionEvent.ACTION_UP, x, y, downAt, "Pointer ACTION_UP", false,
- true);
-
- if (drop) {
- mDroppedPointerEvents++;
- }
- }
-
- /**
- * Sends a single motion event, either as a pointer or a trackball.
- *
- * @param action Must be one of the ACTION values defined in {@link MotionEvent}
- * @param x The position, or movement, in the X axis
- * @param y The position, or movement, in the Y axis
- * @param downAt The time of the first DOWN must be sent here, and the same value must
- * be sent for all subsequent events that are related (through the eventual UP event), or
- * -1 to simply send the current time as the downTime.
- * @param note This will be displayed when in verbose mode
- * @param intermediateNote If true, this is an intermediate step (more verbose logging, only)
- * @param isPointer Use true to send a pointer event, and false to send a trackball event
- *
- * @return Returns false if event was dispatched, true if it was dropped for any reason
- *
- * @throws RemoteException
- */
- private boolean sendMotionEvent(int action, float x, float y, long downAt, final String note,
- boolean intermediateNote, boolean isPointer) throws RemoteException {
- if ((mVerbose > 0 && !intermediateNote) || mVerbose > 1) {
- System.out.println(":Sending " + note + " x=" + x + " y=" + y);
- }
- long eventTime = SystemClock.uptimeMillis();
- if (downAt == -1) {
- downAt = eventTime;
- }
- final MotionEvent evt = MotionEvent.obtain(downAt, eventTime, action, x, y, 0);
- if (isPointer) {
- return ! mWm.injectPointerEvent(evt, false);
- } else {
- return ! mWm.injectTrackballEvent(evt, false);
- }
- }
-
- /**
- * Generates a random trackball event. This consists of a sequence of small moves, followed by
- * an optional single click.
- *
- * TODO: Longpress.
- * TODO: Meta state
- * TODO: Parameterize the % clicked
- * TODO: More useful than the random walk here would be to pick a single random direction
- * and distance, and divvy it up into a random number of segments. (This would serve to
- * generate fling gestures, which are important).
- *
- * @param random Random number source for positioning
- *
- * @throws RemoteException
- */
- private void generateTrackballEvent(Random random) throws RemoteException {
- Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
-
- boolean drop = false;
- int count = random.nextInt(10);
- for (int i = 0; i < 10; ++i) {
- // generate a small random step
- int dX = random.nextInt(10) - 5;
- int dY = random.nextInt(10) - 5;
- drop |= sendMotionEvent(MotionEvent.ACTION_MOVE, dX, dY, -1, "Trackball ACTION_MOVE",
- (i > 0), false);
- }
-
- // 10% of trackball moves end with a click
- if (0 == random.nextInt(10)) {
- long downAt = SystemClock.uptimeMillis();
- drop |= sendMotionEvent(MotionEvent.ACTION_DOWN, 0, 0, downAt, "Trackball ACTION_DOWN",
- true, false);
- drop |= sendMotionEvent(MotionEvent.ACTION_UP, 0, 0, downAt, "Trackball ACTION_UP",
- false, false);
- }
-
- if (drop) {
- mDroppedTrackballEvents++;
- }
- }
-
/**
* Send SIGNAL_USR1 to all processes. This will generate large (5mb) profiling reports
* in data/misc, so use with care.
@@ -1120,40 +769,6 @@ public class Monkey {
}
}
- /**
- * Have the activity manager start a new activity.
- *
- * @param random Random number source
- *
- * @return Returns true on success, false if there was an error calling
- * the activity manager.
- */
- private boolean startRandomActivity(Random random) {
- int numApps = mMainApps.size();
- int which = random.nextInt(numApps);
- ComponentName app = mMainApps.get(which);
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.addCategory(Intent.CATEGORY_LAUNCHER);
- intent.setComponent(app);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
- if (mVerbose > 0) {
- System.out.println(":Switch: " + intent.toURI());
- }
- try {
- mAm.startActivity(null, intent, null, null, 0, null, null, 0, false, false);
- } catch (RemoteException e) {
- System.err.println("** Failed talking with activity manager!");
- return false;
- } catch (SecurityException e) {
- if (mVerbose > 0) {
- System.out.println("** Permissions error starting activity " + intent.toURI());
- }
- return mIgnoreSecurityExceptions; // true = "launched ok" (pretend)
- }
- return true;
- }
-
/**
* Watch for appearance of new tombstone files, which indicate native crashes.
*
@@ -1185,7 +800,7 @@ public class Monkey {
/**
* Return the next command line option. This has a number of special cases which
* closely, but not exactly, follow the POSIX command line options patterns:
- *
+ *
* -- means to stop processing additional options
* -z means option z
* -z ARGS means option z with (non-optional) arguments ARGS
@@ -1274,17 +889,18 @@ public class Monkey {
* Print how to use this command.
*/
private void showUsage() {
- System.err.println("usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]");
- System.err.println(" [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]");
- System.err.println(" [--ignore-crashes] [--ignore-timeouts]");
- System.err.println(" [--ignore-security-exceptions] [--monitor-native-crashes]");
- System.err.println(" [--kill-process-after-error] [--hprof]");
- System.err.println(" [--pct-touch PERCENT] [--pct-motion PERCENT]");
- System.err.println(" [--pct-trackball PERCENT] [--pct-syskeys PERCENT]");
- System.err.println(" [--pct-nav PERCENT] [--pct-majornav PERCENT]");
- System.err.println(" [--pct-appswitch PERCENT] [--pct-anyevent PERCENT]");
- System.err.println(" [--wait-dbg] [--dbg-no-events]");
- System.err.println(" [-s SEED] [-v [-v] ...] [--throttle MILLISEC]");
- System.err.println(" COUNT");
- }
+ System.err.println("usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]");
+ System.err.println(" [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]");
+ System.err.println(" [--ignore-crashes] [--ignore-timeouts]");
+ System.err.println(" [--ignore-security-exceptions] [--monitor-native-crashes]");
+ System.err.println(" [--kill-process-after-error] [--hprof]");
+ System.err.println(" [--pct-touch PERCENT] [--pct-motion PERCENT]");
+ System.err.println(" [--pct-trackball PERCENT] [--pct-syskeys PERCENT]");
+ System.err.println(" [--pct-nav PERCENT] [--pct-majornav PERCENT]");
+ System.err.println(" [--pct-appswitch PERCENT] [--pct-flip PERCENT]");
+ System.err.println(" [--pct-anyevent PERCENT]");
+ System.err.println(" [--wait-dbg] [--dbg-no-events] [-f scriptfile]");
+ System.err.println(" [-s SEED] [-v [-v] ...] [--throttle MILLISEC]");
+ System.err.println(" COUNT");
+ }
}
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
new file mode 100644
index 000000000..68e6e6d7f
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.monkey;
+
+import android.app.IActivityManager;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.RemoteException;
+import android.view.IWindowManager;
+
+/**
+ * monkey activity event
+ */
+public class MonkeyActivityEvent extends MonkeyEvent {
+ private ComponentName mApp;
+
+ public MonkeyActivityEvent(ComponentName app) {
+ super(EVENT_TYPE_ACTIVITY);
+ mApp = app;
+ }
+
+ /**
+ * @return Intent for the new activity
+ */
+ private Intent getEvent() {
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.addCategory(Intent.CATEGORY_LAUNCHER);
+ intent.setComponent(mApp);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ return intent;
+ }
+
+ @Override
+ public int injectEvent(IWindowManager iwm, IActivityManager iam, int verbose) {
+ Intent intent = getEvent();
+ if (verbose > 0) {
+ System.out.println(":Switch: " + intent.toURI());
+ }
+ try {
+ iam.startActivity(null, intent, null, null, 0, null, null, 0,
+ false, false);
+ } catch (RemoteException e) {
+ System.err.println("** Failed talking with activity manager!");
+ return MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION;
+ } catch (SecurityException e) {
+ if (verbose > 0) {
+ System.out.println("** Permissions error starting activity "
+ + intent.toURI());
+ }
+ return MonkeyEvent.INJECT_ERROR_SECURITY_EXCEPTION;
+ }
+ return MonkeyEvent.INJECT_SUCCESS;
+ }
+}
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyEvent.java
new file mode 100644
index 000000000..ff99f5f06
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyEvent.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.monkey;
+
+import android.app.IActivityManager;
+import android.view.IWindowManager;
+
+/**
+ * abstract class for monkey event
+ */
+public abstract class MonkeyEvent {
+ protected int eventType;
+ public static final int EVENT_TYPE_KEY = 0;
+ public static final int EVENT_TYPE_POINTER = 1;
+ public static final int EVENT_TYPE_TRACKBALL = 2;
+ public static final int EVENT_TYPE_ACTIVITY = 3;
+ public static final int EVENT_TYPE_FLIP = 4; // Keyboard flip
+
+ public static final int INJECT_SUCCESS = 1;
+ public static final int INJECT_FAIL = 0;
+
+ // error code for remote exception during injection
+ public static final int INJECT_ERROR_REMOTE_EXCEPTION = -1;
+ // error code for security exception during injection
+ public static final int INJECT_ERROR_SECURITY_EXCEPTION = -2;
+
+ public MonkeyEvent(int type) {
+ eventType = type;
+ }
+
+ /**
+ * @return event type
+ */
+ public int getEventType() {
+ return eventType;
+ }
+
+ /**
+ * a method for injecting event
+ * @param iwm wires to current window manager
+ * @param iam wires to current activity manager
+ * @param verbose a log switch
+ * @return INJECT_SUCCESS if it goes through, and INJECT_FAIL if it fails
+ * in the case of exceptions, return its corresponding error code
+ */
+ public abstract int injectEvent(IWindowManager iwm, IActivityManager iam, int verbose);
+}
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyEventSource.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyEventSource.java
new file mode 100644
index 000000000..a236554a5
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyEventSource.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.monkey;
+
+/**
+ * event source interface
+ */
+public interface MonkeyEventSource {
+ /**
+ *
+ * @return the next monkey event from the source
+ */
+ public MonkeyEvent getNextEvent();
+
+ /**
+ * set verbose to allow different level of log
+ * @param verbose output mode? 1= verbose, 2=very verbose
+ */
+ public void setVerbose(int verbose);
+
+ /**
+ * check whether precondition is satisfied
+ * @return false if something fails, e.g. factor failure in random source
+ * or file can not open from script source etc
+ */
+ public boolean validate();
+}
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyFlipEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyFlipEvent.java
new file mode 100644
index 000000000..08fbedbc3
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyFlipEvent.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.commands.monkey;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import android.app.IActivityManager;
+import android.view.IWindowManager;
+/**
+ * monkey keyboard flip event
+ */
+public class MonkeyFlipEvent extends MonkeyEvent {
+
+ // Raw keyboard flip event data
+ // Works on emulator and dream
+
+ private static final byte[] FLIP_0 = {
+ 0x7f, 0x06,
+ 0x00, 0x00,
+ (byte) 0xe0, 0x39,
+ 0x01, 0x00,
+ 0x05, 0x00,
+ 0x00, 0x00,
+ 0x01, 0x00,
+ 0x00, 0x00 };
+
+ private static final byte[] FLIP_1 = {
+ (byte) 0x85, 0x06,
+ 0x00, 0x00,
+ (byte) 0x9f, (byte) 0xa5,
+ 0x0c, 0x00,
+ 0x05, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00 };
+
+ private final boolean mKeyboardOpen;
+
+ public MonkeyFlipEvent(boolean keyboardOpen) {
+ super(EVENT_TYPE_FLIP);
+ mKeyboardOpen = keyboardOpen;
+ }
+
+ @Override
+ public int injectEvent(IWindowManager iwm, IActivityManager iam, int verbose) {
+ if (verbose > 0) {
+ System.out.println(":Sending Flip keyboardOpen=" + mKeyboardOpen);
+ }
+
+ // inject flip event
+ try {
+ FileOutputStream f = new FileOutputStream("/dev/input/event0");
+ f.write(mKeyboardOpen ? FLIP_0 : FLIP_1);
+ f.close();
+ return MonkeyEvent.INJECT_SUCCESS;
+ } catch (IOException e) {
+ System.out.println("Got IOException performing flip" + e);
+ return MonkeyEvent.INJECT_FAIL;
+ }
+ }
+}
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyKeyEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyKeyEvent.java
new file mode 100644
index 000000000..c1e0ffce7
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyKeyEvent.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.monkey;
+
+import android.app.IActivityManager;
+import android.os.RemoteException;
+import android.view.IWindowManager;
+import android.view.KeyEvent;
+/**
+ * monkey key event
+ */
+public class MonkeyKeyEvent extends MonkeyEvent {
+ private long mDownTime = -1;
+ private int mMetaState = -1;
+ private int mAction = -1;
+ private int mKeyCode = -1;
+ private int mScancode = -1;
+ private int mRepeatCount = -1;
+ private int mDeviceId = -1;
+ private long mEventTime = -1;
+
+ public MonkeyKeyEvent(int action, int keycode) {
+ super(EVENT_TYPE_KEY);
+ mAction = action;
+ mKeyCode = keycode;
+ }
+
+ public MonkeyKeyEvent(long downTime, long eventTime, int action,
+ int code, int repeat, int metaState,
+ int device, int scancode) {
+ super(EVENT_TYPE_KEY);
+
+ mAction = action;
+ mKeyCode = code;
+ mMetaState = metaState;
+ mScancode = scancode;
+ mRepeatCount = repeat;
+ mDeviceId = device;
+ mDownTime = downTime;
+ mEventTime = eventTime;
+ }
+
+ public int getKeyCode() {
+ return mKeyCode;
+ }
+
+ public int getAction() {
+ return mAction;
+ }
+
+ public long getDownTime() {
+ return mDownTime;
+ }
+
+ public long getEventTime() {
+ return mEventTime;
+ }
+
+ public void setDownTime(long downTime) {
+ mDownTime = downTime;
+ }
+
+ public void setEventTime(long eventTime) {
+ mEventTime = eventTime;
+ }
+
+ /**
+ * @return the key event
+ */
+ private KeyEvent getEvent() {
+ if (mDeviceId < 0) {
+ return new KeyEvent(mAction, mKeyCode);
+ }
+
+ // for scripts
+ return new KeyEvent(mDownTime, mEventTime, mAction,
+ mKeyCode, mRepeatCount, mMetaState, mDeviceId, mScancode);
+ }
+
+ @Override
+ public int injectEvent(IWindowManager iwm, IActivityManager iam, int verbose) {
+ if (verbose > 1) {
+ String note;
+ if (mAction == KeyEvent.ACTION_UP) {
+ note = "ACTION_UP";
+ } else {
+ note = "ACTION_DOWN";
+ }
+
+ try {
+ System.out.println(":SendKey (" + note + "): "
+ + mKeyCode + " // "
+ + MonkeySourceRandom.getKeyName(mKeyCode));
+ } catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println(":SendKey (ACTION_UP): "
+ + mKeyCode + " // Unknown key event");
+ }
+ }
+
+ // inject key event
+ try {
+ if (!iwm.injectKeyEvent(getEvent(), false)) {
+ return MonkeyEvent.INJECT_FAIL;
+ }
+ } catch (RemoteException ex) {
+ return MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION;
+ }
+
+ return MonkeyEvent.INJECT_SUCCESS;
+ }
+}
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyMotionEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyMotionEvent.java
new file mode 100644
index 000000000..2657061be
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyMotionEvent.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.monkey;
+
+import android.app.IActivityManager;
+import android.os.RemoteException;
+import android.os.SystemClock;
+import android.view.IWindowManager;
+import android.view.MotionEvent;
+
+
+/**
+ * monkey motion event
+ */
+public class MonkeyMotionEvent extends MonkeyEvent {
+ private long mDownTime = -1;
+ private long mEventTime = -1;
+ private int mAction = -1;
+ private float mX = -1;
+ private float mY = -1;
+ private float mPressure = -1;
+ private float mSize = -1;
+ private int mMetaState = -1;
+ private float mXPrecision = -1;
+ private float mYPrecision = -1;
+ private int mDeviceId = -1;
+ private int mEdgeFlags = -1;
+
+ //If true, this is an intermediate step (more verbose logging, only)
+ private boolean mIntermediateNote;
+
+ public MonkeyMotionEvent(int type, long downAt, int action,
+ float x, float y, int metaState) {
+ super(type);
+ mDownTime = downAt;
+ mAction = action;
+ mX = x;
+ mY = y;
+ mMetaState = metaState;
+ }
+
+ public MonkeyMotionEvent(int type, long downTime, long eventTime, int action,
+ float x, float y, float pressure, float size, int metaState,
+ float xPrecision, float yPrecision, int deviceId, int edgeFlags) {
+ super(type);
+ mDownTime = downTime;
+ mEventTime = eventTime;
+ mAction = action;
+ mX = x;
+ mY = y;
+ mPressure = pressure;
+ mSize = size;
+ mMetaState = metaState;
+ mXPrecision = xPrecision;
+ mYPrecision = yPrecision;
+ mDeviceId = deviceId;
+ mEdgeFlags = edgeFlags;
+ }
+
+ public void setIntermediateNote(boolean b) {
+ mIntermediateNote = b;
+ }
+
+ public boolean getIntermediateNote() {
+ return mIntermediateNote;
+ }
+
+ public float getX() {
+ return mX;
+ }
+
+ public float getY() {
+ return mY;
+ }
+
+ public int getAction() {
+ return mAction;
+ }
+
+ public long getDownTime() {
+ return mDownTime;
+ }
+
+ public long getEventTime() {
+ return mEventTime;
+ }
+
+ public void setDownTime(long downTime) {
+ mDownTime = downTime;
+ }
+
+ public void setEventTime(long eventTime) {
+ mEventTime = eventTime;
+ }
+
+ /**
+ *
+ * @return instance of a motion event
+ */
+ private MotionEvent getEvent() {
+ if (mDeviceId < 0) {
+ return MotionEvent.obtain(mDownTime, SystemClock.uptimeMillis(),
+ mAction, mX, mY, mMetaState);
+ }
+
+ // for scripts
+ return MotionEvent.obtain(mDownTime, mEventTime,
+ mAction, mX, mY, mPressure, mSize, mMetaState,
+ mXPrecision, mYPrecision, mDeviceId, mEdgeFlags);
+ }
+
+ @Override
+ public int injectEvent(IWindowManager iwm, IActivityManager iam, int verbose) {
+
+ String note;
+ if ((verbose > 0 && !mIntermediateNote) || verbose > 1) {
+ if (mAction == MotionEvent.ACTION_DOWN) {
+ note = "DOWN";
+ } else if (mAction == MotionEvent.ACTION_UP) {
+ note = "UP";
+ } else {
+ note = "MOVE";
+ }
+ System.out.println(":Sending Pointer ACTION_" + note +
+ " x=" + mX + " y=" + mY);
+ }
+ try {
+ int type = this.getEventType();
+ MotionEvent me = getEvent();
+
+ if ((type == MonkeyEvent.EVENT_TYPE_POINTER &&
+ !iwm.injectPointerEvent(me, false))
+ || (type == MonkeyEvent.EVENT_TYPE_TRACKBALL &&
+ !iwm.injectTrackballEvent(me, false))) {
+ return MonkeyEvent.INJECT_FAIL;
+ }
+ } catch (RemoteException ex) {
+ return MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION;
+ }
+ return MonkeyEvent.INJECT_SUCCESS;
+ }
+}
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java
new file mode 100644
index 000000000..dd9284604
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java
@@ -0,0 +1,465 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.monkey;
+
+import android.content.ComponentName;
+import android.os.SystemClock;
+import android.view.Display;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.WindowManagerImpl;
+
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.Random;
+
+/**
+ * monkey event queue
+ */
+public class MonkeySourceRandom implements MonkeyEventSource{
+ /** Key events that move around the UI. */
+ private static final int[] NAV_KEYS = {
+ KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_DPAD_DOWN,
+ KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_RIGHT,
+ };
+ /**
+ * Key events that perform major navigation options (so shouldn't be sent
+ * as much).
+ */
+ private static final int[] MAJOR_NAV_KEYS = {
+ KeyEvent.KEYCODE_MENU, /*KeyEvent.KEYCODE_SOFT_RIGHT,*/
+ KeyEvent.KEYCODE_DPAD_CENTER,
+ };
+ /** Key events that perform system operations. */
+ private static final int[] SYS_KEYS = {
+ KeyEvent.KEYCODE_HOME, KeyEvent.KEYCODE_BACK,
+ KeyEvent.KEYCODE_CALL, KeyEvent.KEYCODE_ENDCALL,
+ KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN,
+ };
+ /** Nice names for all key events. */
+ private static final String[] KEY_NAMES = {
+ "KEYCODE_UNKNOWN",
+ "KEYCODE_MENU",
+ "KEYCODE_SOFT_RIGHT",
+ "KEYCODE_HOME",
+ "KEYCODE_BACK",
+ "KEYCODE_CALL",
+ "KEYCODE_ENDCALL",
+ "KEYCODE_0",
+ "KEYCODE_1",
+ "KEYCODE_2",
+ "KEYCODE_3",
+ "KEYCODE_4",
+ "KEYCODE_5",
+ "KEYCODE_6",
+ "KEYCODE_7",
+ "KEYCODE_8",
+ "KEYCODE_9",
+ "KEYCODE_STAR",
+ "KEYCODE_POUND",
+ "KEYCODE_DPAD_UP",
+ "KEYCODE_DPAD_DOWN",
+ "KEYCODE_DPAD_LEFT",
+ "KEYCODE_DPAD_RIGHT",
+ "KEYCODE_DPAD_CENTER",
+ "KEYCODE_VOLUME_UP",
+ "KEYCODE_VOLUME_DOWN",
+ "KEYCODE_POWER",
+ "KEYCODE_CAMERA",
+ "KEYCODE_CLEAR",
+ "KEYCODE_A",
+ "KEYCODE_B",
+ "KEYCODE_C",
+ "KEYCODE_D",
+ "KEYCODE_E",
+ "KEYCODE_F",
+ "KEYCODE_G",
+ "KEYCODE_H",
+ "KEYCODE_I",
+ "KEYCODE_J",
+ "KEYCODE_K",
+ "KEYCODE_L",
+ "KEYCODE_M",
+ "KEYCODE_N",
+ "KEYCODE_O",
+ "KEYCODE_P",
+ "KEYCODE_Q",
+ "KEYCODE_R",
+ "KEYCODE_S",
+ "KEYCODE_T",
+ "KEYCODE_U",
+ "KEYCODE_V",
+ "KEYCODE_W",
+ "KEYCODE_X",
+ "KEYCODE_Y",
+ "KEYCODE_Z",
+ "KEYCODE_COMMA",
+ "KEYCODE_PERIOD",
+ "KEYCODE_ALT_LEFT",
+ "KEYCODE_ALT_RIGHT",
+ "KEYCODE_SHIFT_LEFT",
+ "KEYCODE_SHIFT_RIGHT",
+ "KEYCODE_TAB",
+ "KEYCODE_SPACE",
+ "KEYCODE_SYM",
+ "KEYCODE_EXPLORER",
+ "KEYCODE_ENVELOPE",
+ "KEYCODE_ENTER",
+ "KEYCODE_DEL",
+ "KEYCODE_GRAVE",
+ "KEYCODE_MINUS",
+ "KEYCODE_EQUALS",
+ "KEYCODE_LEFT_BRACKET",
+ "KEYCODE_RIGHT_BRACKET",
+ "KEYCODE_BACKSLASH",
+ "KEYCODE_SEMICOLON",
+ "KEYCODE_APOSTROPHE",
+ "KEYCODE_SLASH",
+ "KEYCODE_AT",
+ "KEYCODE_NUM",
+ "KEYCODE_HEADSETHOOK",
+ "KEYCODE_FOCUS",
+ "KEYCODE_PLUS",
+ "KEYCODE_MENU",
+ "KEYCODE_NOTIFICATION",
+ "KEYCODE_SEARCH",
+ "KEYCODE_PLAYPAUSE",
+ "KEYCODE_STOP",
+ "KEYCODE_NEXTSONG",
+ "KEYCODE_PREVIOUSSONG",
+ "KEYCODE_REWIND",
+ "KEYCODE_FORWARD",
+
+ "TAG_LAST_KEYCODE" // EOL. used to keep the lists in sync
+ };
+
+ public static final int FACTOR_TOUCH = 0;
+ public static final int FACTOR_MOTION = 1;
+ public static final int FACTOR_TRACKBALL = 2;
+ public static final int FACTOR_NAV = 3;
+ public static final int FACTOR_MAJORNAV = 4;
+ public static final int FACTOR_SYSOPS = 5;
+ public static final int FACTOR_APPSWITCH = 6;
+ public static final int FACTOR_FLIP = 7;
+ public static final int FACTOR_ANYTHING = 8;
+ public static final int FACTORZ_COUNT = 9; // should be last+1
+
+
+ /** percentages for each type of event. These will be remapped to working
+ * values after we read any optional values.
+ **/
+ private float[] mFactors = new float[FACTORZ_COUNT];
+ private ArrayList mMainApps;
+ private int mEventCount = 0; //total number of events generated so far
+ private LinkedList mQ = new LinkedList();
+ private Random mRandom;
+ private int mVerbose = 0;
+
+ private boolean mKeyboardOpen = false;
+
+ /**
+ * @return the last name in the key list
+ */
+ public static String getLastKeyName() {
+ return KEY_NAMES[KeyEvent.getMaxKeyCode() + 1];
+ }
+
+ public static String getKeyName(int keycode) {
+ return KEY_NAMES[keycode];
+ }
+
+ public MonkeySourceRandom(long seed, ArrayList MainApps) {
+ // default values for random distributions
+ // note, these are straight percentages, to match user input (cmd line args)
+ // but they will be converted to 0..1 values before the main loop runs.
+ mFactors[FACTOR_TOUCH] = 15.0f;
+ mFactors[FACTOR_MOTION] = 10.0f;
+ mFactors[FACTOR_TRACKBALL] = 15.0f;
+ mFactors[FACTOR_NAV] = 25.0f;
+ mFactors[FACTOR_MAJORNAV] = 15.0f;
+ mFactors[FACTOR_SYSOPS] = 2.0f;
+ mFactors[FACTOR_APPSWITCH] = 2.0f;
+ mFactors[FACTOR_FLIP] = 1.0f;
+ mFactors[FACTOR_ANYTHING] = 15.0f;
+
+ mRandom = new SecureRandom();
+ mRandom.setSeed((seed == 0) ? -1 : seed);
+ mMainApps = MainApps;
+ }
+
+ /**
+ * Adjust the percentages (after applying user values) and then normalize to a 0..1 scale.
+ */
+ private boolean adjustEventFactors() {
+ // go through all values and compute totals for user & default values
+ float userSum = 0.0f;
+ float defaultSum = 0.0f;
+ int defaultCount = 0;
+ for (int i = 0; i < FACTORZ_COUNT; ++i) {
+ if (mFactors[i] <= 0.0f) { // user values are zero or negative
+ userSum -= mFactors[i];
+ } else {
+ defaultSum += mFactors[i];
+ ++defaultCount;
+ }
+ }
+
+ // if the user request was > 100%, reject it
+ if (userSum > 100.0f) {
+ System.err.println("** Event weights > 100%");
+ return false;
+ }
+
+ // if the user specified all of the weights, then they need to be 100%
+ if (defaultCount == 0 && (userSum < 99.9f || userSum > 100.1f)) {
+ System.err.println("** Event weights != 100%");
+ return false;
+ }
+
+ // compute the adjustment necessary
+ float defaultsTarget = (100.0f - userSum);
+ float defaultsAdjustment = defaultsTarget / defaultSum;
+
+ // fix all values, by adjusting defaults, or flipping user values back to >0
+ for (int i = 0; i < FACTORZ_COUNT; ++i) {
+ if (mFactors[i] <= 0.0f) { // user values are zero or negative
+ mFactors[i] = -mFactors[i];
+ } else {
+ mFactors[i] *= defaultsAdjustment;
+ }
+ }
+
+ // if verbose, show factors
+
+ if (mVerbose > 0) {
+ System.out.println("// Event percentages:");
+ for (int i = 0; i < FACTORZ_COUNT; ++i) {
+ System.out.println("// " + i + ": " + mFactors[i] + "%");
+ }
+ }
+
+ // finally, normalize and convert to running sum
+ float sum = 0.0f;
+ for (int i = 0; i < FACTORZ_COUNT; ++i) {
+ sum += mFactors[i] / 100.0f;
+ mFactors[i] = sum;
+ }
+ return true;
+ }
+
+ /**
+ * set the factors
+ *
+ * @param factors: percentages for each type of event
+ */
+ public void setFactors(float factors[]) {
+ int c = FACTORZ_COUNT;
+ if (factors.length < c) {
+ c = factors.length;
+ }
+ for (int i = 0; i < c; i++)
+ mFactors[i] = factors[i];
+ }
+
+ public void setFactors(int index, float v) {
+ mFactors[index] = v;
+ }
+
+ /**
+ * Generates a random motion event. This method counts a down, move, and up as multiple events.
+ *
+ * TODO: Test & fix the selectors when non-zero percentages
+ * TODO: Longpress.
+ * TODO: Fling.
+ * TODO: Meta state
+ * TODO: More useful than the random walk here would be to pick a single random direction
+ * and distance, and divvy it up into a random number of segments. (This would serve to
+ * generate fling gestures, which are important).
+ *
+ * @param random Random number source for positioning
+ * @param motionEvent If false, touch/release. If true, touch/move/release.
+ *
+ */
+ private void generateMotionEvent(Random random, boolean motionEvent){
+
+ Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
+
+ float x = Math.abs(random.nextInt() % display.getWidth());
+ float y = Math.abs(random.nextInt() % display.getHeight());
+ long downAt = SystemClock.uptimeMillis();
+ long eventTime = SystemClock.uptimeMillis();
+ if (downAt == -1) {
+ downAt = eventTime;
+ }
+
+ MonkeyMotionEvent e = new MonkeyMotionEvent(MonkeyEvent.EVENT_TYPE_POINTER,
+ downAt, MotionEvent.ACTION_DOWN, x, y, 0);
+ e.setIntermediateNote(false);
+ mQ.addLast(e);
+
+ // sometimes we'll move during the touch
+ if (motionEvent) {
+ int count = random.nextInt(10);
+ for (int i = 0; i < count; i++) {
+ // generate some slop in the up event
+ x = (x + (random.nextInt() % 10)) % display.getWidth();
+ y = (y + (random.nextInt() % 10)) % display.getHeight();
+
+ e = new MonkeyMotionEvent(MonkeyEvent.EVENT_TYPE_POINTER,
+ downAt, MotionEvent.ACTION_MOVE, x, y, 0);
+ e.setIntermediateNote(true);
+ mQ.addLast(e);
+ }
+ }
+
+ // TODO generate some slop in the up event
+ e = new MonkeyMotionEvent(MonkeyEvent.EVENT_TYPE_POINTER,
+ downAt, MotionEvent.ACTION_UP, x, y, 0);
+ e.setIntermediateNote(false);
+ mQ.addLast(e);
+ }
+
+ /**
+ * Generates a random trackball event. This consists of a sequence of small moves, followed by
+ * an optional single click.
+ *
+ * TODO: Longpress.
+ * TODO: Meta state
+ * TODO: Parameterize the % clicked
+ * TODO: More useful than the random walk here would be to pick a single random direction
+ * and distance, and divvy it up into a random number of segments. (This would serve to
+ * generate fling gestures, which are important).
+ *
+ * @param random Random number source for positioning
+ *
+ */
+ private void generateTrackballEvent(Random random) {
+ Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
+
+ boolean drop = false;
+ int count = random.nextInt(10);
+ MonkeyMotionEvent e;
+ for (int i = 0; i < 10; ++i) {
+ // generate a small random step
+ int dX = random.nextInt(10) - 5;
+ int dY = random.nextInt(10) - 5;
+
+
+ e = new MonkeyMotionEvent(MonkeyEvent.EVENT_TYPE_TRACKBALL, -1,
+ MotionEvent.ACTION_MOVE, dX, dY, 0);
+ e.setIntermediateNote(i > 0);
+ mQ.addLast(e);
+ }
+
+ // 10% of trackball moves end with a click
+ if (0 == random.nextInt(10)) {
+ long downAt = SystemClock.uptimeMillis();
+
+
+ e = new MonkeyMotionEvent(MonkeyEvent.EVENT_TYPE_TRACKBALL, downAt,
+ MotionEvent.ACTION_DOWN, 0, 0, 0);
+ e.setIntermediateNote(true);
+ mQ.addLast(e);
+
+
+ e = new MonkeyMotionEvent(MonkeyEvent.EVENT_TYPE_TRACKBALL, downAt,
+ MotionEvent.ACTION_UP, 0, 0, 0);
+ e.setIntermediateNote(false);
+ mQ.addLast(e);
+ }
+ }
+
+ /**
+ * generate a random event based on mFactor
+ */
+ private void generateEvents() {
+ float cls = mRandom.nextFloat();
+ int lastKey = 0;
+
+ boolean touchEvent = cls < mFactors[FACTOR_TOUCH];
+ boolean motionEvent = !touchEvent && (cls < mFactors[FACTOR_MOTION]);
+ if (touchEvent || motionEvent) {
+ generateMotionEvent(mRandom, motionEvent);
+ return;
+ }
+
+ if (cls < mFactors[FACTOR_TRACKBALL]) {
+ generateTrackballEvent(mRandom);
+ return;
+ }
+
+ // The remaining event categories are injected as key events
+ if (cls < mFactors[FACTOR_NAV]) {
+ lastKey = NAV_KEYS[mRandom.nextInt(NAV_KEYS.length)];
+ } else if (cls < mFactors[FACTOR_MAJORNAV]) {
+ lastKey = MAJOR_NAV_KEYS[mRandom.nextInt(MAJOR_NAV_KEYS.length)];
+ } else if (cls < mFactors[FACTOR_SYSOPS]) {
+ lastKey = SYS_KEYS[mRandom.nextInt(SYS_KEYS.length)];
+ } else if (cls < mFactors[FACTOR_APPSWITCH]) {
+ MonkeyActivityEvent e = new MonkeyActivityEvent(mMainApps.get(
+ mRandom.nextInt(mMainApps.size())));
+ mQ.addLast(e);
+ return;
+ } else if (cls < mFactors[FACTOR_FLIP]) {
+ MonkeyFlipEvent e = new MonkeyFlipEvent(mKeyboardOpen);
+ mKeyboardOpen = !mKeyboardOpen;
+ mQ.addLast(e);
+ return;
+ } else {
+ lastKey = 1 + mRandom.nextInt(KeyEvent.getMaxKeyCode() - 1);
+ }
+
+ MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN, lastKey);
+ mQ.addLast(e);
+
+ e = new MonkeyKeyEvent(KeyEvent.ACTION_UP, lastKey);
+ mQ.addLast(e);
+ }
+
+ public boolean validate() {
+ //check factors
+ return adjustEventFactors();
+ }
+
+ public void setVerbose(int verbose) {
+ mVerbose = verbose;
+ }
+
+ /**
+ * generate an activity event
+ */
+ public void generateActivity() {
+ MonkeyActivityEvent e = new MonkeyActivityEvent(mMainApps.get(
+ mRandom.nextInt(mMainApps.size())));
+ mQ.addLast(e);
+ }
+
+ /**
+ * if the queue is empty, we generate events first
+ * @return the first event in the queue
+ */
+ public MonkeyEvent getNextEvent() {
+ if (mQ.isEmpty()) {
+ generateEvents();
+ }
+ mEventCount++;
+ MonkeyEvent e = mQ.getFirst();
+ mQ.removeFirst();
+ return e;
+ }
+}
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
new file mode 100644
index 000000000..aadda9f62
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
@@ -0,0 +1,427 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.monkey;
+
+import android.os.SystemClock;
+import android.view.KeyEvent;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.LinkedList;
+import java.util.StringTokenizer;
+
+/**
+ * monkey event queue. It takes a script to produce events
+ *
+ * sample script format:
+ * type= raw events
+ * count= 10
+ * speed= 1.0
+ * captureDispatchPointer(5109520,5109520,0,230.75429,458.1814,0.20784314,
+ * 0.06666667,0,0.0,0.0,65539,0)
+ * captureDispatchKey(5113146,5113146,0,20,0,0,0,0)
+ * captureDispatchFlip(true)
+ * ...
+ */
+public class MonkeySourceScript implements MonkeyEventSource{
+ private int mEventCountInScript = 0; //total number of events in the file
+ private int mVerbose = 0;
+ private double mSpeed = 1.0;
+ private String mScriptFileName;
+ private LinkedList mQ = new LinkedList();
+
+ private static final String HEADER_TYPE = "type=";
+ private static final String HEADER_COUNT = "count=";
+ private static final String HEADER_SPEED = "speed=";
+
+ private long mLastRecordedDownTimeKey = 0;
+ private long mLastRecordedDownTimeMotion = 0;
+ private long mLastExportDownTimeKey = 0;
+ private long mLastExportDownTimeMotion = 0;
+ private long mLastExportEventTime = -1;
+ private long mLastRecordedEventTime = -1;
+
+ private static final boolean THIS_DEBUG = false;
+ // a parameter that compensates the difference of real elapsed time and
+ // time in theory
+ private static final long SLEEP_COMPENSATE_DIFF = 16;
+
+ // maximum number of events that we read at one time
+ private static final int MAX_ONE_TIME_READS = 100;
+
+ // number of additional events added to the script
+ // add HOME_KEY down and up events to make start UI consistent in each round
+ private static final int POLICY_ADDITIONAL_EVENT_COUNT = 2;
+
+ // event key word in the capture log
+ private static final String EVENT_KEYWORD_POINTER = "DispatchPointer";
+ private static final String EVENT_KEYWORD_TRACKBALL = "DispatchTrackball";
+ private static final String EVENT_KEYWORD_KEY = "DispatchKey";
+ private static final String EVENT_KEYWORD_FLIP = "DispatchFlip";
+
+ // a line at the end of the header
+ private static final String STARTING_DATA_LINE = "start data >>";
+ private boolean mFileOpened = false;
+ FileInputStream mFStream;
+ DataInputStream mInputStream;
+ BufferedReader mBufferReader;
+
+ public MonkeySourceScript(String filename) {
+ mScriptFileName = filename;
+ }
+
+ /**
+ *
+ * @return the number of total events that will be generated in a round
+ */
+ public int getOneRoundEventCount() {
+ //plus one home key down and up event
+ return mEventCountInScript + POLICY_ADDITIONAL_EVENT_COUNT;
+ }
+
+ private void resetValue() {
+ mLastRecordedDownTimeKey = 0;
+ mLastRecordedDownTimeMotion = 0;
+ mLastExportDownTimeKey = 0;
+ mLastExportDownTimeMotion = 0;
+ mLastRecordedEventTime = -1;
+ mLastExportEventTime = -1;
+ }
+
+ private boolean readScriptHeader() {
+ mEventCountInScript = -1;
+ mFileOpened = false;
+ try {
+ if (THIS_DEBUG) {
+ System.out.println("reading script header");
+ }
+
+ mFStream = new FileInputStream(mScriptFileName);
+ mInputStream = new DataInputStream(mFStream);
+ mBufferReader = new BufferedReader(
+ new InputStreamReader(mInputStream));
+ String sLine;
+ while ((sLine = mBufferReader.readLine()) != null) {
+ sLine = sLine.trim();
+ if (sLine.indexOf(HEADER_TYPE) >= 0) {
+ // at this point, we only have one type of script
+ } else if (sLine.indexOf(HEADER_COUNT) >= 0) {
+ try {
+ mEventCountInScript = Integer.parseInt(sLine.substring(
+ HEADER_COUNT.length() + 1).trim());
+ } catch (NumberFormatException e) {
+ System.err.println(e);
+ }
+ } else if (sLine.indexOf(HEADER_SPEED) >= 0) {
+ try {
+ mSpeed = Double.parseDouble(sLine.substring(
+ HEADER_SPEED.length() + 1).trim());
+
+ } catch (NumberFormatException e) {
+ System.err.println(e);
+ }
+ } else if (sLine.indexOf(STARTING_DATA_LINE) >= 0) {
+ // header ends until we read the start data mark
+ mFileOpened = true;
+ if (THIS_DEBUG) {
+ System.out.println("read script header success");
+ }
+ return true;
+ }
+ }
+ } catch (FileNotFoundException e) {
+ System.err.println(e);
+ } catch (IOException e) {
+ System.err.println(e);
+ }
+
+ if (THIS_DEBUG) {
+ System.out.println("Error in reading script header");
+ }
+ return false;
+ }
+
+ private void processLine(String s) {
+ int index1 = s.indexOf('(');
+ int index2 = s.indexOf(')');
+
+ if (index1 < 0 || index2 < 0) {
+ return;
+ }
+
+ StringTokenizer st = new StringTokenizer(
+ s.substring(index1 + 1, index2), ",");
+
+ if (s.indexOf(EVENT_KEYWORD_KEY) >= 0) {
+ // key events
+ try {
+ long downTime = Long.parseLong(st.nextToken());
+ long eventTime = Long.parseLong(st.nextToken());
+ int action = Integer.parseInt(st.nextToken());
+ int code = Integer.parseInt(st.nextToken());
+ int repeat = Integer.parseInt(st.nextToken());
+ int metaState = Integer.parseInt(st.nextToken());
+ int device = Integer.parseInt(st.nextToken());
+ int scancode = Integer.parseInt(st.nextToken());
+
+ MonkeyKeyEvent e = new MonkeyKeyEvent(downTime, eventTime,
+ action, code, repeat, metaState, device, scancode);
+ mQ.addLast(e);
+
+ } catch (NumberFormatException e) {
+ // something wrong with this line in the script
+ }
+ } else if (s.indexOf(EVENT_KEYWORD_POINTER) >= 0 ||
+ s.indexOf(EVENT_KEYWORD_TRACKBALL) >= 0) {
+ // trackball/pointer event
+ try {
+ long downTime = Long.parseLong(st.nextToken());
+ long eventTime = Long.parseLong(st.nextToken());
+ int action = Integer.parseInt(st.nextToken());
+ float x = Float.parseFloat(st.nextToken());
+ float y = Float.parseFloat(st.nextToken());
+ float pressure = Float.parseFloat(st.nextToken());
+ float size = Float.parseFloat(st.nextToken());
+ int metaState = Integer.parseInt(st.nextToken());
+ float xPrecision = Float.parseFloat(st.nextToken());
+ float yPrecision = Float.parseFloat(st.nextToken());
+ int device = Integer.parseInt(st.nextToken());
+ int edgeFlags = Integer.parseInt(st.nextToken());
+
+ int type = MonkeyEvent.EVENT_TYPE_TRACKBALL;
+ if (s.indexOf("Pointer") > 0) {
+ type = MonkeyEvent.EVENT_TYPE_POINTER;
+ }
+ MonkeyMotionEvent e = new MonkeyMotionEvent(type, downTime, eventTime,
+ action, x, y, pressure, size, metaState, xPrecision, yPrecision,
+ device, edgeFlags);
+ mQ.addLast(e);
+ } catch (NumberFormatException e) {
+ // we ignore this event
+ }
+ } else if (s.indexOf(EVENT_KEYWORD_FLIP) >= 0) {
+ boolean keyboardOpen = Boolean.parseBoolean(st.nextToken());
+ MonkeyFlipEvent e = new MonkeyFlipEvent(keyboardOpen);
+ mQ.addLast(e);
+ }
+ }
+
+ private void closeFile() {
+ mFileOpened = false;
+ if (THIS_DEBUG) {
+ System.out.println("closing script file");
+ }
+
+ try {
+ mFStream.close();
+ mInputStream.close();
+ } catch (IOException e) {
+ System.out.println(e);
+ }
+ }
+
+ /**
+ * add home key press/release event to the queue
+ */
+ private void addHomeKeyEvent() {
+ MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN,
+ KeyEvent.KEYCODE_HOME);
+ mQ.addLast(e);
+ e = new MonkeyKeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HOME);
+ mQ.addLast(e);
+ }
+
+ /**
+ * read next batch of events from the provided script file
+ * @return true if success
+ */
+ private boolean readNextBatch() {
+ String sLine = null;
+ int readCount = 0;
+
+ if (THIS_DEBUG) {
+ System.out.println("readNextBatch(): reading next batch of events");
+ }
+
+ if (!mFileOpened) {
+ if (!readScriptHeader()) {
+ closeFile();
+ return false;
+ }
+ resetValue();
+
+ /*
+ * In order to allow the Monkey to replay captured events multiple times
+ * we need to define a default start UI, which is the home screen
+ * Otherwise, it won't be accurate since the captured events
+ * could end anywhere
+ */
+ addHomeKeyEvent();
+ }
+
+ try {
+ while (readCount++ < MAX_ONE_TIME_READS &&
+ (sLine = mBufferReader.readLine()) != null) {
+ sLine = sLine.trim();
+ processLine(sLine);
+ }
+ } catch (IOException e) {
+ System.err.println(e);
+ return false;
+ }
+
+ if (sLine == null) {
+ // to the end of the file
+ if (THIS_DEBUG) {
+ System.out.println("readNextBatch(): to the end of file");
+ }
+ closeFile();
+ }
+ return true;
+ }
+
+ /**
+ * sleep for a period of given time, introducing latency among events
+ * @param time to sleep in millisecond
+ */
+ private void needSleep(long time) {
+ if (time < 1) {
+ return;
+ }
+ try {
+ Thread.sleep(time);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ /**
+ * check whether we can successfully read the header of the script file
+ */
+ public boolean validate() {
+ boolean b = readNextBatch();
+ if (mVerbose > 0) {
+ System.out.println("Replaying " + mEventCountInScript +
+ " events with speed " + mSpeed);
+ }
+ return b;
+ }
+
+ public void setVerbose(int verbose) {
+ mVerbose = verbose;
+ }
+
+ /**
+ * adjust key downtime and eventtime according to both
+ * recorded values and current system time
+ * @param e KeyEvent
+ */
+ private void adjustKeyEventTime(MonkeyKeyEvent e) {
+ if (e.getEventTime() < 0) {
+ return;
+ }
+ long thisDownTime = 0;
+ long thisEventTime = 0;
+ long expectedDelay = 0;
+
+ if (mLastRecordedEventTime <= 0) {
+ // first time event
+ thisDownTime = SystemClock.uptimeMillis();
+ thisEventTime = thisDownTime;
+ } else {
+ if (e.getDownTime() != mLastRecordedDownTimeKey) {
+ thisDownTime = e.getDownTime();
+ } else {
+ thisDownTime = mLastExportDownTimeKey;
+ }
+ expectedDelay = (long) ((e.getEventTime() -
+ mLastRecordedEventTime) * mSpeed);
+ thisEventTime = mLastExportEventTime + expectedDelay;
+ // add sleep to simulate everything in recording
+ needSleep(expectedDelay - SLEEP_COMPENSATE_DIFF);
+ }
+ mLastRecordedDownTimeKey = e.getDownTime();
+ mLastRecordedEventTime = e.getEventTime();
+ e.setDownTime(thisDownTime);
+ e.setEventTime(thisEventTime);
+ mLastExportDownTimeKey = thisDownTime;
+ mLastExportEventTime = thisEventTime;
+ }
+
+ /**
+ * adjust motion downtime and eventtime according to both
+ * recorded values and current system time
+ * @param e KeyEvent
+ */
+ private void adjustMotionEventTime(MonkeyMotionEvent e) {
+ if (e.getEventTime() < 0) {
+ return;
+ }
+ long thisDownTime = 0;
+ long thisEventTime = 0;
+ long expectedDelay = 0;
+
+ if (mLastRecordedEventTime <= 0) {
+ // first time event
+ thisDownTime = SystemClock.uptimeMillis();
+ thisEventTime = thisDownTime;
+ } else {
+ if (e.getDownTime() != mLastRecordedDownTimeMotion) {
+ thisDownTime = e.getDownTime();
+ } else {
+ thisDownTime = mLastExportDownTimeMotion;
+ }
+ expectedDelay = (long) ((e.getEventTime() -
+ mLastRecordedEventTime) * mSpeed);
+ thisEventTime = mLastExportEventTime + expectedDelay;
+ // add sleep to simulate everything in recording
+ needSleep(expectedDelay - SLEEP_COMPENSATE_DIFF);
+ }
+
+ mLastRecordedDownTimeMotion = e.getDownTime();
+ mLastRecordedEventTime = e.getEventTime();
+ e.setDownTime(thisDownTime);
+ e.setEventTime(thisEventTime);
+ mLastExportDownTimeMotion = thisDownTime;
+ mLastExportEventTime = thisEventTime;
+ }
+
+ /**
+ * if the queue is empty, we generate events first
+ * @return the first event in the queue, if null, indicating the system crashes
+ */
+ public MonkeyEvent getNextEvent() {
+ long recordedEventTime = -1;
+
+ if (mQ.isEmpty()) {
+ readNextBatch();
+ }
+ MonkeyEvent e = mQ.getFirst();
+ mQ.removeFirst();
+
+ if (e.getEventType() == MonkeyEvent.EVENT_TYPE_KEY) {
+ adjustKeyEventTime((MonkeyKeyEvent) e);
+ } else if (e.getEventType() == MonkeyEvent.EVENT_TYPE_POINTER ||
+ e.getEventType() == MonkeyEvent.EVENT_TYPE_TRACKBALL) {
+ adjustMotionEventTime((MonkeyMotionEvent) e);
+ }
+ return e;
+ }
+}
diff --git a/emulator/qemud/qemud.c b/emulator/qemud/qemud.c
index 47d4d5f04..3a53716b8 100644
--- a/emulator/qemud/qemud.c
+++ b/emulator/qemud/qemud.c
@@ -151,7 +151,7 @@ xalloc0( size_t sz )
#define xnew0(p) (p) = xalloc0(sizeof(*(p)))
-#define xfree(p) ({ free((p)), (p) = NULL; })
+#define xfree(p) (free((p)), (p) = NULL)
static void*
xrealloc( void* block, size_t size )
@@ -622,13 +622,6 @@ fdhandler_event( FDHandler* f, int events )
{
int len;
- if (events & (EPOLLHUP|EPOLLERR)) {
- /* disconnection */
- D("%s: disconnect on fd %d", __FUNCTION__, f->fd);
- receiver_close( f->receiver );
- return;
- }
-
if (events & EPOLLIN) {
Packet* p = packet_alloc();
int len;
@@ -643,6 +636,19 @@ fdhandler_event( FDHandler* f, int events )
}
}
+ /* in certain cases, it's possible to have both EPOLLIN and
+ * EPOLLHUP at the same time. This indicates that there is incoming
+ * data to read, but that the connection was nonetheless closed
+ * by the sender. Be sure to read the data before closing
+ * the receiver to avoid packet loss.
+ */
+ if (events & (EPOLLHUP|EPOLLERR)) {
+ /* disconnection */
+ D("%s: disconnect on fd %d", __FUNCTION__, f->fd);
+ receiver_close( f->receiver );
+ return;
+ }
+
if (events & EPOLLOUT && f->out_first) {
Packet* p = f->out_first;
int avail, len;
@@ -687,13 +693,6 @@ fdhandler_init( FDHandler* f,
static void
fdhandler_accept_event( FDHandler* f, int events )
{
- if (events & (EPOLLHUP|EPOLLERR)) {
- /* disconnecting !! */
- D("%s: closing fd %d", __FUNCTION__, f->fd);
- receiver_close( f->receiver );
- return;
- }
-
if (events & EPOLLIN) {
/* this is an accept - send a dummy packet to the receiver */
Packet* p = packet_alloc();
@@ -703,6 +702,13 @@ fdhandler_accept_event( FDHandler* f, int events )
p->len = 1;
receiver_post( f->receiver, p );
}
+
+ if (events & (EPOLLHUP|EPOLLERR)) {
+ /* disconnecting !! */
+ D("%s: closing fd %d", __FUNCTION__, f->fd);
+ receiver_close( f->receiver );
+ return;
+ }
}
@@ -1243,8 +1249,9 @@ static Multiplexer _multiplexer[1];
#define QEMUD_PREFIX "qemud_"
static const struct { const char* name; ChannelType ctype; } default_channels[] = {
- { "gsm", CHANNEL_DUPLEX }, /* GSM AT command channel, used by commands/rild/rild.c */
- { "gps", CHANNEL_BROADCAST }, /* GPS NMEA commands, used by libs/hardware/qemu_gps.c */
+ { "gsm", CHANNEL_DUPLEX }, /* GSM AT command channel, used by commands/rild/rild.c */
+ { "gps", CHANNEL_BROADCAST }, /* GPS NMEA commands, used by libs/hardware/qemu_gps.c */
+ { "control", CHANNEL_DUPLEX }, /* Used for power/leds/vibrator/etc... */
{ NULL, 0 }
};
diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath
index a6c264712..c2be635a1 100644
--- a/ide/eclipse/.classpath
+++ b/ide/eclipse/.classpath
@@ -36,6 +36,7 @@
+
@@ -47,6 +48,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -73,12 +89,14 @@
+
+
diff --git a/ide/xcode/SampleCode/SampleCode.xcodeproj/project.pbxproj b/ide/xcode/SampleCode/SampleCode.xcodeproj/project.pbxproj
index 22629d054..826bb6aa2 100644
--- a/ide/xcode/SampleCode/SampleCode.xcodeproj/project.pbxproj
+++ b/ide/xcode/SampleCode/SampleCode.xcodeproj/project.pbxproj
@@ -7,23 +7,38 @@
objects = {
/* Begin PBXBuildFile section */
+ 0007A8F30DB4DFF30068AF40 /* SampleXfermodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0007A8F20DB4DFF30068AF40 /* SampleXfermodes.cpp */; };
0008AEE10DABF08F00477EFB /* libgiflib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0008AEDE0DABF01400477EFB /* libgiflib.a */; };
000A1CB00DA522ED003DAC04 /* SamplePolyToPoly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 000A1CAF0DA522ED003DAC04 /* SamplePolyToPoly.cpp */; };
000DC0C60D63796E00854F5A /* SampleTextAlpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 000DC0C50D63796E00854F5A /* SampleTextAlpha.cpp */; };
+ 001142AB0DCA20650070D0A3 /* SamplePicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 001142AA0DCA20650070D0A3 /* SamplePicture.cpp */; };
0017F1490D6A0A6A008D9B31 /* SampleEmboss.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0017F1460D6A0A6A008D9B31 /* SampleEmboss.cpp */; };
0017F14A0D6A0A6A008D9B31 /* SampleLines.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0017F1470D6A0A6A008D9B31 /* SampleLines.cpp */; };
- 0017F14B0D6A0A6A008D9B31 /* SamplePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0017F1480D6A0A6A008D9B31 /* SamplePatch.cpp */; };
0017F2CF0D6F3933008D9B31 /* libgraphics.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00ED8C440D3E999300651393 /* libgraphics.a */; };
0017F2D00D6F393F008D9B31 /* libcorecg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00ED8C2C0D3E999300651393 /* libcorecg.a */; };
0017F2D60D6F3949008D9B31 /* libviews.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00ED8C5E0D3E999300651393 /* libviews.a */; };
+ 0019628A0EACB9D300447A07 /* SamplePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 001962890EACB9D300447A07 /* SamplePatch.cpp */; };
+ 001962900EACBA2A00447A07 /* SamplePageFlip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0019628F0EACBA2A00447A07 /* SamplePageFlip.cpp */; };
+ 002919440DEBA08100AF67D5 /* SkBitmapFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002919430DEBA08100AF67D5 /* SkBitmapFilter.cpp */; };
+ 002919510DEC39C700AF67D5 /* SkConvolutionBitmapFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002919500DEC39C700AF67D5 /* SkConvolutionBitmapFilter.cpp */; };
+ 00298C2A0E7085E7005E85ED /* SampleStrokeText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00298C290E7085E7005E85ED /* SampleStrokeText.cpp */; };
003474ED0D5B61BA00F3F389 /* SampleVertices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 003474EC0D5B61BA00F3F389 /* SampleVertices.cpp */; };
+ 003476840DF8DEC400A270A4 /* SampleCircle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 003476830DF8DEC400A270A4 /* SampleCircle.cpp */; };
+ 003A10170E0C29F800136848 /* SampleOverflow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 003A10160E0C29F800136848 /* SampleOverflow.cpp */; };
003FA70A0D58CA4D0063AD75 /* SampleMeasure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 003FA7090D58CA4D0063AD75 /* SampleMeasure.cpp */; };
+ 0061A77B0DB7A7150007094E /* SampleFillType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0061A77A0DB7A7150007094E /* SampleFillType.cpp */; };
+ 00648B5A0DDB15B90087F2E8 /* SampleTypeface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00648B590DDB15B90087F2E8 /* SampleTypeface.cpp */; };
00685FCE0D8A16C300CD71AA /* SampleAll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00ED8C650D3E99A800651393 /* SampleAll.cpp */; };
006860100D8A1C8B00CD71AA /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0068600F0D8A1C8A00CD71AA /* OpenGL.framework */; };
006860290D8A1DFB00CD71AA /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006860280D8A1DFB00CD71AA /* AGL.framework */; };
0071BCEF0D746BDF00F667CE /* SampleFilter2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0071BCEE0D746BDF00F667CE /* SampleFilter2.cpp */; };
- 007ECA770DA684A90086775A /* libpvjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 007ECA760DA684A20086775A /* libpvjpeg.a */; };
009A74250DA11C5D00876C03 /* libGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009A740E0DA11B1F00876C03 /* libGL.a */; };
+ 00B8EBFC0EB64ABC003C2F6F /* SampleDrawLooper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00B8EBFB0EB64ABC003C2F6F /* SampleDrawLooper.cpp */; };
+ 00C5D1E10EBFFE4D00C6702C /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00C5D1E00EBFFE4D00C6702C /* test.cpp */; };
+ 00C5D1E50EC0007400C6702C /* test_drawcolor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00C5D1E40EC0007400C6702C /* test_drawcolor.cpp */; };
+ 00C5D2010EC00F0300C6702C /* SampleTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00C5D2000EC00F0300C6702C /* SampleTests.cpp */; };
+ 00C5D20E0EC0106F00C6702C /* test_drawrect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00C5D1F00EC0044600C6702C /* test_drawrect.cpp */; };
+ 00D12E4D0DAD3D0A003918C5 /* libanimator.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0013C7920D94043200B41703 /* libanimator.a */; };
00D315710D5A5B1D004B2209 /* SampleBitmapRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00D315700D5A5B1D004B2209 /* SampleBitmapRect.cpp */; };
00ED8C7C0D3E99A800651393 /* SampleApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00ED8C660D3E99A800651393 /* SampleApp.cpp */; };
00ED8C7D0D3E99A800651393 /* SampleArc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00ED8C670D3E99A800651393 /* SampleArc.cpp */; };
@@ -52,6 +67,7 @@
00ED8CDD0D3E9FE700651393 /* libports-mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00ED8C520D3E999300651393 /* libports-mac.a */; };
00ED8CDE0D3E9FEA00651393 /* libports.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00ED8C580D3E999300651393 /* libports.a */; };
00ED8CE00D3E9FEF00651393 /* libzlib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00ED8C620D3E999300651393 /* libzlib.a */; };
+ 00F9D6860E7F51680031AAA2 /* SkSetPoly3To3_A.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00F9D6850E7F51670031AAA2 /* SkSetPoly3To3_A.cpp */; };
8D0C4E8D0486CD37000505A6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
8D0C4E8E0486CD37000505A6 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; };
8D0C4E920486CD37000505A6 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20286C33FDCF999611CA2CEA /* Carbon.framework */; };
@@ -62,14 +78,14 @@
isa = PBXContainerItemProxy;
containerPortal = 0008AED90DABF01300477EFB /* giflib.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = D2AAC046055464E500DB518D /* libgiflib.a */;
+ remoteGlobalIDString = D2AAC046055464E500DB518D;
remoteInfo = giflib;
};
0008AF0F0DABF9BD00477EFB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0008AED90DABF01300477EFB /* giflib.xcodeproj */;
proxyType = 1;
- remoteGlobalIDString = D2AAC045055464E500DB518D /* giflib */;
+ remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = giflib;
};
0013C7910D94043200B41703 /* PBXContainerItemProxy */ = {
@@ -86,20 +102,6 @@
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = animator;
};
- 007ECA750DA684A20086775A /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 007ECA710DA684A20086775A /* pvjpeg.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = D2AAC046055464E500DB518D;
- remoteInfo = pvjpeg;
- };
- 007ECA7B0DA684CF0086775A /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 007ECA710DA684A20086775A /* pvjpeg.xcodeproj */;
- proxyType = 1;
- remoteGlobalIDString = D2AAC045055464E500DB518D;
- remoteInfo = pvjpeg;
- };
009A740D0DA11B1F00876C03 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 009A74060DA11B1F00876C03 /* GL.xcodeproj */;
@@ -257,22 +259,42 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 0007A8F20DB4DFF30068AF40 /* SampleXfermodes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleXfermodes.cpp; path = ../../../tests/skia/SampleCode/SampleXfermodes.cpp; sourceTree = SOURCE_ROOT; };
0008AED90DABF01300477EFB /* giflib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = giflib.xcodeproj; path = ../giflib.xcodeproj; sourceTree = SOURCE_ROOT; };
000A1CAF0DA522ED003DAC04 /* SamplePolyToPoly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SamplePolyToPoly.cpp; path = ../../../tests/skia/SampleCode/SamplePolyToPoly.cpp; sourceTree = SOURCE_ROOT; };
000DC0C50D63796E00854F5A /* SampleTextAlpha.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleTextAlpha.cpp; path = ../../../tests/skia/SampleCode/SampleTextAlpha.cpp; sourceTree = SOURCE_ROOT; };
+ 001142AA0DCA20650070D0A3 /* SamplePicture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SamplePicture.cpp; path = ../../../tests/skia/SampleCode/SamplePicture.cpp; sourceTree = SOURCE_ROOT; };
0013C78A0D94043200B41703 /* animator.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = animator.xcodeproj; path = ../animator.xcodeproj; sourceTree = SOURCE_ROOT; };
0017F1460D6A0A6A008D9B31 /* SampleEmboss.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleEmboss.cpp; path = ../../../tests/skia/SampleCode/SampleEmboss.cpp; sourceTree = SOURCE_ROOT; };
0017F1470D6A0A6A008D9B31 /* SampleLines.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleLines.cpp; path = ../../../tests/skia/SampleCode/SampleLines.cpp; sourceTree = SOURCE_ROOT; };
- 0017F1480D6A0A6A008D9B31 /* SamplePatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SamplePatch.cpp; path = ../../../tests/skia/SampleCode/SamplePatch.cpp; sourceTree = SOURCE_ROOT; };
0017F1510D6A0A8A008D9B31 /* SkGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkGeometry.h; path = ../../../libs/graphics/sgl/SkGeometry.h; sourceTree = SOURCE_ROOT; };
+ 001962890EACB9D300447A07 /* SamplePatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SamplePatch.cpp; path = ../../../tests/skia/SampleCode/SamplePatch.cpp; sourceTree = SOURCE_ROOT; };
+ 0019628F0EACBA2A00447A07 /* SamplePageFlip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SamplePageFlip.cpp; path = ../../../tests/skia/SampleCode/SamplePageFlip.cpp; sourceTree = SOURCE_ROOT; };
+ 002919430DEBA08100AF67D5 /* SkBitmapFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkBitmapFilter.cpp; path = ../../../libs/graphics/sgl/SkBitmapFilter.cpp; sourceTree = SOURCE_ROOT; };
+ 002919500DEC39C700AF67D5 /* SkConvolutionBitmapFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkConvolutionBitmapFilter.cpp; path = ../../../libs/graphics/effects/SkConvolutionBitmapFilter.cpp; sourceTree = SOURCE_ROOT; };
+ 00298C290E7085E7005E85ED /* SampleStrokeText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleStrokeText.cpp; path = ../../../tests/skia/SampleCode/SampleStrokeText.cpp; sourceTree = SOURCE_ROOT; };
003474EC0D5B61BA00F3F389 /* SampleVertices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleVertices.cpp; path = ../../../tests/skia/SampleCode/SampleVertices.cpp; sourceTree = SOURCE_ROOT; };
+ 003476830DF8DEC400A270A4 /* SampleCircle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleCircle.cpp; path = ../../../tests/skia/SampleCode/SampleCircle.cpp; sourceTree = SOURCE_ROOT; };
+ 003A10160E0C29F800136848 /* SampleOverflow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleOverflow.cpp; path = ../../../tests/skia/SampleCode/SampleOverflow.cpp; sourceTree = SOURCE_ROOT; };
003FA7090D58CA4D0063AD75 /* SampleMeasure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleMeasure.cpp; path = ../../../tests/skia/SampleCode/SampleMeasure.cpp; sourceTree = SOURCE_ROOT; };
+ 0041F4860DE1157900C74590 /* SkFontHost_FONTPATH.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFontHost_FONTPATH.cpp; path = ../../../libs/graphics/ports/SkFontHost_FONTPATH.cpp; sourceTree = SOURCE_ROOT; };
+ 0041F4870DE1157900C74590 /* SkFontHost_none.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFontHost_none.cpp; path = ../../../libs/graphics/ports/SkFontHost_none.cpp; sourceTree = SOURCE_ROOT; };
+ 0041F4880DE1157900C74590 /* SkFontHost_win.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFontHost_win.cpp; path = ../../../libs/graphics/ports/SkFontHost_win.cpp; sourceTree = SOURCE_ROOT; };
+ 0061A77A0DB7A7150007094E /* SampleFillType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleFillType.cpp; path = ../../../tests/skia/SampleCode/SampleFillType.cpp; sourceTree = SOURCE_ROOT; };
+ 00648B590DDB15B90087F2E8 /* SampleTypeface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleTypeface.cpp; path = ../../../tests/skia/SampleCode/SampleTypeface.cpp; sourceTree = SOURCE_ROOT; };
0068600F0D8A1C8A00CD71AA /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = SDKs/MacOSX10.5.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = DEVELOPER_DIR; };
006860280D8A1DFB00CD71AA /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AGL.framework; sourceTree = DEVELOPER_DIR; };
0071BCEE0D746BDF00F667CE /* SampleFilter2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleFilter2.cpp; path = ../../../tests/skia/SampleCode/SampleFilter2.cpp; sourceTree = SOURCE_ROOT; };
- 007ECA710DA684A20086775A /* pvjpeg.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = pvjpeg.xcodeproj; path = ../pvjpeg.xcodeproj; sourceTree = SOURCE_ROOT; };
009A74060DA11B1F00876C03 /* GL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GL.xcodeproj; path = ../GL.xcodeproj; sourceTree = SOURCE_ROOT; };
+ 00B8EBDF0EB63983003C2F6F /* SkLayerDrawLooper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkLayerDrawLooper.cpp; path = ../../../libs/graphics/effects/SkLayerDrawLooper.cpp; sourceTree = SOURCE_ROOT; };
+ 00B8EBFB0EB64ABC003C2F6F /* SampleDrawLooper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleDrawLooper.cpp; path = ../../../tests/skia/SampleCode/SampleDrawLooper.cpp; sourceTree = SOURCE_ROOT; };
+ 00C5D1DD0EBFFC5C00C6702C /* test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = test.h; path = ../../../tests/skia/test/test.h; sourceTree = SOURCE_ROOT; };
+ 00C5D1E00EBFFE4D00C6702C /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = test.cpp; path = ../../../tests/skia/test/test.cpp; sourceTree = SOURCE_ROOT; };
+ 00C5D1E40EC0007400C6702C /* test_drawcolor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = test_drawcolor.cpp; path = ../../../tests/skia/test/test_drawcolor.cpp; sourceTree = SOURCE_ROOT; };
+ 00C5D1F00EC0044600C6702C /* test_drawrect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = test_drawrect.cpp; path = ../../../tests/skia/test/test_drawrect.cpp; sourceTree = SOURCE_ROOT; };
+ 00C5D2000EC00F0300C6702C /* SampleTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleTests.cpp; path = ../../../tests/skia/SampleCode/SampleTests.cpp; sourceTree = SOURCE_ROOT; };
00D315700D5A5B1D004B2209 /* SampleBitmapRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleBitmapRect.cpp; path = ../../../tests/skia/SampleCode/SampleBitmapRect.cpp; sourceTree = SOURCE_ROOT; };
+ 00DB0B0D0E06CEC80061DE48 /* SampleNinePatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleNinePatch.cpp; path = ../../../tests/skia/SampleCode/SampleNinePatch.cpp; sourceTree = SOURCE_ROOT; };
00ED8C060D3E999300651393 /* corecg.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = corecg.xcodeproj; path = ../corecg.xcodeproj; sourceTree = SOURCE_ROOT; };
00ED8C090D3E999300651393 /* expat.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = expat.xcodeproj; path = ../expat.xcodeproj; sourceTree = SOURCE_ROOT; };
00ED8C0C0D3E999300651393 /* freetype2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = freetype2.xcodeproj; path = ../freetype2.xcodeproj; sourceTree = SOURCE_ROOT; };
@@ -305,6 +327,9 @@
00ED8C780D3E99A800651393 /* SampleTextEffects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleTextEffects.cpp; path = ../../../tests/skia/SampleCode/SampleTextEffects.cpp; sourceTree = SOURCE_ROOT; };
00ED8C790D3E99A800651393 /* SampleTextOnPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleTextOnPath.cpp; path = ../../../tests/skia/SampleCode/SampleTextOnPath.cpp; sourceTree = SOURCE_ROOT; };
00ED8C7A0D3E99A800651393 /* SampleTiling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleTiling.cpp; path = ../../../tests/skia/SampleCode/SampleTiling.cpp; sourceTree = SOURCE_ROOT; };
+ 00F9D6230E7EC9E60031AAA2 /* SkSetPoly3To3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkSetPoly3To3.cpp; path = ../../../libs/corecg/SkSetPoly3To3.cpp; sourceTree = SOURCE_ROOT; };
+ 00F9D6540E7EEE580031AAA2 /* SkSetPoly3To3_D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkSetPoly3To3_D.cpp; path = ../../../libs/corecg/SkSetPoly3To3_D.cpp; sourceTree = SOURCE_ROOT; };
+ 00F9D6850E7F51670031AAA2 /* SkSetPoly3To3_A.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkSetPoly3To3_A.cpp; path = ../../../libs/corecg/SkSetPoly3To3_A.cpp; sourceTree = SOURCE_ROOT; };
0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; };
1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = ""; };
20286C33FDCF999611CA2CEA /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; };
@@ -331,8 +356,8 @@
006860100D8A1C8B00CD71AA /* OpenGL.framework in Frameworks */,
006860290D8A1DFB00CD71AA /* AGL.framework in Frameworks */,
009A74250DA11C5D00876C03 /* libGL.a in Frameworks */,
- 007ECA770DA684A90086775A /* libpvjpeg.a in Frameworks */,
0008AEE10DABF08F00477EFB /* libgiflib.a in Frameworks */,
+ 00D12E4D0DAD3D0A003918C5 /* libanimator.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -355,12 +380,14 @@
name = Products;
sourceTree = "";
};
- 007ECA720DA684A20086775A /* Products */ = {
+ 0041F4850DE1154C00C74590 /* fonthosts */ = {
isa = PBXGroup;
children = (
- 007ECA760DA684A20086775A /* libpvjpeg.a */,
+ 0041F4860DE1157900C74590 /* SkFontHost_FONTPATH.cpp */,
+ 0041F4870DE1157900C74590 /* SkFontHost_none.cpp */,
+ 0041F4880DE1157900C74590 /* SkFontHost_win.cpp */,
);
- name = Products;
+ name = fonthosts;
sourceTree = "";
};
009A74070DA11B1F00876C03 /* Products */ = {
@@ -371,6 +398,17 @@
name = Products;
sourceTree = "";
};
+ 00C5D1DB0EBFF83100C6702C /* tests */ = {
+ isa = PBXGroup;
+ children = (
+ 00C5D1E00EBFFE4D00C6702C /* test.cpp */,
+ 00C5D1F00EC0044600C6702C /* test_drawrect.cpp */,
+ 00C5D1E40EC0007400C6702C /* test_drawcolor.cpp */,
+ 00C5D1DD0EBFFC5C00C6702C /* test.h */,
+ );
+ name = tests;
+ sourceTree = "";
+ };
00ED8C070D3E999300651393 /* Products */ = {
isa = PBXGroup;
children = (
@@ -462,8 +500,15 @@
20286C29FDCF999611CA2CEA /* SampleCode */ = {
isa = PBXGroup;
children = (
+ 00C5D1DB0EBFF83100C6702C /* tests */,
+ 00F9D6230E7EC9E60031AAA2 /* SkSetPoly3To3.cpp */,
+ 00B8EBDF0EB63983003C2F6F /* SkLayerDrawLooper.cpp */,
+ 00F9D6850E7F51670031AAA2 /* SkSetPoly3To3_A.cpp */,
+ 00F9D6540E7EEE580031AAA2 /* SkSetPoly3To3_D.cpp */,
+ 002919500DEC39C700AF67D5 /* SkConvolutionBitmapFilter.cpp */,
+ 002919430DEBA08100AF67D5 /* SkBitmapFilter.cpp */,
+ 0041F4850DE1154C00C74590 /* fonthosts */,
0008AED90DABF01300477EFB /* giflib.xcodeproj */,
- 007ECA710DA684A20086775A /* pvjpeg.xcodeproj */,
009A74060DA11B1F00876C03 /* GL.xcodeproj */,
0013C78A0D94043200B41703 /* animator.xcodeproj */,
00ED8C060D3E999300651393 /* corecg.xcodeproj */,
@@ -487,22 +532,29 @@
20286C2AFDCF999611CA2CEA /* Sources */ = {
isa = PBXGroup;
children = (
+ 001962890EACB9D300447A07 /* SamplePatch.cpp */,
+ 00298C290E7085E7005E85ED /* SampleStrokeText.cpp */,
+ 001142AA0DCA20650070D0A3 /* SamplePicture.cpp */,
+ 0007A8F20DB4DFF30068AF40 /* SampleXfermodes.cpp */,
000A1CAF0DA522ED003DAC04 /* SamplePolyToPoly.cpp */,
0017F1510D6A0A8A008D9B31 /* SkGeometry.h */,
0017F1460D6A0A6A008D9B31 /* SampleEmboss.cpp */,
0017F1470D6A0A6A008D9B31 /* SampleLines.cpp */,
- 0017F1480D6A0A6A008D9B31 /* SamplePatch.cpp */,
00ED8C650D3E99A800651393 /* SampleAll.cpp */,
00ED8C660D3E99A800651393 /* SampleApp.cpp */,
00ED8C670D3E99A800651393 /* SampleArc.cpp */,
00ED8C680D3E99A800651393 /* SampleCamera.cpp */,
00ED8C690D3E99A800651393 /* SampleCode.h */,
00ED8C6A0D3E99A800651393 /* SampleCull.cpp */,
+ 0061A77A0DB7A7150007094E /* SampleFillType.cpp */,
00ED8C6B0D3E99A800651393 /* SampleDither.cpp */,
+ 00648B590DDB15B90087F2E8 /* SampleTypeface.cpp */,
003FA7090D58CA4D0063AD75 /* SampleMeasure.cpp */,
00ED8C6C0D3E99A800651393 /* SampleEncode.cpp */,
00ED8C6D0D3E99A800651393 /* SampleFilter.cpp */,
00ED8C6E0D3E99A800651393 /* SampleFontCache.cpp */,
+ 0019628F0EACBA2A00447A07 /* SamplePageFlip.cpp */,
+ 00B8EBFB0EB64ABC003C2F6F /* SampleDrawLooper.cpp */,
00ED8C6F0D3E99A800651393 /* SampleImage.cpp */,
00ED8C700D3E99A800651393 /* SampleImageDir.cpp */,
0071BCEE0D746BDF00F667CE /* SampleFilter2.cpp */,
@@ -510,6 +562,7 @@
003474EC0D5B61BA00F3F389 /* SampleVertices.cpp */,
000DC0C50D63796E00854F5A /* SampleTextAlpha.cpp */,
00ED8C710D3E99A800651393 /* SampleLayers.cpp */,
+ 00C5D2000EC00F0300C6702C /* SampleTests.cpp */,
00ED8C720D3E99A800651393 /* SamplePath.cpp */,
00ED8C730D3E99A800651393 /* SamplePathEffects.cpp */,
00ED8C740D3E99A800651393 /* SamplePoints.cpp */,
@@ -519,6 +572,9 @@
00ED8C780D3E99A800651393 /* SampleTextEffects.cpp */,
00ED8C790D3E99A800651393 /* SampleTextOnPath.cpp */,
00ED8C7A0D3E99A800651393 /* SampleTiling.cpp */,
+ 003476830DF8DEC400A270A4 /* SampleCircle.cpp */,
+ 003A10160E0C29F800136848 /* SampleOverflow.cpp */,
+ 00DB0B0D0E06CEC80061DE48 /* SampleNinePatch.cpp */,
);
name = Sources;
sourceTree = "";
@@ -569,7 +625,6 @@
00ED8CB20D3E9AFA00651393 /* PBXTargetDependency */,
0013C7950D94044800B41703 /* PBXTargetDependency */,
009A741D0DA11BAE00876C03 /* PBXTargetDependency */,
- 007ECA7C0DA684CF0086775A /* PBXTargetDependency */,
0008AF100DABF9BD00477EFB /* PBXTargetDependency */,
);
name = SampleCode;
@@ -633,10 +688,6 @@
ProductGroup = 00ED8C1F0D3E999300651393 /* Products */;
ProjectRef = 00ED8C1E0D3E999300651393 /* ports.xcodeproj */;
},
- {
- ProductGroup = 007ECA720DA684A20086775A /* Products */;
- ProjectRef = 007ECA710DA684A20086775A /* pvjpeg.xcodeproj */;
- },
{
ProductGroup = 00ED8C220D3E999300651393 /* Products */;
ProjectRef = 00ED8C210D3E999300651393 /* views.xcodeproj */;
@@ -668,13 +719,6 @@
remoteRef = 0013C7910D94043200B41703 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
- 007ECA760DA684A20086775A /* libpvjpeg.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libpvjpeg.a;
- remoteRef = 007ECA750DA684A20086775A /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
009A740E0DA11B1F00876C03 /* libGL.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@@ -784,23 +828,39 @@
00ED8C8D0D3E99A800651393 /* SampleTextEffects.cpp in Sources */,
0017F1490D6A0A6A008D9B31 /* SampleEmboss.cpp in Sources */,
0017F14A0D6A0A6A008D9B31 /* SampleLines.cpp in Sources */,
- 00ED8C7D0D3E99A800651393 /* SampleArc.cpp in Sources */,
- 00ED8C810D3E99A800651393 /* SampleEncode.cpp in Sources */,
0071BCEF0D746BDF00F667CE /* SampleFilter2.cpp in Sources */,
- 00ED8C8E0D3E99A800651393 /* SampleTextOnPath.cpp in Sources */,
00D315710D5A5B1D004B2209 /* SampleBitmapRect.cpp in Sources */,
- 00ED8C850D3E99A800651393 /* SampleImageDir.cpp in Sources */,
00ED8C7E0D3E99A800651393 /* SampleCamera.cpp in Sources */,
003474ED0D5B61BA00F3F389 /* SampleVertices.cpp in Sources */,
- 00ED8C800D3E99A800651393 /* SampleDither.cpp in Sources */,
000DC0C60D63796E00854F5A /* SampleTextAlpha.cpp in Sources */,
- 00ED8C840D3E99A800651393 /* SampleImage.cpp in Sources */,
00ED8C8F0D3E99A800651393 /* SampleTiling.cpp in Sources */,
- 000A1CB00DA522ED003DAC04 /* SamplePolyToPoly.cpp in Sources */,
00ED8C890D3E99A800651393 /* SamplePoints.cpp in Sources */,
- 0017F14B0D6A0A6A008D9B31 /* SamplePatch.cpp in Sources */,
- 00ED8C860D3E99A800651393 /* SampleLayers.cpp in Sources */,
00ED8C880D3E99A800651393 /* SamplePathEffects.cpp in Sources */,
+ 00ED8C8E0D3E99A800651393 /* SampleTextOnPath.cpp in Sources */,
+ 00648B5A0DDB15B90087F2E8 /* SampleTypeface.cpp in Sources */,
+ 00ED8C840D3E99A800651393 /* SampleImage.cpp in Sources */,
+ 0007A8F30DB4DFF30068AF40 /* SampleXfermodes.cpp in Sources */,
+ 002919440DEBA08100AF67D5 /* SkBitmapFilter.cpp in Sources */,
+ 002919510DEC39C700AF67D5 /* SkConvolutionBitmapFilter.cpp in Sources */,
+ 001142AB0DCA20650070D0A3 /* SamplePicture.cpp in Sources */,
+ 00298C2A0E7085E7005E85ED /* SampleStrokeText.cpp in Sources */,
+ 00ED8C810D3E99A800651393 /* SampleEncode.cpp in Sources */,
+ 000A1CB00DA522ED003DAC04 /* SamplePolyToPoly.cpp in Sources */,
+ 00F9D6860E7F51680031AAA2 /* SkSetPoly3To3_A.cpp in Sources */,
+ 0019628A0EACB9D300447A07 /* SamplePatch.cpp in Sources */,
+ 001962900EACBA2A00447A07 /* SamplePageFlip.cpp in Sources */,
+ 00ED8C860D3E99A800651393 /* SampleLayers.cpp in Sources */,
+ 00C5D1E10EBFFE4D00C6702C /* test.cpp in Sources */,
+ 00C5D1E50EC0007400C6702C /* test_drawcolor.cpp in Sources */,
+ 00C5D2010EC00F0300C6702C /* SampleTests.cpp in Sources */,
+ 00C5D20E0EC0106F00C6702C /* test_drawrect.cpp in Sources */,
+ 00ED8C850D3E99A800651393 /* SampleImageDir.cpp in Sources */,
+ 003A10170E0C29F800136848 /* SampleOverflow.cpp in Sources */,
+ 00ED8C800D3E99A800651393 /* SampleDither.cpp in Sources */,
+ 00ED8C7D0D3E99A800651393 /* SampleArc.cpp in Sources */,
+ 0061A77B0DB7A7150007094E /* SampleFillType.cpp in Sources */,
+ 003476840DF8DEC400A270A4 /* SampleCircle.cpp in Sources */,
+ 00B8EBFC0EB64ABC003C2F6F /* SampleDrawLooper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -817,11 +877,6 @@
name = animator;
targetProxy = 0013C7940D94044800B41703 /* PBXContainerItemProxy */;
};
- 007ECA7C0DA684CF0086775A /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- name = pvjpeg;
- targetProxy = 007ECA7B0DA684CF0086775A /* PBXContainerItemProxy */;
- };
009A741D0DA11BAE00876C03 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GL;
@@ -943,17 +998,24 @@
isa = XCBuildConfiguration;
buildSettings = {
GCC_CW_ASM_SYNTAX = NO;
+ GCC_DEBUGGING_SYMBOLS = full;
GCC_ENABLE_ASM_KEYWORD = NO;
+ GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_ENABLE_PASCAL_STRINGS = NO;
+ GCC_ENABLE_SYMBOL_SEPARATION = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREFIX_HEADER = " ";
GCC_PREPROCESSOR_DEFINITIONS = (
SK_DEBUG,
SK_BUILD_FOR_MAC,
);
+ GCC_THREADSAFE_STATICS = NO;
GCC_USE_GCC3_PFE_SUPPORT = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
+ PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
USER_HEADER_SEARCH_PATHS = "../../../include/corecg/** ../../../include/graphics/**";
};
@@ -967,17 +1029,27 @@
i386,
);
GCC_CW_ASM_SYNTAX = NO;
+ GCC_DEBUGGING_SYMBOLS = full;
GCC_ENABLE_ASM_KEYWORD = NO;
+ GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_ENABLE_PASCAL_STRINGS = NO;
+ GCC_ENABLE_SYMBOL_SEPARATION = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
SK_BUILD_FOR_MAC,
SK_RELEASE,
);
+ GCC_THREADSAFE_STATICS = NO;
GCC_USE_GCC3_PFE_SUPPORT = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_PEDANTIC = NO;
+ GCC_WARN_SHADOW = YES;
+ GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
+ PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
USER_HEADER_SEARCH_PATHS = "../../../include/corecg/** ../../../include/graphics/**";
};
diff --git a/ide/xcode/graphics.xcodeproj/project.pbxproj b/ide/xcode/graphics.xcodeproj/project.pbxproj
index 8f0d4fa5b..0eabe5390 100644
--- a/ide/xcode/graphics.xcodeproj/project.pbxproj
+++ b/ide/xcode/graphics.xcodeproj/project.pbxproj
@@ -18,10 +18,11 @@
001142D70DCA3EE90070D0A3 /* SkPicturePlayback.h in Headers */ = {isa = PBXBuildFile; fileRef = 001142D30DCA3EE90070D0A3 /* SkPicturePlayback.h */; };
001142D80DCA3EE90070D0A3 /* SkPictureRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 001142D40DCA3EE90070D0A3 /* SkPictureRecord.cpp */; };
001142D90DCA3EE90070D0A3 /* SkPictureRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 001142D50DCA3EE90070D0A3 /* SkPictureRecord.h */; };
- 001142F70DCA3FDF0070D0A3 /* SkReader32.h in Headers */ = {isa = PBXBuildFile; fileRef = 001142F50DCA3FDF0070D0A3 /* SkReader32.h */; };
- 001142F80DCA3FDF0070D0A3 /* SkWriter32.h in Headers */ = {isa = PBXBuildFile; fileRef = 001142F60DCA3FDF0070D0A3 /* SkWriter32.h */; };
0011430B0DCA458A0070D0A3 /* SkPictureFlat.h in Headers */ = {isa = PBXBuildFile; fileRef = 0011430A0DCA458A0070D0A3 /* SkPictureFlat.h */; };
0011430D0DCA45990070D0A3 /* SkPictureFlat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0011430C0DCA45990070D0A3 /* SkPictureFlat.cpp */; };
+ 0019627D0EACB91200447A07 /* SkPageFlipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0019627C0EACB91200447A07 /* SkPageFlipper.cpp */; };
+ 0019627F0EACB92A00447A07 /* SkFlipPixelRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0019627E0EACB92A00447A07 /* SkFlipPixelRef.cpp */; };
+ 001962810EACB94400447A07 /* SkPathHeap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 001962800EACB94400447A07 /* SkPathHeap.cpp */; };
001FFBBD0CD8D9ED000CDF07 /* SkImageRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 001FFBBC0CD8D9ED000CDF07 /* SkImageRef.cpp */; };
0027DCD00B24CA3900076079 /* SkDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0027DCCF0B24CA3900076079 /* SkDevice.cpp */; };
0027DCD20B24CA4E00076079 /* SkDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 0027DCD10B24CA4E00076079 /* SkDevice.h */; };
@@ -64,7 +65,6 @@
00523EA30C7B335D00D53402 /* SkRadialGradient_Table.h in Headers */ = {isa = PBXBuildFile; fileRef = 00523E920C7B335D00D53402 /* SkRadialGradient_Table.h */; };
00523EA40C7B335D00D53402 /* SkTransparentShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00523E930C7B335D00D53402 /* SkTransparentShader.cpp */; };
00523EA50C7B335D00D53402 /* SkUnitMappers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00523E940C7B335D00D53402 /* SkUnitMappers.cpp */; };
- 00523EA70C7B339000D53402 /* SkPicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00523EA60C7B339000D53402 /* SkPicture.cpp */; };
00523EA90C7B33B100D53402 /* SkUnitMappers.h in Headers */ = {isa = PBXBuildFile; fileRef = 00523EA80C7B33B100D53402 /* SkUnitMappers.h */; };
00523F420C7B3C1400D53402 /* SkFlattenable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00523F410C7B3C1400D53402 /* SkFlattenable.cpp */; };
0053B0EE0D3557960016606F /* SkPaintFlagsDrawFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0053B0ED0D3557960016606F /* SkPaintFlagsDrawFilter.cpp */; };
@@ -89,7 +89,9 @@
00A159D10C469A1200DB6CED /* SkBlitRow.h in Headers */ = {isa = PBXBuildFile; fileRef = 00A159CD0C469A1200DB6CED /* SkBlitRow.h */; };
00A159D20C469A1200DB6CED /* SkDither.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00A159CE0C469A1200DB6CED /* SkDither.cpp */; };
00A2188A0B652EEC0056CB69 /* SkMask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00A218890B652EEC0056CB69 /* SkMask.cpp */; };
+ 00B4AC4F0E9BF59400A184BF /* SkPicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00B4AC4E0E9BF59400A184BF /* SkPicture.cpp */; };
00B5022D09DB127D00A01CD6 /* SkRegionPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B5022C09DB127D00A01CD6 /* SkRegionPriv.h */; };
+ 00B8EC940EB6A319003C2F6F /* SkLayerDrawLooper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00B8EC930EB6A319003C2F6F /* SkLayerDrawLooper.cpp */; };
00C88FEF0D89B7920015D427 /* SkUnPreMultiply.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00C88FEE0D89B7920015D427 /* SkUnPreMultiply.cpp */; };
FE20DF0C0C7F154F00AAC91E /* SkKernel33MaskFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE20DF0B0C7F154F00AAC91E /* SkKernel33MaskFilter.cpp */; };
FE20DF200C7F157B00AAC91E /* SkMovie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE20DF160C7F157B00AAC91E /* SkMovie.cpp */; };
@@ -259,10 +261,11 @@
001142D30DCA3EE90070D0A3 /* SkPicturePlayback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkPicturePlayback.h; path = ../../libs/graphics/picture/SkPicturePlayback.h; sourceTree = SOURCE_ROOT; };
001142D40DCA3EE90070D0A3 /* SkPictureRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkPictureRecord.cpp; path = ../../libs/graphics/picture/SkPictureRecord.cpp; sourceTree = SOURCE_ROOT; };
001142D50DCA3EE90070D0A3 /* SkPictureRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkPictureRecord.h; path = ../../libs/graphics/picture/SkPictureRecord.h; sourceTree = SOURCE_ROOT; };
- 001142F50DCA3FDF0070D0A3 /* SkReader32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkReader32.h; path = ../../libs/graphics/sgl/SkReader32.h; sourceTree = SOURCE_ROOT; };
- 001142F60DCA3FDF0070D0A3 /* SkWriter32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkWriter32.h; path = ../../libs/graphics/sgl/SkWriter32.h; sourceTree = SOURCE_ROOT; };
0011430A0DCA458A0070D0A3 /* SkPictureFlat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkPictureFlat.h; path = ../../libs/graphics/picture/SkPictureFlat.h; sourceTree = SOURCE_ROOT; };
0011430C0DCA45990070D0A3 /* SkPictureFlat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkPictureFlat.cpp; path = ../../libs/graphics/picture/SkPictureFlat.cpp; sourceTree = SOURCE_ROOT; };
+ 0019627C0EACB91200447A07 /* SkPageFlipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkPageFlipper.cpp; path = ../../libs/corecg/SkPageFlipper.cpp; sourceTree = SOURCE_ROOT; };
+ 0019627E0EACB92A00447A07 /* SkFlipPixelRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFlipPixelRef.cpp; path = ../../libs/graphics/images/SkFlipPixelRef.cpp; sourceTree = SOURCE_ROOT; };
+ 001962800EACB94400447A07 /* SkPathHeap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkPathHeap.cpp; path = ../../libs/graphics/picture/SkPathHeap.cpp; sourceTree = SOURCE_ROOT; };
001FFBBC0CD8D9ED000CDF07 /* SkImageRef.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkImageRef.cpp; path = ../../libs/graphics/images/SkImageRef.cpp; sourceTree = SOURCE_ROOT; };
0027DCCF0B24CA3900076079 /* SkDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkDevice.cpp; path = ../../libs/graphics/sgl/SkDevice.cpp; sourceTree = SOURCE_ROOT; };
0027DCD10B24CA4E00076079 /* SkDevice.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SkDevice.h; sourceTree = ""; };
@@ -305,7 +308,6 @@
00523E920C7B335D00D53402 /* SkRadialGradient_Table.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SkRadialGradient_Table.h; path = ../../libs/graphics/effects/SkRadialGradient_Table.h; sourceTree = SOURCE_ROOT; };
00523E930C7B335D00D53402 /* SkTransparentShader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkTransparentShader.cpp; path = ../../libs/graphics/effects/SkTransparentShader.cpp; sourceTree = SOURCE_ROOT; };
00523E940C7B335D00D53402 /* SkUnitMappers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkUnitMappers.cpp; path = ../../libs/graphics/effects/SkUnitMappers.cpp; sourceTree = SOURCE_ROOT; };
- 00523EA60C7B339000D53402 /* SkPicture.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkPicture.cpp; path = ../../libs/graphics/sgl/SkPicture.cpp; sourceTree = SOURCE_ROOT; };
00523EA80C7B33B100D53402 /* SkUnitMappers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SkUnitMappers.h; sourceTree = ""; };
00523F410C7B3C1400D53402 /* SkFlattenable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkFlattenable.cpp; path = ../../libs/graphics/sgl/SkFlattenable.cpp; sourceTree = SOURCE_ROOT; };
0053B0ED0D3557960016606F /* SkPaintFlagsDrawFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkPaintFlagsDrawFilter.cpp; path = ../../libs/graphics/effects/SkPaintFlagsDrawFilter.cpp; sourceTree = SOURCE_ROOT; };
@@ -330,7 +332,9 @@
00A159CD0C469A1200DB6CED /* SkBlitRow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SkBlitRow.h; path = ../../libs/graphics/sgl/SkBlitRow.h; sourceTree = SOURCE_ROOT; };
00A159CE0C469A1200DB6CED /* SkDither.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkDither.cpp; path = ../../libs/graphics/sgl/SkDither.cpp; sourceTree = SOURCE_ROOT; };
00A218890B652EEC0056CB69 /* SkMask.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkMask.cpp; path = ../../libs/graphics/sgl/SkMask.cpp; sourceTree = SOURCE_ROOT; };
+ 00B4AC4E0E9BF59400A184BF /* SkPicture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkPicture.cpp; path = ../../libs/graphics/picture/SkPicture.cpp; sourceTree = SOURCE_ROOT; };
00B5022C09DB127D00A01CD6 /* SkRegionPriv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SkRegionPriv.h; path = ../../libs/corecg/SkRegionPriv.h; sourceTree = SOURCE_ROOT; };
+ 00B8EC930EB6A319003C2F6F /* SkLayerDrawLooper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkLayerDrawLooper.cpp; path = ../../libs/graphics/effects/SkLayerDrawLooper.cpp; sourceTree = SOURCE_ROOT; };
00C88FEE0D89B7920015D427 /* SkUnPreMultiply.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkUnPreMultiply.cpp; path = ../../libs/graphics/sgl/SkUnPreMultiply.cpp; sourceTree = SOURCE_ROOT; };
D2AAC06F0554671400DB518D /* libgraphics.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgraphics.a; sourceTree = BUILT_PRODUCTS_DIR; };
FE20DF0B0C7F154F00AAC91E /* SkKernel33MaskFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SkKernel33MaskFilter.cpp; path = ../../libs/graphics/effects/SkKernel33MaskFilter.cpp; sourceTree = SOURCE_ROOT; };
@@ -503,9 +507,8 @@
001142D10DCA3ED10070D0A3 /* picture */ = {
isa = PBXGroup;
children = (
- 00523EA60C7B339000D53402 /* SkPicture.cpp */,
- 001142F50DCA3FDF0070D0A3 /* SkReader32.h */,
- 001142F60DCA3FDF0070D0A3 /* SkWriter32.h */,
+ 001962800EACB94400447A07 /* SkPathHeap.cpp */,
+ 00B4AC4E0E9BF59400A184BF /* SkPicture.cpp */,
001142D20DCA3EE90070D0A3 /* SkPicturePlayback.cpp */,
001142D30DCA3EE90070D0A3 /* SkPicturePlayback.h */,
001142D40DCA3EE90070D0A3 /* SkPictureRecord.cpp */,
@@ -657,6 +660,8 @@
FE5F48C5094797E90095980F /* images */ = {
isa = PBXGroup;
children = (
+ 0019627E0EACB92A00447A07 /* SkFlipPixelRef.cpp */,
+ 0019627C0EACB91200447A07 /* SkPageFlipper.cpp */,
003FF1670DAE9C0F00601F6B /* SkImageRef_GlobalPool.cpp */,
009A39620DAE52FA00EB3A73 /* SkImageRefPool.cpp */,
008180E60D92D57300A2E56D /* SkScaledBitmapSampler.cpp */,
@@ -671,6 +676,7 @@
FE5F48C8094798660095980F /* effects */ = {
isa = PBXGroup;
children = (
+ 00B8EC930EB6A319003C2F6F /* SkLayerDrawLooper.cpp */,
009A75E90DA1DF8400876C03 /* SkNinePatch.cpp */,
0053B0ED0D3557960016606F /* SkPaintFlagsDrawFilter.cpp */,
003E6EFC0D09EF84005435C0 /* SkColorMatrix.cpp */,
@@ -939,8 +945,6 @@
009A75E80DA1DF5D00876C03 /* SkDrawProcs.h in Headers */,
001142D70DCA3EE90070D0A3 /* SkPicturePlayback.h in Headers */,
001142D90DCA3EE90070D0A3 /* SkPictureRecord.h in Headers */,
- 001142F70DCA3FDF0070D0A3 /* SkReader32.h in Headers */,
- 001142F80DCA3FDF0070D0A3 /* SkWriter32.h in Headers */,
0011430B0DCA458A0070D0A3 /* SkPictureFlat.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1026,7 +1030,6 @@
00523EA10C7B335D00D53402 /* SkGradientShader.cpp in Sources */,
00523EA40C7B335D00D53402 /* SkTransparentShader.cpp in Sources */,
00523EA50C7B335D00D53402 /* SkUnitMappers.cpp in Sources */,
- 00523EA70C7B339000D53402 /* SkPicture.cpp in Sources */,
00523F420C7B3C1400D53402 /* SkFlattenable.cpp in Sources */,
FE20DF0C0C7F154F00AAC91E /* SkKernel33MaskFilter.cpp in Sources */,
FE20DF200C7F157B00AAC91E /* SkMovie.cpp in Sources */,
@@ -1094,6 +1097,11 @@
0011430D0DCA45990070D0A3 /* SkPictureFlat.cpp in Sources */,
009B1EAE0DD224CF00EDFFF4 /* SkPixelRef.cpp in Sources */,
007336190DDC859F00A0DB2A /* SkPtrRecorder.cpp in Sources */,
+ 00B4AC4F0E9BF59400A184BF /* SkPicture.cpp in Sources */,
+ 0019627D0EACB91200447A07 /* SkPageFlipper.cpp in Sources */,
+ 0019627F0EACB92A00447A07 /* SkFlipPixelRef.cpp in Sources */,
+ 001962810EACB94400447A07 /* SkPathHeap.cpp in Sources */,
+ 00B8EC940EB6A319003C2F6F /* SkLayerDrawLooper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/pdk/README b/pdk/README
new file mode 100644
index 000000000..b382a1050
--- /dev/null
+++ b/pdk/README
@@ -0,0 +1,62 @@
+Building the pdk
+
+1) get a cupcake source tree
+
+2) from the root
+ . build/envsetup.sh
+
+3) run choosecombo
+ Build for the simulator or the device?
+ 1. Device
+ 2. Simulator
+
+ Which would you like? [1] 1
+
+
+ Build type choices are:
+ 1. release
+ 2. debug
+
+ Which would you like? [1] 1
+
+
+ Product choices are:
+ 0. emulator
+ 1. generic
+ 2. sim
+ 3. surf
+ You can also type the name of a product if you know it.
+ Which would you like? [generic] 1
+
+
+ Variant choices are:
+ 1. user
+ 2. userdebug
+ 3. eng
+ Which would you like? [eng] 3
+
+ ============================================
+ TARGET_PRODUCT=generic
+ TARGET_BUILD_VARIANT=eng
+ TARGET_SIMULATOR=false
+ TARGET_BUILD_TYPE=release
+ TARGET_ARCH=arm
+ HOST_ARCH=x86
+ HOST_OS=linux
+ HOST_BUILD_TYPE=release
+ BUILD_ID=
+ ============================================
+
+4) mkdir dist
+ mkdir logs
+ mkpdkcupcake.sh
+
+(which contains:
+
+DT=`date +%y%m%d-%H%M%S`
+#time make -j4 PRODUCT-generic-eng pdk dist DIST_DIR=dist 2>&1 | tee logs/$DT
+time make -j4 pdk dist DIST_DIR=dist 2>&1 | tee logs/$DT
+
+so you can see the results of the build in the logs directory.)
+
+5) the pdk tar file is put in the dist directory.
diff --git a/pdk/docs/_audio_hardware_interface_8h-source.html b/pdk/docs/_audio_hardware_interface_8h-source.html
new file mode 100755
index 000000000..799b827d3
--- /dev/null
+++ b/pdk/docs/_audio_hardware_interface_8h-source.html
@@ -0,0 +1,268 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+AudioHardwareInterface.h Go to the documentation of this file. 00001
+ 00002
+ 00003
+ 00004
+ 00005
+ 00006
+ 00007
+ 00008
+ 00009
+ 00010
+ 00011
+ 00012
+ 00013
+ 00014
+ 00015
+ 00016
+ 00017 #ifndef ANDROID_AUDIO_HARDWARE_INTERFACE_H
+ 00018 #define ANDROID_AUDIO_HARDWARE_INTERFACE_H
+ 00019
+ 00020 #include <stdint.h>
+ 00021 #include <sys/types.h>
+ 00022
+ 00023 #include <utils/Errors.h>
+ 00024 #include <utils/Vector.h>
+ 00025 #include <utils/String16.h>
+ 00026
+ 00027 #include <media/IAudioFlinger.h>
+ 00028 #include "media/AudioSystem.h"
+ 00029
+ 00030
+00031 namespace android {
+ 00032
+ 00033
+ 00034
+ 00035
+ 00036
+ 00037
+ 00038
+ 00039
+00040 class AudioStreamOut {
+ 00041 public :
+ 00042 virtual ~AudioStreamOut () = 0;
+ 00043
+ 00044
+ 00045 virtual uint32_t sampleRate () const = 0;
+ 00046
+ 00047
+ 00048 virtual size_t bufferSize () const = 0;
+ 00049
+ 00050
+ 00051
+ 00052
+ 00053
+ 00054 virtual int channelCount () const = 0;
+ 00055
+ 00056
+ 00057
+ 00058
+ 00059
+ 00060 virtual int format () const = 0;
+ 00061
+ 00062
+ 00063
+ 00064
+00065 uint32_t frameSize () const { return channelCount ()*((format ()==AudioSystem::PCM_16_BIT)?sizeof (int16_t):sizeof (int8_t)); }
+ 00066
+ 00067
+ 00068
+ 00069
+ 00070 virtual uint32_t latency () const = 0;
+ 00071
+ 00072
+ 00073
+ 00074
+ 00075
+ 00076
+ 00077
+ 00078
+ 00079 virtual status_t setVolume (float volume) = 0;
+ 00080
+ 00081
+ 00082 virtual ssize_t write (const void * buffer, size_t bytes) = 0;
+ 00083
+ 00084
+ 00085 virtual status_t dump (int fd, const Vector<String16>& args) = 0;
+ 00086 };
+ 00087
+ 00088
+ 00089
+ 00090
+ 00091
+ 00092
+00093 class AudioStreamIn {
+ 00094 public :
+ 00095 virtual ~AudioStreamIn () = 0;
+ 00096
+ 00097
+ 00098 virtual size_t bufferSize () const = 0;
+ 00099
+ 00100
+ 00101 virtual int channelCount () const = 0;
+ 00102
+ 00103
+ 00104
+ 00105
+ 00106
+ 00107 virtual int format () const = 0;
+ 00108
+ 00109
+ 00110
+ 00111
+00112 uint32_t frameSize () const { return channelCount ()*((format ()==AudioSystem::PCM_16_BIT)?sizeof (int16_t):sizeof (int8_t)); }
+ 00113
+ 00114
+ 00115
+ 00116 virtual status_t setGain (float gain) = 0;
+ 00117
+ 00118
+ 00119 virtual ssize_t read (void * buffer, ssize_t bytes) = 0;
+ 00120
+ 00121
+ 00122 virtual status_t dump (int fd, const Vector<String16>& args) = 0;
+ 00123
+ 00124
+ 00125
+ 00126
+ 00127
+ 00128 virtual status_t standby () = 0;
+ 00129
+ 00130 };
+ 00131
+ 00132
+ 00133
+ 00134
+ 00135
+ 00136
+ 00137
+ 00138
+ 00139
+ 00140
+ 00141
+ 00142
+ 00143
+00144 class AudioHardwareInterface
+ 00145 {
+ 00146 public :
+ 00147
+ 00148
+ 00149
+ 00150
+ 00151 virtual status_t initCheck () = 0;
+ 00152
+ 00153
+ 00154
+ 00155
+ 00156
+ 00157 virtual status_t standby () = 0;
+ 00158
+ 00159
+ 00160 virtual status_t setVoiceVolume (float volume) = 0;
+ 00161
+ 00162
+ 00163
+ 00164
+ 00165
+ 00166
+ 00167 virtual status_t setMasterVolume (float volume) = 0;
+ 00168
+ 00169
+ 00170
+ 00171
+ 00172
+ 00173
+ 00174
+ 00175
+ 00176
+ 00177
+ 00178 virtual status_t setRouting (int mode, uint32_t routes) = 0;
+ 00179
+ 00180 virtual status_t getRouting (int mode, uint32_t* routes) = 0;
+ 00181
+ 00182
+ 00183
+ 00184
+ 00185
+ 00186
+ 00187 virtual status_t setMode (int mode) = 0;
+ 00188 virtual status_t getMode (int * mode) = 0;
+ 00189
+ 00190
+ 00191 virtual status_t setMicMute (bool state) = 0;
+ 00192 virtual status_t getMicMute (bool * state) = 0;
+ 00193
+ 00194
+ 00195
+ 00196 virtual status_t setParameter (const char * key, const char * value) = 0;
+ 00197
+ 00198
+ 00199
+ 00200 virtual size_t getInputBufferSize (uint32_t sampleRate, int format, int channelCount) = 0;
+ 00201
+ 00202
+ 00203 virtual AudioStreamOut * openOutputStream (
+ 00204 int format=0,
+ 00205 int channelCount=0,
+ 00206 uint32_t sampleRate=0,
+ 00207 status_t *status=0) = 0;
+ 00208
+ 00209
+ 00210 virtual AudioStreamIn * openInputStream (
+ 00211 int format,
+ 00212 int channelCount,
+ 00213 uint32_t sampleRate,
+ 00214 status_t *status) = 0;
+ 00215
+ 00216
+ 00217 virtual status_t dumpState (int fd, const Vector<String16>& args) = 0;
+ 00218
+ 00219 static AudioHardwareInterface * create ();
+ 00220
+ 00221 protected :
+ 00222
+ 00223
+ 00224
+ 00225
+ 00226
+ 00227
+ 00228 virtual status_t doRouting () = 0;
+ 00229
+ 00230 virtual status_t dump (int fd, const Vector<String16>& args) = 0;
+ 00231 };
+ 00232
+ 00233
+ 00234
+ 00235 extern "C" AudioHardwareInterface * createAudioHardware (void );
+ 00236
+ 00237 };
+ 00238
+ 00239 #endif // ANDROID_AUDIO_HARDWARE_INTERFACE_H
+
+
+
diff --git a/pdk/docs/_audio_hardware_interface_8h.html b/pdk/docs/_audio_hardware_interface_8h.html
new file mode 100755
index 000000000..f45379f83
--- /dev/null
+++ b/pdk/docs/_audio_hardware_interface_8h.html
@@ -0,0 +1,51 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
AudioHardwareInterface.h File Reference
+
+Go to the source code of this file.
+
+
+
diff --git a/pdk/docs/_camera_hardware_interface_8h-source.html b/pdk/docs/_camera_hardware_interface_8h-source.html
new file mode 100755
index 000000000..41f0a1df3
--- /dev/null
+++ b/pdk/docs/_camera_hardware_interface_8h-source.html
@@ -0,0 +1,179 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+CameraHardwareInterface.h Go to the documentation of this file. 00001
+ 00002
+ 00003
+ 00004
+ 00005
+ 00006
+ 00007
+ 00008
+ 00009
+ 00010
+ 00011
+ 00012
+ 00013
+ 00014
+ 00015
+ 00016
+ 00017 #ifndef ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
+ 00018 #define ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
+ 00019
+ 00020 #include <utils/IMemory.h>
+ 00021 #include <utils/RefBase.h>
+ 00022 #include <ui/CameraParameters.h>
+ 00023
+ 00024 namespace android {
+ 00025
+ 00026
+00027 typedef void (*preview_callback )(const sp<IMemory>& mem, void * user);
+ 00028
+ 00029
+00030 typedef void (*shutter_callback )(void * user);
+ 00031
+ 00032
+00033 typedef void (*raw_callback )(const sp<IMemory>& mem, void * user);
+ 00034
+ 00035
+00036 typedef void (*jpeg_callback )(const sp<IMemory>& mem, void * user);
+ 00037
+ 00038
+00039 typedef void (*autofocus_callback )(bool focused, void * user);
+ 00040
+ 00041
+ 00042
+ 00043
+ 00044
+ 00045
+ 00046
+ 00047
+ 00048
+ 00049
+ 00050
+ 00051
+ 00052
+ 00053
+ 00054
+ 00055
+ 00056
+ 00057
+ 00058
+ 00059
+ 00060
+ 00061
+ 00062
+ 00063
+ 00064
+ 00065
+ 00066
+ 00067
+ 00068
+ 00069
+ 00070
+ 00071
+ 00072
+ 00073
+ 00074
+ 00075
+ 00076
+ 00077
+ 00078
+00079 class CameraHardwareInterface : public virtual RefBase {
+ 00080 public :
+00081 virtual ~CameraHardwareInterface () { }
+ 00082
+ 00083
+ 00084 virtual sp<IMemoryHeap> getPreviewHeap () const = 0;
+ 00085
+ 00086
+ 00087
+ 00088
+ 00089
+ 00090
+ 00091 virtual status_t startPreview (preview_callback cb, void * user) = 0;
+ 00092
+ 00093
+ 00094
+ 00095
+ 00096 virtual void stopPreview () = 0;
+ 00097
+ 00098
+ 00099
+ 00100
+ 00101
+ 00102
+ 00103 virtual status_t autoFocus (autofocus_callback ,
+ 00104 void * user) = 0;
+ 00105
+ 00106
+ 00107
+ 00108
+ 00109
+ 00110
+ 00111
+ 00112
+ 00113 virtual status_t takePicture (shutter_callback ,
+ 00114 raw_callback ,
+ 00115 jpeg_callback ,
+ 00116 void * user) = 0;
+ 00117
+ 00118
+ 00119
+ 00120
+ 00121
+ 00122
+ 00123 virtual status_t cancelPicture (bool cancel_shutter,
+ 00124 bool cancel_raw,
+ 00125 bool cancel_jpeg) = 0;
+ 00126
+ 00127
+ 00128 virtual status_t setParameters (const CameraParameters& params) = 0;
+ 00129
+ 00130
+ 00131 virtual CameraParameters getParameters () const = 0;
+ 00132
+ 00133
+ 00134
+ 00135
+ 00136
+ 00137 virtual void release () = 0;
+ 00138
+ 00139
+ 00140
+ 00141
+ 00142 virtual status_t dump (int fd, const Vector<String16>& args) const = 0;
+ 00143 };
+ 00144
+ 00145
+ 00146 extern "C" sp<CameraHardwareInterface> openCameraHardware ();
+ 00147
+ 00148 };
+ 00149
+ 00150 #endif
+
+
+
diff --git a/pdk/docs/_camera_hardware_interface_8h.html b/pdk/docs/_camera_hardware_interface_8h.html
new file mode 100755
index 000000000..633461ff5
--- /dev/null
+++ b/pdk/docs/_camera_hardware_interface_8h.html
@@ -0,0 +1,62 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
CameraHardwareInterface.h File Reference
+
+Go to the source code of this file.
+
+
+
diff --git a/pdk/docs/androidBluetooth.gif b/pdk/docs/androidBluetooth.gif
new file mode 100755
index 000000000..e62f5a8de
Binary files /dev/null and b/pdk/docs/androidBluetooth.gif differ
diff --git a/pdk/docs/androidBluetoothProcessDiagram.jpg b/pdk/docs/androidBluetoothProcessDiagram.jpg
new file mode 100755
index 000000000..687218018
Binary files /dev/null and b/pdk/docs/androidBluetoothProcessDiagram.jpg differ
diff --git a/pdk/docs/androidCameraArchitecture.gif b/pdk/docs/androidCameraArchitecture.gif
new file mode 100755
index 000000000..2679b439a
Binary files /dev/null and b/pdk/docs/androidCameraArchitecture.gif differ
diff --git a/pdk/docs/annotated.html b/pdk/docs/annotated.html
new file mode 100755
index 000000000..c8ea2e2d7
--- /dev/null
+++ b/pdk/docs/annotated.html
@@ -0,0 +1,51 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
Data Structures Here are the data structures with brief descriptions:
+
+
+
diff --git a/pdk/docs/audio_sub_system.html b/pdk/docs/audio_sub_system.html
index 8f72e3879..e0cf2173d 100755
--- a/pdk/docs/audio_sub_system.html
+++ b/pdk/docs/audio_sub_system.html
@@ -2,11 +2,23 @@
-Android - Audio Subsystem
+Android - Porting Guide
+
@@ -33,6 +45,7 @@ h1,h2,h3 {
+
Introduction
-Android provides two native layers that handle audio software:
-
Audio Flinger : the audio software implementation that provides the minimum required audio functions (as illustrated in the diagram below).
-AudioHardwareInterface : the hardware abstraction layer that hides driver-specific audio implementations from the Android platform.
-
-
+AudioHardwareInterface serves as the glue between proprietary audio drivers and the Android AudioFlinger service, the core audio service that handles all audio-related requests from applications.
-Solid elements represent Android blocks and dashed elements represent partner-specific proprietary blocks.
+Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
-Porting Android to other Audio Stacks
+Building an Audio Library
-Porting Android to other audio stacks (OSS, ALSA, proprietary user-space audio libraries, etc.) requires inheriting from and modifying AudioHardwareInterface to support the driver-specific implementation.
+To implement an audio driver, create a shared library that implements the interface defined in AudioHardwareInterface.h. You must name your shared library libaudio.so so that it will get loaded from /system/lib at runtime. Place libaudio sources and Android.mk in partner/acme/chipset_or_board/libaudio/.
+The following stub Android.mk file ensures that libaudio compiles and links to the appropriate libraries:
-
-AudioHardwareInterface Abstract Class
-
-AudioHardwareInterface (//device/servers/audio/flinger) contains several pure virtual functions that the audio driver class being ported needs to implement.
-
-
-Modifying AudioHardwareInterface
-
-Once the audio driver that inherits AudioHardwareInterface is ready, modify the static function AudioHardwareInterface::create() in order to link/load the driver in Android.
-
-
-Assume the manufacturer audio driver inherits from AudioHarddwareInterface and that it is compiled into a native shared library (libaudio.so). In this case, use dlopen to load the library.
-You can find an example of a similar implementation in //device/libs/media/mediaplayer.cpp. (Note that the example below uses libpv.so because this is a real code snippet from mediaplayer.cpp. If your native shared library is called libaudio.so, replace libpv.so with your libaudio.so.)
-
-// load PV library and create PV player
-mLibHandle = dlopen("libpv.so", RTLD_NOW);
-if (!mLibHandle) {
- LOGE("dlopen failed on libpv.so\n");
- return UNKNOWN_ERROR;
-}
-createPlayer_f createPlayer = reinterpret_cast(dlsym(mLibHandle, "createPlayer"));
-if (!createPlayer) {
- LOGE("dlsym failed on createPlayer in libpv.so\n");
- return UNKNOWN_ERROR;
-}
-
-Load the libraries with a call from AudioHardwareInterface::create(), as illustrated below (full code found in //device/servers/audioflinger).
-if (property_get("ro.kernel.qemu", value, 0)) {
- LOGD("Running in emulation - using generic audio driver");
- hw = new AudioHardwareGeneric();
-}
-else {
- // Insert calling of dynamic loading of driver here...
-}
-if (hw->initCheck() != NO_ERROR) {
- LOGW("Using stubbed audio hardware. No sound will be produced.");
- delete hw;
- hw = new AudioHardwareStub();
-}
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libaudio
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ libmedia \
+ libhardware
+
+LOCAL_SRC_FILES += MyAudioHardware.cpp
+
+LOCAL_CFLAGS +=
+
+LOCAL_C_INCLUDES +=
+
+LOCAL_STATIC_LIBRARIES += libaudiointerface
+
+include $(BUILD_SHARED_LIBRARY)
+Interface
+
+
+
+Note : This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, click here .
+
+
+
+
+
@@ -239,7 +255,7 @@ if (hw->initCheck() != NO_ERROR) {
pageTracker._trackPageview();
} catch(e) {}
-
v0.3 - 9 June 2008
+ v0.6 - 25 November 2008
diff --git a/pdk/docs/bluetooth.html b/pdk/docs/bluetooth.html
new file mode 100755
index 000000000..edd3c260d
--- /dev/null
+++ b/pdk/docs/bluetooth.html
@@ -0,0 +1,276 @@
+
+
+
+
+
+
+Android - Porting Guide
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Android Platform Development Kit
+
+
+
+
+
+
+
+
+
+
+ Introduction
+
+
+
+ Dev Environment Setup
+
+
+ Basic Bring up
+
+
+
+
+ Multimedia
+
+
+ Power Management
+
+
+
+
+ Networking
+
+
+
+ Telephony
+
+
+ Testing
+
+
+
+
+
+
+
+
+
+
+
+
+
Introduction
+
+
Android's Bluetooth stack uses BlueZ version 3.36 for GAP, SDP, and RFCOMM profiles, and is a SIG-qualified Bluetooth 2.0 host stack.
+
+
Bluez is GPL licensed, so the Android framework interacts with userspace bluez code through D-BUS IPC to avoid proprietary code.
+
+
Headset and Handsfree (v1.5) profiles are implemented in the Android framework and are both tightly coupled with the Phone App. These profiles are also SIG qualified.
+
+
The diagram below offers a library-oriented view of the Bluetooth stack. Click Bluetooth Process Diagram for a process-oriented view.
+
+
+
+Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
+
+
+
+
Porting
+
+
BlueZ is Bluetooth 2.0 compatible and should work with any 2.0 chipset. There are two integration points:
+
+UART driver
+Bluetooth Power On / Off
+
+
+
+
+
UART Driver
+
+
The BlueZ kernel sub-system attaches to your hardware-specific UART driver using the hciattach daemon.
+
For example, for MSM7201A, this is drivers/serial/msm_serial.c. You may also need to edit command line options to hciattach via init.rc.
+
+
+
Bluetooth Power On / Off
+
+
The method for powering on and off your bluetooth chip varies from Android V 1.0 to post 1.0.
+
+
+1.0 : Android framework writes a 0 or 1 to /sys/modules/board_[PLATFORM]/parameters/bluetooth_power_on.
+
+Post 1.0 : Android framework uses the linux rfkill API. See arch/arm/mach-msm/board-trout-rfkill.c for an example.
+
+
+
+
+
Tools
+
+
BlueZ provides a rich set of command line tools for debugging and interacting with the Bluetooth sub-system, including:
+
+hciconfig
+hcitool
+hcidump
+sdptool
+dbus-send
+dbus-monitor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ v0.6 - 25 November 2008
+
+
+
diff --git a/pdk/docs/bring_up.html b/pdk/docs/bring_up.html
index f53474a51..b70a35dd5 100755
--- a/pdk/docs/bring_up.html
+++ b/pdk/docs/bring_up.html
@@ -2,11 +2,23 @@
-Android - Bring Up
+Android - Porting Guide
+
@@ -33,6 +45,7 @@ h1,h2,h3 {
+
diff --git a/pdk/docs/build_new_device.html b/pdk/docs/build_new_device.html
index bc5294ace..cbf9ed7a5 100755
--- a/pdk/docs/build_new_device.html
+++ b/pdk/docs/build_new_device.html
@@ -2,11 +2,23 @@
-Android - Building Android for a new Mobile Device
+Android - Porting Guide
+
@@ -33,6 +45,7 @@ h1,h2,h3 {
+
diff --git a/pdk/docs/build_system.html b/pdk/docs/build_system.html
index 32e1c3e54..4286e71f0 100755
--- a/pdk/docs/build_system.html
+++ b/pdk/docs/build_system.html
@@ -2,11 +2,23 @@
-Android - Build System
+Android - Porting Guide
+
@@ -33,6 +45,7 @@ h1,h2,h3 {
+
diff --git a/pdk/docs/camera.html b/pdk/docs/camera.html
new file mode 100755
index 000000000..ae44b6806
--- /dev/null
+++ b/pdk/docs/camera.html
@@ -0,0 +1,280 @@
+
+
+
+
+Android - Porting Guide
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Android Platform Development Kit
+
+
+
+
+
+
+
+
+
+
+ Introduction
+
+
+
+ Dev Environment Setup
+
+
+ Basic Bring up
+
+
+
+
+ Multimedia
+
+
+ Power Management
+
+
+
+
+ Networking
+
+
+
+ Telephony
+
+
+ Testing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Camera Subsystem
+
+
+
+
+
+
+
Introduction
+
+
Android's camera subsystem connects the camera application to the application framework and user space libraries, which in turn communicate with the camera hardware layer that operates the physical camera.
+
The diagram below illustrates the structure of the camera subsystem.
+
+
+
+
Building a Camera Library
+
+
To implement a camera driver, create a shared library that implements the interface defined in CameraHardwareInterface.h. You must name your shared library libcamera.so so that it will get loaded from /system/lib at runtime. Place libcamera sources and Android.mk in partner/acme/chipset_or_board/libcamera/.
+
The following stub Android.mk file ensures that libcamera compiles and links to the appropriate libraries:
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libcamera
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ librpc \
+ liblog
+
+LOCAL_SRC_FILES += MyCameraHardware.cpp
+
+LOCAL_CFLAGS +=
+
+LOCAL_C_INCLUDES +=
+
+LOCAL_STATIC_LIBRARIES += \
+ libcamera-common \
+ libclock-rpc \
+ libcommondefs-rpc
+
+include $(BUILD_SHARED_LIBRARY)
+
+
+
+
Sequence Diagrams
+
+
+
+
Preview
+
+
The following diagram illustrates the sequence of function calls and actions necessary for your camera to preview.
+
+
+
+
Taking a Picture
+
+
The following diagram illustrates the sequence of function calls and actions necessary for your camera to take a picture.
+
+
+
+
Interface
+
+
+
+
Note : This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, click here .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ v0.6 - 25 November 2008
+
+
+
diff --git a/pdk/docs/cameraPreview.jpg b/pdk/docs/cameraPreview.jpg
new file mode 100755
index 000000000..3dea01174
Binary files /dev/null and b/pdk/docs/cameraPreview.jpg differ
diff --git a/pdk/docs/cameraTakePicture.jpg b/pdk/docs/cameraTakePicture.jpg
new file mode 100755
index 000000000..4ac6d953e
Binary files /dev/null and b/pdk/docs/cameraTakePicture.jpg differ
diff --git a/pdk/docs/classandroid_1_1_audio_hardware_interface.html b/pdk/docs/classandroid_1_1_audio_hardware_interface.html
new file mode 100755
index 000000000..d2e9ac884
--- /dev/null
+++ b/pdk/docs/classandroid_1_1_audio_hardware_interface.html
@@ -0,0 +1,584 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
android::AudioHardwareInterface Class Reference AudioHardwareInterface.h defines the interface to the audio hardware abstraction layer.
+
More...
+
+#include <AudioHardwareInterface.h >
+
+
+
+Public Member Functions
+virtual status_t initCheck ()=0
+
+ check to see if the audio hardware interface has been initialized.
+virtual status_t standby ()=0
+
+ put the audio hardware into standby mode to conserve power.
+virtual status_t setVoiceVolume (float volume)=0
+
+ set the audio volume of a voice call.
+virtual status_t setMasterVolume (float volume)=0
+
+ set the audio volume for all audio activities other than voice call.
+virtual status_t setRouting (int mode, uint32_t routes)=0
+
+ Audio routing methods.
+virtual status_t getRouting (int mode, uint32_t *routes)=0
+
+virtual status_t setMode (int mode)=0
+
+ setMode is called when the audio mode changes.
+virtual status_t getMode (int *mode)=0
+
+virtual status_t setMicMute (bool state)=0
+
+virtual status_t getMicMute (bool *state)=0
+
+virtual status_t setParameter (const char *key, const char *value)=0
+
+virtual size_t getInputBufferSize (uint32_t sampleRate, int format, int channelCount)=0
+
+virtual AudioStreamOut * openOutputStream (int format=0, int channelCount=0, uint32_t sampleRate=0, status_t *status=0)=0
+
+ This method creates and opens the audio hardware output stream.
+virtual AudioStreamIn * openInputStream (int format, int channelCount, uint32_t sampleRate, status_t *status)=0
+
+ This method creates and opens the audio hardware input stream.
+virtual status_t dumpState (int fd, const Vector< String16 > &args)=0
+
+ This method dumps the state of the audio hardware.
+Static Public Member Functions
+static AudioHardwareInterface * create ()
+
+Protected Member Functions
+virtual status_t doRouting ()=0
+
+ doRouting actually initiates the routing.
+virtual status_t dump (int fd, const Vector< String16 > &args)=0
+
+
+
Detailed Description
+
AudioHardwareInterface.h defines the interface to the audio hardware abstraction layer.
+
+The interface supports setting and getting parameters, selecting audio routing paths, and defining input and output streams.
+AudioFlinger initializes the audio hardware and immediately opens an output stream. You can set Audio routing to output to handset, speaker, Bluetooth, or a headset.
+The audio input stream is initialized when AudioFlinger is called to carry out a record operation.
+
Definition at line 144 of file AudioHardwareInterface.h .
+
Member Function Documentation
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::initCheck
+ (
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+check to see if the audio hardware interface has been initialized.
+
+return status based on values defined in include/utils/Errors.h
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::standby
+ (
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+put the audio hardware into standby mode to conserve power.
+
+Returns status based on include/utils/Errors.h
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::setVoiceVolume
+ (
+ float
+ volume
+ )
+ [pure virtual]
+
+
+
+
+
+
+set the audio volume of a voice call.
+
+Range is between 0.0 and 1.0
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::setMasterVolume
+ (
+ float
+ volume
+ )
+ [pure virtual]
+
+
+
+
+
+
+set the audio volume for all audio activities other than voice call.
+
+Range between 0.0 and 1.0. If any value other than NO_ERROR is returned, the software mixer will emulate this capability.
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::setRouting
+ (
+ int
+ mode ,
+
+
+
+
+ uint32_t
+ routes
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+Audio routing methods.
+
+Routes defined in include/hardware/AudioSystem.h. Audio routes can be (ROUTE_EARPIECE | ROUTE_SPEAKER | ROUTE_BLUETOOTH | ROUTE_HEADSET)
+setRouting sets the routes for a mode. This is called at startup. It is also called when a new device is connected, such as a wired headset is plugged in or a Bluetooth headset is paired.
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::getRouting
+ (
+ int
+ mode ,
+
+
+
+
+ uint32_t *
+ routes
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::setMode
+ (
+ int
+ mode
+ )
+ [pure virtual]
+
+
+
+
+
+
+setMode is called when the audio mode changes.
+
+NORMAL mode is for standard audio playback, RINGTONE when a ringtone is playing, and IN_CALL when a call is in progress.
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::getMode
+ (
+ int *
+ mode
+ )
+ [pure virtual]
+
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::setMicMute
+ (
+ bool
+ state
+ )
+ [pure virtual]
+
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::getMicMute
+ (
+ bool *
+ state
+ )
+ [pure virtual]
+
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::setParameter
+ (
+ const char *
+ key ,
+
+
+
+
+ const char *
+ value
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+
+
+
+
+ virtual size_t android::AudioHardwareInterface::getInputBufferSize
+ (
+ uint32_t
+ sampleRate ,
+
+
+
+
+ int
+ format ,
+
+
+
+
+ int
+ channelCount
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+
+
+
+
+ virtual AudioStreamOut * android::AudioHardwareInterface::openOutputStream
+ (
+ int
+ format = 0,
+
+
+
+
+ int
+ channelCount = 0,
+
+
+
+
+ uint32_t
+ sampleRate = 0,
+
+
+
+
+ status_t *
+ status = 0
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+This method creates and opens the audio hardware output stream.
+
+
+
+
+
+
+
+
+
+ virtual AudioStreamIn * android::AudioHardwareInterface::openInputStream
+ (
+ int
+ format ,
+
+
+
+
+ int
+ channelCount ,
+
+
+
+
+ uint32_t
+ sampleRate ,
+
+
+
+
+ status_t *
+ status
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+This method creates and opens the audio hardware input stream.
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::dumpState
+ (
+ int
+ fd ,
+
+
+
+
+ const Vector< String16 > &
+ args
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+This method dumps the state of the audio hardware.
+
+
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::doRouting
+ (
+
+ )
+ [protected, pure virtual]
+
+
+
+
+
+
+doRouting actually initiates the routing.
+
+A call to setRouting or setMode may result in a routing change. The generic logic calls doRouting when required. If the device has any special requirements these methods can be overriden.
+
+
+
+
+
+
+
+ virtual status_t android::AudioHardwareInterface::dump
+ (
+ int
+ fd ,
+
+
+
+
+ const Vector< String16 > &
+ args
+
+
+
+ )
+ [protected, pure virtual]
+
+
+
+
+
+
The documentation for this class was generated from the following file:
+
+
+
diff --git a/pdk/docs/classandroid_1_1_audio_stream_in.html b/pdk/docs/classandroid_1_1_audio_stream_in.html
new file mode 100755
index 000000000..54391944a
--- /dev/null
+++ b/pdk/docs/classandroid_1_1_audio_stream_in.html
@@ -0,0 +1,292 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
android::AudioStreamIn Class Reference AudioStreamIn is the abstraction interface for the audio input hardware.
+
More...
+
+#include <AudioHardwareInterface.h >
+
+
+
+Public Member Functions
+virtual ~AudioStreamIn ()=0
+
+virtual size_t bufferSize () const =0
+
+ return the input buffer size allowed by audio driver
+virtual int channelCount () const =0
+
+ return the number of audio input channels
+virtual int format () const =0
+
+ return audio format in 8bit or 16bit PCM format - eg.
+uint32_t frameSize () const
+
+ return the frame size (number of bytes per sample).
+virtual status_t setGain (float gain)=0
+
+ set the input gain for the audio driver.
+virtual ssize_t read (void *buffer, ssize_t bytes)=0
+
+ read audio buffer in from audio driver
+virtual status_t dump (int fd, const Vector< String16 > &args)=0
+
+ dump the state of the audio input device
+virtual status_t standby ()=0
+
+ Put the audio hardware input into standby mode.
+
+
Detailed Description
+
AudioStreamIn is the abstraction interface for the audio input hardware.
+
+It defines the various properties of the audio hardware input driver.
+
Definition at line 93 of file AudioHardwareInterface.h .
+
Constructor & Destructor Documentation
+
+
+
+
+
+ virtual android::AudioStreamIn::~AudioStreamIn
+ (
+
+ )
+ [pure virtual]
+
+
+
+
+
+
Member Function Documentation
+
+
+
+
+
+ virtual size_t android::AudioStreamIn::bufferSize
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+return the input buffer size allowed by audio driver
+
+
+
+
+
+
+
+
+
+ virtual int android::AudioStreamIn::channelCount
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+return the number of audio input channels
+
+
+
+
+
+
+
+
+
+ virtual int android::AudioStreamIn::format
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+return audio format in 8bit or 16bit PCM format - eg.
+
+AudioSystem:PCM_16_BIT
+
+
+
+
+
+
+
+ uint32_t android::AudioStreamIn::frameSize
+ (
+
+ )
+ const [inline]
+
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioStreamIn::setGain
+ (
+ float
+ gain
+ )
+ [pure virtual]
+
+
+
+
+
+
+set the input gain for the audio driver.
+
+This method is for for future use
+
+
+
+
+
+
+
+ virtual ssize_t android::AudioStreamIn::read
+ (
+ void *
+ buffer ,
+
+
+
+
+ ssize_t
+ bytes
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+read audio buffer in from audio driver
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioStreamIn::dump
+ (
+ int
+ fd ,
+
+
+
+
+ const Vector< String16 > &
+ args
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+dump the state of the audio input device
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioStreamIn::standby
+ (
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+Put the audio hardware input into standby mode.
+
+Returns status based on include/utils/Errors.h
+
+
+
The documentation for this class was generated from the following file:
+
+
+
diff --git a/pdk/docs/classandroid_1_1_audio_stream_out.html b/pdk/docs/classandroid_1_1_audio_stream_out.html
new file mode 100755
index 000000000..5d727ee0b
--- /dev/null
+++ b/pdk/docs/classandroid_1_1_audio_stream_out.html
@@ -0,0 +1,316 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
android::AudioStreamOut Class Reference AudioStreamOut is the abstraction interface for the audio output hardware.
+
More...
+
+#include <AudioHardwareInterface.h >
+
+
+
+Public Member Functions
+virtual ~AudioStreamOut ()=0
+
+virtual uint32_t sampleRate () const =0
+
+ return audio sampling rate in hz - eg.
+virtual size_t bufferSize () const =0
+
+ returns size of output buffer - eg.
+virtual int channelCount () const =0
+
+ return number of output audio channels.
+virtual int format () const =0
+
+ return audio format in 8bit or 16bit PCM format - eg.
+uint32_t frameSize () const
+
+ return the frame size (number of bytes per sample).
+virtual uint32_t latency () const =0
+
+ return the audio hardware driver latency in milli seconds.
+virtual status_t setVolume (float volume)=0
+
+ Use this method in situations where audio mixing is done in the hardware.
+virtual ssize_t write (const void *buffer, size_t bytes)=0
+
+ write audio buffer to driver.
+virtual status_t dump (int fd, const Vector< String16 > &args)=0
+
+ dump the state of the audio output device
+
+
Detailed Description
+
AudioStreamOut is the abstraction interface for the audio output hardware.
+
+It provides information about various properties of the audio output hardware driver.
+
Definition at line 40 of file AudioHardwareInterface.h .
+
Constructor & Destructor Documentation
+
+
+
+
+
+ virtual android::AudioStreamOut::~AudioStreamOut
+ (
+
+ )
+ [pure virtual]
+
+
+
+
+
+
Member Function Documentation
+
+
+
+
+
+ virtual uint32_t android::AudioStreamOut::sampleRate
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+return audio sampling rate in hz - eg.
+
+44100
+
+
+
+
+
+
+
+ virtual size_t android::AudioStreamOut::bufferSize
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+returns size of output buffer - eg.
+
+4800
+
+
+
+
+
+
+
+ virtual int android::AudioStreamOut::channelCount
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+return number of output audio channels.
+
+Acceptable values are 1 (mono) or 2 (stereo)
+
+
+
+
+
+
+
+ virtual int android::AudioStreamOut::format
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+return audio format in 8bit or 16bit PCM format - eg.
+
+AudioSystem:PCM_16_BIT
+
+
+
+
+
+
+
+ uint32_t android::AudioStreamOut::frameSize
+ (
+
+ )
+ const [inline]
+
+
+
+
+
+
+
+
+
+
+ virtual uint32_t android::AudioStreamOut::latency
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+return the audio hardware driver latency in milli seconds.
+
+
+
+
+
+
+
+
+
+ virtual status_t android::AudioStreamOut::setVolume
+ (
+ float
+ volume
+ )
+ [pure virtual]
+
+
+
+
+
+
+Use this method in situations where audio mixing is done in the hardware.
+
+This method serves as a direct interface with hardware, allowing you to directly set the volume as apposed to via the framework. This method might produce multiple PCM outputs or hardware accelerated codecs, such as MP3 or AAC.
+
+
+
+
+
+
+
+ virtual ssize_t android::AudioStreamOut::write
+ (
+ const void *
+ buffer ,
+
+
+
+
+ size_t
+ bytes
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+write audio buffer to driver.
+
+Returns number of bytes written
+
+
+
+
+
+
+
+ virtual status_t android::AudioStreamOut::dump
+ (
+ int
+ fd ,
+
+
+
+
+ const Vector< String16 > &
+ args
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+dump the state of the audio output device
+
+
+
+
+
The documentation for this class was generated from the following file:
+
+
+
diff --git a/pdk/docs/classandroid_1_1_camera_hardware_interface.html b/pdk/docs/classandroid_1_1_camera_hardware_interface.html
new file mode 100755
index 000000000..cddb82c31
--- /dev/null
+++ b/pdk/docs/classandroid_1_1_camera_hardware_interface.html
@@ -0,0 +1,393 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
android::CameraHardwareInterface Class Reference CameraHardwareInterface.h defines the interface to the camera hardware abstraction layer, used for setting and getting parameters, live previewing, and taking pictures.
+
More...
+
+#include <CameraHardwareInterface.h >
+
+
+
+Public Member Functions
+virtual ~CameraHardwareInterface ()
+
+virtual sp< IMemoryHeap > getPreviewHeap () const =0
+
+ Return the IMemoryHeap for the preview image heap.
+virtual status_t startPreview (preview_callback cb, void *user)=0
+
+ Start preview mode.
+virtual void stopPreview ()=0
+
+ Stop a previously started preview.
+virtual status_t autoFocus (autofocus_callback , void *user)=0
+
+ Start auto focus, the callback routine is called once when focusing is complete.
+virtual status_t takePicture (shutter_callback , raw_callback , jpeg_callback , void *user)=0
+
+ Take a picture.
+virtual status_t cancelPicture (bool cancel_shutter, bool cancel_raw, bool cancel_jpeg)=0
+
+ Cancel a picture that was started with takePicture.
+virtual status_t setParameters (const CameraParameters ¶ms)=0
+
+ Set the camera parameters.
+virtual CameraParameters getParameters () const =0
+
+ Return the camera parameters.
+virtual void release ()=0
+
+ Release the hardware resources owned by this object.
+virtual status_t dump (int fd, const Vector< String16 > &args) const =0
+
+ Dump state of the camera hardware.
+
+
Detailed Description
+
CameraHardwareInterface.h defines the interface to the camera hardware abstraction layer, used for setting and getting parameters, live previewing, and taking pictures.
+
+It is a referenced counted interface with RefBase as its base class. CameraService calls openCameraHardware() to retrieve a strong pointer to the instance of this interface and may be called multiple times. The following steps describe a typical sequence:
+
+After CameraService calls openCameraHardware() , getParameters() and setParameters() are used to initialize the camera instance. CameraService calls getPreviewHeap() to establish access to the preview heap so it can be registered with SurfaceFlinger for efficient display updating while in preview mode. startPreview() is called, which is passed a preview_callback() function and a user parameter. The camera instance then periodically calls preview_callback() each time a new preview frame is available. The callback routine has two parameters: the first is a pointer to the IMemory containing the frame and the second a user parameter. If the preview_callback code needs to use this memory after returning, it must copy the data.
+
+Prior to taking a picture, CameraService calls autofocus() with autofocus_callback() and a user parameter. When auto focusing has completed, the camera instance calls autofocus_callback() , which informs the application whether focusing was successful. The camera instance only calls autofocus_callback() once and it is up to the application to call autoFocus() again if refocusing is desired.
+CameraService calls takePicture() to request the camera instance take a picture. This method has two callbacks: raw_callback() and jpeg_callback() . When the raw image is available, raw_callback() is called with a pointer to the IMemory containing the raw image. When the jpeg image is available, jpeg_callback() is called with a pointer to the IMemory containing the jpeg image. As with preview_callback() , the memory must be copied if it's needed after returning.
+
Definition at line 79 of file CameraHardwareInterface.h .
+
Constructor & Destructor Documentation
+
+
+
+
+
+ virtual android::CameraHardwareInterface::~CameraHardwareInterface
+ (
+
+ )
+ [inline, virtual]
+
+
+
+
+
+
Member Function Documentation
+
+
+
+
+
+ virtual sp<IMemoryHeap> android::CameraHardwareInterface::getPreviewHeap
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+Return the IMemoryHeap for the preview image heap.
+
+
+
+
+
+
+
+
+
+ virtual status_t android::CameraHardwareInterface::startPreview
+ (
+ preview_callback
+ cb ,
+
+
+
+
+ void *
+ user
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+Start preview mode.
+
+When a preview image is available preview_callback is called with the user parameter. The call back parameter may be null.
+
+
+
+
+
+
+
+ virtual void android::CameraHardwareInterface::stopPreview
+ (
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+Stop a previously started preview.
+
+
+
+
+
+
+
+
+
+ virtual status_t android::CameraHardwareInterface::autoFocus
+ (
+ autofocus_callback
+ ,
+
+
+
+
+ void *
+ user
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+Start auto focus, the callback routine is called once when focusing is complete.
+
+autoFocus() will be called again if another auto focus is needed.
+
+
+
+
+
+
+
+
+Take a picture.
+
+The raw_callback is called when the uncompressed image is available. The jpeg_callback is called when the compressed image is available. These call backs may be null. The user parameter is passed to each of the call back routines.
+
+
+
+
+
+
+
+ virtual status_t android::CameraHardwareInterface::cancelPicture
+ (
+ bool
+ cancel_shutter ,
+
+
+
+
+ bool
+ cancel_raw ,
+
+
+
+
+ bool
+ cancel_jpeg
+
+
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+Cancel a picture that was started with takePicture.
+
+You may cancel any of the shutter, raw, or jpeg callbacks. Calling this method when no picture is being taken is a no-op.
+
+
+
+
+
+
+
+ virtual status_t android::CameraHardwareInterface::setParameters
+ (
+ const CameraParameters &
+ params
+ )
+ [pure virtual]
+
+
+
+
+
+
+Set the camera parameters.
+
+
+
+
+
+
+
+
+
+ virtual CameraParameters android::CameraHardwareInterface::getParameters
+ (
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+Return the camera parameters.
+
+
+
+
+
+
+
+
+
+ virtual void android::CameraHardwareInterface::release
+ (
+
+ )
+ [pure virtual]
+
+
+
+
+
+
+Release the hardware resources owned by this object.
+
+Note that this is *not* done in the destructor.
+
+
+
+
+
+
+
+ virtual status_t android::CameraHardwareInterface::dump
+ (
+ int
+ fd ,
+
+
+
+
+ const Vector< String16 > &
+ args
+
+
+
+ )
+ const [pure virtual]
+
+
+
+
+
+
+Dump state of the camera hardware.
+
+
+
+
+
The documentation for this class was generated from the following file:
+
+
+
diff --git a/pdk/docs/display_drivers.html b/pdk/docs/display_drivers.html
index eb4d31abf..c20afe547 100755
--- a/pdk/docs/display_drivers.html
+++ b/pdk/docs/display_drivers.html
@@ -2,11 +2,23 @@
-Android - Display Drivers
+Android - Porting Guide
+
@@ -33,6 +45,7 @@ h1,h2,h3 {
+
diff --git a/pdk/docs/doxygen.css b/pdk/docs/doxygen.css
new file mode 100755
index 000000000..22c484301
--- /dev/null
+++ b/pdk/docs/doxygen.css
@@ -0,0 +1,473 @@
+BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
+ font-family: Geneva, Arial, Helvetica, sans-serif;
+}
+BODY,TD {
+ font-size: 90%;
+}
+H1 {
+ text-align: center;
+ font-size: 160%;
+}
+H2 {
+ font-size: 120%;
+}
+H3 {
+ font-size: 100%;
+}
+CAPTION {
+ font-weight: bold
+}
+DIV.qindex {
+ width: 100%;
+ background-color: #e8eef2;
+ border: 1px solid #84b0c7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
+ line-height: 140%;
+}
+DIV.navpath {
+ width: 100%;
+ background-color: #e8eef2;
+ border: 1px solid #84b0c7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
+ line-height: 140%;
+}
+DIV.navtab {
+ background-color: #e8eef2;
+ border: 1px solid #84b0c7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+TD.navtab {
+ font-size: 70%;
+}
+A.qindex {
+ text-decoration: none;
+ font-weight: bold;
+ color: #1A419D;
+}
+A.qindex:visited {
+ text-decoration: none;
+ font-weight: bold;
+ color: #1A419D
+}
+A.qindex:hover {
+ text-decoration: none;
+ background-color: #ddddff;
+}
+A.qindexHL {
+ text-decoration: none;
+ font-weight: bold;
+ background-color: #6666cc;
+ color: #ffffff;
+ border: 1px double #9295C2;
+}
+A.qindexHL:hover {
+ text-decoration: none;
+ background-color: #6666cc;
+ color: #ffffff;
+}
+A.qindexHL:visited {
+ text-decoration: none;
+ background-color: #6666cc;
+ color: #ffffff
+}
+A.el {
+ text-decoration: none;
+ font-weight: bold
+}
+A.elRef {
+ font-weight: bold
+}
+A.code:link {
+ text-decoration: none;
+ font-weight: normal;
+ color: #0000FF
+}
+A.code:visited {
+ text-decoration: none;
+ font-weight: normal;
+ color: #0000FF
+}
+A.codeRef:link {
+ font-weight: normal;
+ color: #0000FF
+}
+A.codeRef:visited {
+ font-weight: normal;
+ color: #0000FF
+}
+A:hover {
+ text-decoration: none;
+ background-color: #f2f2ff
+}
+DL.el {
+ margin-left: -1cm
+}
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 95%;
+}
+PRE.fragment {
+ border: 1px solid #CCCCCC;
+ background-color: #f5f5f5;
+ margin-top: 4px;
+ margin-bottom: 4px;
+ margin-left: 2px;
+ margin-right: 8px;
+ padding-left: 6px;
+ padding-right: 6px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+DIV.ah {
+ background-color: black;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px
+}
+
+DIV.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ margin-bottom: 6px;
+ font-weight: bold;
+}
+DIV.groupText {
+ margin-left: 16px;
+ font-style: italic;
+ font-size: 90%
+}
+BODY {
+ background: white;
+ color: black;
+ margin-right: 20px;
+ margin-left: 20px;
+}
+TD.indexkey {
+ background-color: #e8eef2;
+ font-weight: bold;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ border: 1px solid #CCCCCC;
+}
+TD.indexvalue {
+ background-color: #e8eef2;
+ font-style: italic;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ border: 1px solid #CCCCCC;
+}
+TR.memlist {
+ background-color: #f0f0f0;
+}
+P.formulaDsp {
+ text-align: center;
+}
+IMG.formulaDsp {
+}
+IMG.formulaInl {
+ vertical-align: middle;
+}
+SPAN.keyword { color: #008000 }
+SPAN.keywordtype { color: #604020 }
+SPAN.keywordflow { color: #e08000 }
+SPAN.comment { color: #800000 }
+SPAN.preprocessor { color: #806020 }
+SPAN.stringliteral { color: #002080 }
+SPAN.charliteral { color: #008080 }
+SPAN.vhdldigit { color: #ff00ff }
+SPAN.vhdlchar { color: #000000 }
+SPAN.vhdlkeyword { color: #700070 }
+SPAN.vhdllogic { color: #ff0000 }
+
+.mdescLeft {
+ padding: 0px 8px 4px 8px;
+ font-size: 80%;
+ font-style: italic;
+ background-color: #FAFAFA;
+ border-top: 1px none #E0E0E0;
+ border-right: 1px none #E0E0E0;
+ border-bottom: 1px none #E0E0E0;
+ border-left: 1px none #E0E0E0;
+ margin: 0px;
+}
+.mdescRight {
+ padding: 0px 8px 4px 8px;
+ font-size: 80%;
+ font-style: italic;
+ background-color: #FAFAFA;
+ border-top: 1px none #E0E0E0;
+ border-right: 1px none #E0E0E0;
+ border-bottom: 1px none #E0E0E0;
+ border-left: 1px none #E0E0E0;
+ margin: 0px;
+}
+.memItemLeft {
+ padding: 1px 0px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: solid;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.memItemRight {
+ padding: 1px 8px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: solid;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.memTemplItemLeft {
+ padding: 1px 0px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: none;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.memTemplItemRight {
+ padding: 1px 8px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: none;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.memTemplParams {
+ padding: 1px 0px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: solid;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ color: #606060;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.search {
+ color: #003399;
+ font-weight: bold;
+}
+FORM.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+INPUT.search {
+ font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+TD.tiny {
+ font-size: 75%;
+}
+a {
+ color: #1A41A8;
+}
+a:visited {
+ color: #2A3798;
+}
+.dirtab {
+ padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #84b0c7;
+}
+TH.dirtab {
+ background: #e8eef2;
+ font-weight: bold;
+}
+HR {
+ height: 1px;
+ border: none;
+ border-top: 1px solid black;
+}
+
+/* Style for detailed member documentation */
+.memtemplate {
+ font-size: 80%;
+ color: #606060;
+ font-weight: normal;
+ margin-left: 3px;
+}
+.memnav {
+ background-color: #e8eef2;
+ border: 1px solid #84b0c7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+.memitem {
+ padding: 4px;
+ background-color: #eef3f5;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #dedeee;
+ -moz-border-radius: 8px 8px 8px 8px;
+}
+.memname {
+ white-space: nowrap;
+ font-weight: bold;
+}
+.memdoc{
+ padding-left: 10px;
+}
+.memproto {
+ background-color: #d5e1e8;
+ width: 100%;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #84b0c7;
+ font-weight: bold;
+ -moz-border-radius: 8px 8px 8px 8px;
+}
+.paramkey {
+ text-align: right;
+}
+.paramtype {
+ white-space: nowrap;
+}
+.paramname {
+ color: #602020;
+ font-style: italic;
+ white-space: nowrap;
+}
+/* End Styling for detailed member documentation */
+
+/* for the tree view */
+.ftvtree {
+ font-family: sans-serif;
+ margin:0.5em;
+}
+/* these are for tree view when used as main index */
+.directory {
+ font-size: 9pt;
+ font-weight: bold;
+}
+.directory h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+/* The following two styles can be used to replace the root node title */
+/* with an image of your choice. Simply uncomment the next two styles, */
+/* specify the name of your image and be sure to set 'height' to the */
+/* proper pixel height of your image. */
+
+/* .directory h3.swap { */
+/* height: 61px; */
+/* background-repeat: no-repeat; */
+/* background-image: url("yourimage.gif"); */
+/* } */
+/* .directory h3.swap span { */
+/* display: none; */
+/* } */
+
+.directory > h3 {
+ margin-top: 0;
+}
+.directory p {
+ margin: 0px;
+ white-space: nowrap;
+}
+.directory div {
+ display: none;
+ margin: 0px;
+}
+.directory img {
+ vertical-align: -30%;
+}
+/* these are for tree view when not used as main index */
+.directory-alt {
+ font-size: 100%;
+ font-weight: bold;
+}
+.directory-alt h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+.directory-alt > h3 {
+ margin-top: 0;
+}
+.directory-alt p {
+ margin: 0px;
+ white-space: nowrap;
+}
+.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+.directory-alt img {
+ vertical-align: -30%;
+}
+
diff --git a/pdk/docs/doxygen.png b/pdk/docs/doxygen.png
new file mode 100755
index 000000000..f0a274bba
Binary files /dev/null and b/pdk/docs/doxygen.png differ
diff --git a/pdk/docs/files.html b/pdk/docs/files.html
new file mode 100755
index 000000000..ec7523914
--- /dev/null
+++ b/pdk/docs/files.html
@@ -0,0 +1,42 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
File List Here is a list of all files with brief descriptions:
+
+
+
diff --git a/pdk/docs/functions.html b/pdk/docs/functions.html
new file mode 100755
index 000000000..c31d517b6
--- /dev/null
+++ b/pdk/docs/functions.html
@@ -0,0 +1,258 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+Here is a list of all struct and union fields with links to the structures/unions they belong to:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pdk/docs/functions_func.html b/pdk/docs/functions_func.html
new file mode 100755
index 000000000..2d1c1dcc3
--- /dev/null
+++ b/pdk/docs/functions_func.html
@@ -0,0 +1,179 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pdk/docs/functions_vars.html b/pdk/docs/functions_vars.html
new file mode 100755
index 000000000..6d4b71802
--- /dev/null
+++ b/pdk/docs/functions_vars.html
@@ -0,0 +1,158 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pdk/docs/getting_source_code.html b/pdk/docs/getting_source_code.html
index 49bfcb0ae..ad0cddbd4 100755
--- a/pdk/docs/getting_source_code.html
+++ b/pdk/docs/getting_source_code.html
@@ -2,11 +2,23 @@
-Android - Getting Source Code
+Android - Porting Guide
+
@@ -33,6 +45,7 @@ h1,h2,h3 {
+
diff --git a/pdk/docs/globals.html b/pdk/docs/globals.html
new file mode 100755
index 000000000..2ae967fce
--- /dev/null
+++ b/pdk/docs/globals.html
@@ -0,0 +1,91 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+
+
+do_dhcp_request()
+: wifi.h
+ get_dhcp_error_string()
+: wifi.h
+ gps_get_hardware_interface()
+: gps.h
+ gps_get_interface()
+: gps.h
+ gps_get_qemu_interface()
+: gps.h
+ gps_location_callback
+: gps.h
+ gps_status_callback
+: gps.h
+ gps_sv_status_callback
+: gps.h
+ gps_xtra_download_request
+: gps.h
+ GpsAidingData
+: gps.h
+ GpsLocationFlags
+: gps.h
+ GpsPositionMode
+: gps.h
+ GpsStatusValue
+: gps.h
+ GpsUtcTime
+: gps.h
+ wifi_close_supplicant_connection()
+: wifi.h
+ wifi_command()
+: wifi.h
+ wifi_connect_to_supplicant()
+: wifi.h
+ wifi_load_driver()
+: wifi.h
+ wifi_start_supplicant()
+: wifi.h
+ wifi_stop_supplicant()
+: wifi.h
+ wifi_unload_driver()
+: wifi.h
+ wifi_wait_for_event()
+: wifi.h
+
+
+
+
diff --git a/pdk/docs/globals_func.html b/pdk/docs/globals_func.html
new file mode 100755
index 000000000..436cbf7a6
--- /dev/null
+++ b/pdk/docs/globals_func.html
@@ -0,0 +1,73 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
+
+
+do_dhcp_request()
+: wifi.h
+ get_dhcp_error_string()
+: wifi.h
+ gps_get_hardware_interface()
+: gps.h
+ gps_get_interface()
+: gps.h
+ gps_get_qemu_interface()
+: gps.h
+ wifi_close_supplicant_connection()
+: wifi.h
+ wifi_command()
+: wifi.h
+ wifi_connect_to_supplicant()
+: wifi.h
+ wifi_load_driver()
+: wifi.h
+ wifi_start_supplicant()
+: wifi.h
+ wifi_stop_supplicant()
+: wifi.h
+ wifi_unload_driver()
+: wifi.h
+ wifi_wait_for_event()
+: wifi.h
+
+
+
+
diff --git a/pdk/docs/globals_type.html b/pdk/docs/globals_type.html
new file mode 100755
index 000000000..ec0afbc91
--- /dev/null
+++ b/pdk/docs/globals_type.html
@@ -0,0 +1,65 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
+
+
+gps_location_callback
+: gps.h
+ gps_status_callback
+: gps.h
+ gps_sv_status_callback
+: gps.h
+ gps_xtra_download_request
+: gps.h
+ GpsAidingData
+: gps.h
+ GpsLocationFlags
+: gps.h
+ GpsPositionMode
+: gps.h
+ GpsStatusValue
+: gps.h
+ GpsUtcTime
+: gps.h
+
+
+
+
diff --git a/pdk/docs/gps.html b/pdk/docs/gps.html
new file mode 100755
index 000000000..eb5473fc1
--- /dev/null
+++ b/pdk/docs/gps.html
@@ -0,0 +1,259 @@
+
+
+
+
+Android - Porting Guide
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Android Platform Development Kit
+
+
+
+
+
+
+
+
+
+
+ Introduction
+
+
+
+ Dev Environment Setup
+
+
+ Basic Bring up
+
+
+
+
+ Multimedia
+
+
+ Power Management
+
+
+
+
+ Networking
+
+
+
+ Telephony
+
+
+ Testing
+
+
+
+
+
+
+
+
+
+
+
+
+
Introduction
+
+
Android defines a user space C abstraction interface for GPS hardware. The interface header is defined in include/hardware/gps.h. In order to integate GPS with Android, you need to build a shared library that implements this interface.
+
+
+
Building a GPS Library
+
+
To implement a GPS driver, create a shared library that implements the interface defined in gps.h. You must name your shared library libgps.so so that it will get loaded from /system/lib at runtime. Place GPS sources and Android.mk in partner/acme/chipset_or_board/gps/ (where "acme" is your product name and "chipset_or_board" is your hardware target).
+
+
The following stub Android.mk file ensures that libgps compiles and links to the appropriate libraries:
+
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libgps
+
+LOCAL_STATIC_LIBRARIES:= \
+# include any static library dependencies
+
+LOCAL_SHARED_LIBRARIES := \
+# include any shared library dependencies
+
+LOCAL_SRC_FILES += \
+# include your source files. eg. MyGpsLibrary.cpp
+
+LOCAL_CFLAGS += \
+# include any needed compile flags
+
+LOCAL_C_INCLUDES:= \
+# include any needed local header files
+
+include $(BUILD_SHARED_LIBRARY)
+
+
+
+
Interface
+
+
+
+
+
+
Note : This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, click here .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ v0.6 - 25 November 2008
+
+
+
diff --git a/pdk/docs/gps_8h-source.html b/pdk/docs/gps_8h-source.html
new file mode 100755
index 000000000..dbf6a16bc
--- /dev/null
+++ b/pdk/docs/gps_8h-source.html
@@ -0,0 +1,298 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+gps.h Go to the documentation of this file. 00001
+ 00002
+ 00003
+ 00004
+ 00005
+ 00006
+ 00007
+ 00008
+ 00009
+ 00010
+ 00011
+ 00012
+ 00013
+ 00014
+ 00015
+ 00016
+ 00017 #ifndef _HARDWARE_GPS_H
+ 00018 #define _HARDWARE_GPS_H
+ 00019
+ 00020 #include <stdint.h>
+ 00021
+ 00022 #if __cplusplus
+ 00023 extern "C" {
+ 00024 #endif
+ 00025
+ 00026
+00027 typedef int64_t GpsUtcTime ;
+ 00028
+ 00029
+ 00030 #define GPS_MAX_SVS 32
+ 00031
+ 00032
+00033 typedef uint16_t GpsPositionMode ;
+ 00034
+ 00035
+ 00036
+ 00037 #define GPS_POSITION_MODE_STANDALONE 0
+ 00038
+ 00039 #define GPS_POSITION_MODE_MS_BASED 1
+ 00040
+ 00041 #define GPS_POSITION_MODE_MS_ASSISTED 2
+ 00042
+ 00043
+00044 typedef uint16_t GpsStatusValue ;
+ 00045
+ 00046
+ 00047
+ 00048 #define GPS_STATUS_NONE 0
+ 00049
+ 00050 #define GPS_STATUS_SESSION_BEGIN 1
+ 00051
+ 00052 #define GPS_STATUS_SESSION_END 2
+ 00053
+ 00054 #define GPS_STATUS_ENGINE_ON 3
+ 00055
+ 00056 #define GPS_STATUS_ENGINE_OFF 4
+ 00057
+ 00058
+00059 typedef uint16_t GpsLocationFlags ;
+ 00060
+ 00061
+ 00062
+ 00063 #define GPS_LOCATION_HAS_LAT_LONG 0x0001
+ 00064
+ 00065 #define GPS_LOCATION_HAS_ALTITUDE 0x0002
+ 00066
+ 00067 #define GPS_LOCATION_HAS_SPEED 0x0004
+ 00068
+ 00069 #define GPS_LOCATION_HAS_BEARING 0x0008
+ 00070
+ 00071 #define GPS_LOCATION_HAS_ACCURACY 0x0010
+ 00072
+ 00073
+ 00074
+00075 typedef uint16_t GpsAidingData ;
+ 00076
+ 00077
+ 00078 #define GPS_DELETE_EPHEMERIS 0x0001
+ 00079 #define GPS_DELETE_ALMANAC 0x0002
+ 00080 #define GPS_DELETE_POSITION 0x0004
+ 00081 #define GPS_DELETE_TIME 0x0008
+ 00082 #define GPS_DELETE_IONO 0x0010
+ 00083 #define GPS_DELETE_UTC 0x0020
+ 00084 #define GPS_DELETE_HEALTH 0x0040
+ 00085 #define GPS_DELETE_SVDIR 0x0080
+ 00086 #define GPS_DELETE_SVSTEER 0x0100
+ 00087 #define GPS_DELETE_SADATA 0x0200
+ 00088 #define GPS_DELETE_RTI 0x0400
+ 00089 #define GPS_DELETE_CELLDB_INFO 0x8000
+ 00090 #define GPS_DELETE_ALL 0xFFFF
+ 00091
+ 00092
+ 00093
+ 00094
+ 00095 #define GPS_XTRA_INTERFACE "gps-xtra"
+ 00096
+ 00097
+ 00098
+ 00099
+ 00100 #define GPS_SUPL_INTERFACE "gps-supl"
+ 00101
+ 00102
+00103 typedef struct {
+ 00104
+00105 uint16_t flags;
+ 00106
+00107 double latitude;
+ 00108
+00109 double longitude;
+ 00110
+ 00111
+00112 double altitude;
+ 00113
+00114 float speed;
+ 00115
+00116 float bearing;
+ 00117
+00118 float accuracy;
+ 00119
+00120 GpsUtcTime timestamp;
+ 00121 } GpsLocation ;
+ 00122
+ 00123
+00124 typedef struct {
+00125 GpsStatusValue status;
+ 00126 } GpsStatus ;
+ 00127
+ 00128
+00129 typedef struct {
+ 00130
+00131 int prn;
+ 00132
+00133 float snr;
+ 00134
+00135 float elevation;
+ 00136
+00137 float azimuth;
+ 00138 } GpsSvInfo ;
+ 00139
+ 00140
+00141 typedef struct {
+ 00142
+00143 int num_svs;
+ 00144
+ 00145
+00146 GpsSvInfo sv_list[GPS_MAX_SVS];
+ 00147
+ 00148
+ 00149
+ 00150
+00151 uint32_t ephemeris_mask;
+ 00152
+ 00153
+ 00154
+ 00155
+00156 uint32_t almanac_mask;
+ 00157
+ 00158
+ 00159
+ 00160
+ 00161
+00162 uint32_t used_in_fix_mask;
+ 00163 } GpsSvStatus ;
+ 00164
+ 00165
+00166 typedef void (* gps_location_callback )(GpsLocation * location);
+ 00167
+ 00168
+00169 typedef void (* gps_status_callback )(GpsStatus * status);
+ 00170
+ 00171
+00172 typedef void (* gps_sv_status_callback )(GpsSvStatus * sv_info);
+ 00173
+ 00174
+00175 typedef struct {
+00176 gps_location_callback location_cb;
+00177 gps_status_callback status_cb;
+00178 gps_sv_status_callback sv_status_cb;
+ 00179 } GpsCallbacks ;
+ 00180
+ 00181
+ 00182
+00183 typedef struct {
+ 00184
+ 00185
+ 00186
+ 00187
+ 00188 int (*init)( GpsCallbacks * callbacks );
+ 00189
+ 00190
+ 00191 int (*start)( void );
+ 00192
+ 00193
+ 00194 int (*stop)( void );
+ 00195
+ 00196
+ 00197 void (*set_fix_frequency)( int frequency );
+ 00198
+ 00199
+ 00200 void (*cleanup)( void );
+ 00201
+ 00202
+ 00203 int (*inject_time)(GpsUtcTime time, int64_t timeReference,
+ 00204 int uncertainty);
+ 00205
+ 00206
+ 00207
+ 00208
+ 00209
+ 00210
+ 00211 void (*delete_aiding_data)(GpsAidingData flags);
+ 00212
+ 00213
+ 00214
+ 00215
+ 00216
+ 00217 int (*set_position_mode)(GpsPositionMode mode, int fix_frequency);
+ 00218
+ 00219
+ 00220 const void * (*get_extension)(const char * name);
+ 00221 } GpsInterface ;
+ 00222
+ 00223
+ 00224
+ 00225
+00226 typedef void (* gps_xtra_download_request )();
+ 00227
+ 00228
+00229 typedef struct {
+00230 gps_xtra_download_request download_request_cb;
+ 00231 } GpsXtraCallbacks ;
+ 00232
+ 00233
+00234 typedef struct {
+ 00235
+ 00236
+ 00237
+ 00238
+ 00239 int (*init)( GpsXtraCallbacks * callbacks );
+ 00240
+ 00241 int (*inject_xtra_data)( char * data, int length );
+ 00242 } GpsXtraInterface ;
+ 00243
+ 00244
+00245 typedef struct {
+ 00246
+ 00247
+ 00248
+ 00249 int (*set_apn)( const char * apn );
+ 00250 } GpsSuplInterface ;
+ 00251
+ 00252
+ 00253 const GpsInterface * gps_get_hardware_interface ();
+ 00254
+ 00255
+ 00256
+ 00257
+ 00258 const GpsInterface * gps_get_qemu_interface ();
+ 00259
+ 00260
+ 00261
+ 00262
+ 00263 const GpsInterface * gps_get_interface ();
+ 00264
+ 00265 #if __cplusplus
+ 00266 }
+ 00267 #endif
+ 00268
+ 00269 #endif // _HARDWARE_GPS_H
+
+
+
diff --git a/pdk/docs/gps_8h.html b/pdk/docs/gps_8h.html
new file mode 100755
index 000000000..726d25e7c
--- /dev/null
+++ b/pdk/docs/gps_8h.html
@@ -0,0 +1,337 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
gps.h File Reference
+
+Go to the source code of this file.
+
Typedef Documentation
+
+
+
+
+
+
+Callback with location information.
+
+
+
Definition at line 166 of file gps.h .
+
+
+
+
+
+
+
+
+
+Callback with status information.
+
+
+
Definition at line 169 of file gps.h .
+
+
+
+
+
+
+
+
+
+Callback with SV status information.
+
+
+
Definition at line 172 of file gps.h .
+
+
+
+
+
+
+
+
+
+Callback to request the client to download XTRA data.
+
+The client should download XTRA data and inject it by calling inject_xtra_data().
+
Definition at line 226 of file gps.h .
+
+
+
+
+
+
+
+
+
+Flags used to specify which aiding data to delete when calling delete_aiding_data().
+
+
+
Definition at line 75 of file gps.h .
+
+
+
+
+
+
+
+
+
+Flags to indicate which values are valid in a GpsLocation .
+
+
+
Definition at line 59 of file gps.h .
+
+
+
+
+
+
+
+
+
+Requested mode for GPS operation.
+
+
+
Definition at line 33 of file gps.h .
+
+
+
+
+
+
+
+
+
+GPS status event values.
+
+
+
Definition at line 44 of file gps.h .
+
+
+
+
+
+
+
+
+
+Milliseconds since January 1, 1970.
+
+
+
Definition at line 27 of file gps.h .
+
+
+
+
Function Documentation
+
+
+
+
+
+ const GpsInterface * gps_get_hardware_interface
+ (
+
+ )
+
+
+
+
+
+
+
+Returns the hardware GPS interface.
+
+
+
+
+
+
+
+
+
+
+Returns the default GPS interface.
+
+
+
+
+
+
+
+
+
+ const GpsInterface * gps_get_qemu_interface
+ (
+
+ )
+
+
+
+
+
+
+
+Returns the qemu emulated GPS interface.
+
+
+
+
+
+
+
diff --git a/pdk/docs/group__memory.html b/pdk/docs/group__memory.html
new file mode 100755
index 000000000..44d078280
--- /dev/null
+++ b/pdk/docs/group__memory.html
@@ -0,0 +1,37 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
+This is the text in the "Providing Heap Memory" subgroup
+
+
diff --git a/pdk/docs/group__networking.html b/pdk/docs/group__networking.html
new file mode 100755
index 000000000..6a8e1b846
--- /dev/null
+++ b/pdk/docs/group__networking.html
@@ -0,0 +1,38 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
Neworking Support
+
Detailed Description
+This is a text for the Networking Support Group
+
+
diff --git a/pdk/docs/groups_8dox.html b/pdk/docs/groups_8dox.html
new file mode 100755
index 000000000..fe63adaf1
--- /dev/null
+++ b/pdk/docs/groups_8dox.html
@@ -0,0 +1,33 @@
+
+
+
+
+Doxygen-Generated Content
+
+
+
+
+
+
+
+
groups.dox File Reference
+
+
+
diff --git a/pdk/docs/index.html b/pdk/docs/index.html
index 834db8ff9..6eac80b5a 100755
--- a/pdk/docs/index.html
+++ b/pdk/docs/index.html
@@ -7,6 +7,18 @@
+
@@ -33,6 +45,7 @@ h1,h2,h3 {
+