diff options
67 files changed, 0 insertions, 2259 deletions
diff --git a/apps/DeviceConfig/.classpath b/apps/DeviceConfig/.classpath deleted file mode 100644 index d3bb07b44..000000000 --- a/apps/DeviceConfig/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> - <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="gen"/> - <classpathentry kind="output" path="bin/classes"/> -</classpath> diff --git a/apps/DeviceConfig/.project b/apps/DeviceConfig/.project deleted file mode 100644 index ca720132b..000000000 --- a/apps/DeviceConfig/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>DeviceConfig</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.android.ide.eclipse.adt.ApkBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>com.android.ide.eclipse.adt.AndroidNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/apps/DeviceConfig/.settings/org.eclipse.jdt.core.prefs b/apps/DeviceConfig/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index d9295f626..000000000 --- a/apps/DeviceConfig/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Tue May 22 15:51:27 PDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/apps/DeviceConfig/AndroidManifest.xml b/apps/DeviceConfig/AndroidManifest.xml deleted file mode 100644 index b81f58ef3..000000000 --- a/apps/DeviceConfig/AndroidManifest.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.deviceconfig" - android:versionCode="1" - android:versionName="1.0" > - - <uses-permission android:name="android.permission.CAMERA" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <uses-feature android:name="android.hardware.camera" /> - - <uses-sdk - android:minSdkVersion="8" - android:targetSdkVersion="15" /> - - <application - android:icon="@drawable/icon" - android:label="@string/app_name" > - <activity - android:name=".MyActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/apps/DeviceConfig/README.txt b/apps/DeviceConfig/README.txt deleted file mode 100644 index bbf0557e4..000000000 --- a/apps/DeviceConfig/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -This project can be run on a device to populate some default values -for a vendor device description (such as the ones found in -tools/base/files/devices.xml). - -Note that some of the values must be edited afterwards, so be sure to -read the UPDATE_DEVICES.txt file in that directory. diff --git a/apps/DeviceConfig/build.xml b/apps/DeviceConfig/build.xml deleted file mode 100644 index a48344c2c..000000000 --- a/apps/DeviceConfig/build.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="MyActivity" default="help"> - - <!-- The local.properties file is created and updated by the 'android' tool. - It contains the path to the SDK. It should *NOT* be checked into - Version Control Systems. --> - <property file="local.properties" /> - - <!-- The ant.properties file can be created by you. It is only edited by the - 'android' tool to add properties to it. - This is the place to change some Ant specific build properties. - Here are some properties you may want to change/update: - - source.dir - The name of the source directory. Default is 'src'. - out.dir - The name of the output directory. Default is 'bin'. - - For other overridable properties, look at the beginning of the rules - files in the SDK, at tools/ant/build.xml - - Properties related to the SDK location or the project target should - be updated using the 'android' tool with the 'update' action. - - This file is an integral part of the build system for your - application and should be checked into Version Control Systems. - - --> - <property file="ant.properties" /> - - <!-- The project.properties file is created and updated by the 'android' - tool, as well as ADT. - - This contains project specific properties such as project target, and library - dependencies. Lower level build properties are stored in ant.properties - (or in .classpath for Eclipse projects). - - This file is an integral part of the build system for your - application and should be checked into Version Control Systems. --> - <loadproperties srcFile="project.properties" /> - - <!-- if sdk.dir was not set from one of the property file, then - get it from the ANDROID_HOME env var. --> - <property environment="env" /> - <condition property="sdk.dir" value="${env.ANDROID_HOME}"> - <isset property="env.ANDROID_HOME" /> - </condition> - - <!-- quick check on sdk.dir --> - <fail - message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable." - unless="sdk.dir" - /> - - <!-- - Import per project custom build rules if present at the root of the project. - This is the place to put custom intermediary targets such as: - -pre-build - -pre-compile - -post-compile (This is typically used for code obfuscation. - Compiled code location: ${out.classes.absolute.dir} - If this is not done in place, override ${out.dex.input.absolute.dir}) - -post-package - -post-build - -pre-clean - --> - <import file="custom_rules.xml" optional="true" /> - - <!-- Import the actual build file. - - To customize existing targets, there are two options: - - Customize only one target: - - copy/paste the target into this file, *before* the - <import> task. - - customize it to your needs. - - Customize the whole content of build.xml - - copy/paste the content of the rules files (minus the top node) - into this file, replacing the <import> task. - - customize to your needs. - - *********************** - ****** IMPORTANT ****** - *********************** - In all cases you must update the value of version-tag below to read 'custom' instead of an integer, - in order to avoid having your file be overridden by tools such as "android update project" - --> - <!-- version-tag: 1 --> - <import file="${sdk.dir}/tools/ant/build.xml" /> - -</project> diff --git a/apps/DeviceConfig/proguard-project.txt b/apps/DeviceConfig/proguard-project.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/apps/DeviceConfig/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/apps/DeviceConfig/project.properties b/apps/DeviceConfig/project.properties deleted file mode 100644 index 8da376af8..000000000 --- a/apps/DeviceConfig/project.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-15 diff --git a/apps/DeviceConfig/res/drawable-hdpi/icon.png b/apps/DeviceConfig/res/drawable-hdpi/icon.png Binary files differdeleted file mode 100644 index 75024841d..000000000 --- a/apps/DeviceConfig/res/drawable-hdpi/icon.png +++ /dev/null diff --git a/apps/DeviceConfig/res/drawable-ldpi/icon.png b/apps/DeviceConfig/res/drawable-ldpi/icon.png Binary files differdeleted file mode 100644 index 75024841d..000000000 --- a/apps/DeviceConfig/res/drawable-ldpi/icon.png +++ /dev/null diff --git a/apps/DeviceConfig/res/drawable-mdpi/icon.png b/apps/DeviceConfig/res/drawable-mdpi/icon.png Binary files differdeleted file mode 100644 index 75024841d..000000000 --- a/apps/DeviceConfig/res/drawable-mdpi/icon.png +++ /dev/null diff --git a/apps/DeviceConfig/res/drawable-nodpi/icon.png b/apps/DeviceConfig/res/drawable-nodpi/icon.png Binary files differdeleted file mode 100644 index 75024841d..000000000 --- a/apps/DeviceConfig/res/drawable-nodpi/icon.png +++ /dev/null diff --git a/apps/DeviceConfig/res/drawable/icon.png b/apps/DeviceConfig/res/drawable/icon.png Binary files differdeleted file mode 100644 index 75024841d..000000000 --- a/apps/DeviceConfig/res/drawable/icon.png +++ /dev/null diff --git a/apps/DeviceConfig/res/layout/main.xml b/apps/DeviceConfig/res/layout/main.xml deleted file mode 100644 index a30b126aa..000000000 --- a/apps/DeviceConfig/res/layout/main.xml +++ /dev/null @@ -1,395 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" > - - <LinearLayout - android:id="@+id/buttonHolder" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" > - - <Button - android:id="@+id/generateConfigButton" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/generate_config" /> - </LinearLayout> - - <ScrollView - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_above="@id/buttonHolder" > - - <TableLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:padding="5dip" > - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:background="#333" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="#333" - android:text="Type" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="#333" - android:text="Resource" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="API" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Screen Size" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/screen_size" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Screen Ratio" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/screen_long" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Screen Orientation" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/orientation" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Dock" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/dock" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Night" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/night" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Density" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/density" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Touch Type" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/touch" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Keyboard State" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/keyboard_state" > - </TextView> - - <TextView - android:id="@+id/keyboard_state_api" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="API" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Text Input" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_input" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Nav State" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/nav_state" > - </TextView> - - <TextView - android:id="@+id/nav_state_api" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="API" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Navigation" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/navigation" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Screen Size" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content"> - </TextView> - - <TextView - android:id="@+id/size_api" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="API" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Version" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/version" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="xdpi" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="N/A" > - </TextView> - - <TextView - android:id="@+id/xdpi" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="xdpi" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="ydpi" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="N/A" > - </TextView> - - <TextView - android:id="@+id/ydpi" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="ydpi" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="scaledDensity" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="N/A" > - </TextView> - - <TextView - android:id="@+id/scaled_density" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="scaledDensity" > - </TextView> - </TableRow> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="fontScale" > - </TextView> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="N/A" > - </TextView> - - <TextView - android:id="@+id/font_scale" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="fontScale" > - </TextView> - </TableRow> - </TableLayout> - </ScrollView> - -</RelativeLayout>
\ No newline at end of file diff --git a/apps/DeviceConfig/res/values-12key/strings.xml b/apps/DeviceConfig/res/values-12key/strings.xml deleted file mode 100644 index 8d1840b46..000000000 --- a/apps/DeviceConfig/res/values-12key/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="text_input">12 KEY</string> -</resources> diff --git a/apps/DeviceConfig/res/values-car/strings.xml b/apps/DeviceConfig/res/values-car/strings.xml deleted file mode 100644 index 0cedbabc4..000000000 --- a/apps/DeviceConfig/res/values-car/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="dock">CAR</string> -</resources> diff --git a/apps/DeviceConfig/res/values-desk/strings.xml b/apps/DeviceConfig/res/values-desk/strings.xml deleted file mode 100644 index 4ea832b5a..000000000 --- a/apps/DeviceConfig/res/values-desk/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="dock">DESK</string> -</resources> diff --git a/apps/DeviceConfig/res/values-dpad/strings.xml b/apps/DeviceConfig/res/values-dpad/strings.xml deleted file mode 100644 index 1a94d25c2..000000000 --- a/apps/DeviceConfig/res/values-dpad/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="navigation">D-PAD</string> -</resources> diff --git a/apps/DeviceConfig/res/values-finger/strings.xml b/apps/DeviceConfig/res/values-finger/strings.xml deleted file mode 100644 index bc169e745..000000000 --- a/apps/DeviceConfig/res/values-finger/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="touch">FINGER</string> -</resources> diff --git a/apps/DeviceConfig/res/values-hdpi/strings.xml b/apps/DeviceConfig/res/values-hdpi/strings.xml deleted file mode 100644 index 4f85a70f8..000000000 --- a/apps/DeviceConfig/res/values-hdpi/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="density">HIGH</string> -</resources> diff --git a/apps/DeviceConfig/res/values-keysexposed/strings.xml b/apps/DeviceConfig/res/values-keysexposed/strings.xml deleted file mode 100644 index 006e05424..000000000 --- a/apps/DeviceConfig/res/values-keysexposed/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="keyboard_state">EXPOSED</string> -</resources> diff --git a/apps/DeviceConfig/res/values-keyshidden/strings.xml b/apps/DeviceConfig/res/values-keyshidden/strings.xml deleted file mode 100644 index 2463a0211..000000000 --- a/apps/DeviceConfig/res/values-keyshidden/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="keyboard_state">HIDDEN</string> -</resources> diff --git a/apps/DeviceConfig/res/values-keyssoft/strings.xml b/apps/DeviceConfig/res/values-keyssoft/strings.xml deleted file mode 100644 index 262f0e233..000000000 --- a/apps/DeviceConfig/res/values-keyssoft/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="keyboard_state">SOFT</string> -</resources> diff --git a/apps/DeviceConfig/res/values-land/strings.xml b/apps/DeviceConfig/res/values-land/strings.xml deleted file mode 100644 index 0e8e76bef..000000000 --- a/apps/DeviceConfig/res/values-land/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="orientation">LANDSCAPE</string> -</resources> diff --git a/apps/DeviceConfig/res/values-large/strings.xml b/apps/DeviceConfig/res/values-large/strings.xml deleted file mode 100644 index 579cc7d4a..000000000 --- a/apps/DeviceConfig/res/values-large/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="screen_size">LARGE</string> -</resources> diff --git a/apps/DeviceConfig/res/values-ldpi/strings.xml b/apps/DeviceConfig/res/values-ldpi/strings.xml deleted file mode 100644 index 8a19b696e..000000000 --- a/apps/DeviceConfig/res/values-ldpi/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="density">LOW</string> -</resources> diff --git a/apps/DeviceConfig/res/values-long/strings.xml b/apps/DeviceConfig/res/values-long/strings.xml deleted file mode 100644 index a2ab99138..000000000 --- a/apps/DeviceConfig/res/values-long/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="screen_long">LONG</string> -</resources> diff --git a/apps/DeviceConfig/res/values-mdpi/strings.xml b/apps/DeviceConfig/res/values-mdpi/strings.xml deleted file mode 100644 index 1509fb2d1..000000000 --- a/apps/DeviceConfig/res/values-mdpi/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="density">MEDIUM</string> -</resources> diff --git a/apps/DeviceConfig/res/values-navexposed/strings.xml b/apps/DeviceConfig/res/values-navexposed/strings.xml deleted file mode 100644 index ec714f192..000000000 --- a/apps/DeviceConfig/res/values-navexposed/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="nav_state">EXPOSED</string> -</resources> diff --git a/apps/DeviceConfig/res/values-navhidden/strings.xml b/apps/DeviceConfig/res/values-navhidden/strings.xml deleted file mode 100644 index f60b41f0d..000000000 --- a/apps/DeviceConfig/res/values-navhidden/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="nav_state">HIDDEN</string> -</resources> diff --git a/apps/DeviceConfig/res/values-night/strings.xml b/apps/DeviceConfig/res/values-night/strings.xml deleted file mode 100644 index dc601f08f..000000000 --- a/apps/DeviceConfig/res/values-night/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="night">NIGHT</string> -</resources> diff --git a/apps/DeviceConfig/res/values-nodpi/strings.xml b/apps/DeviceConfig/res/values-nodpi/strings.xml deleted file mode 100644 index 00ef99a9d..000000000 --- a/apps/DeviceConfig/res/values-nodpi/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="density">NODPI</string> -</resources> diff --git a/apps/DeviceConfig/res/values-nokeys/strings.xml b/apps/DeviceConfig/res/values-nokeys/strings.xml deleted file mode 100644 index fdfaab87e..000000000 --- a/apps/DeviceConfig/res/values-nokeys/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="text_input">NO KEYS</string> -</resources> diff --git a/apps/DeviceConfig/res/values-nonav/strings.xml b/apps/DeviceConfig/res/values-nonav/strings.xml deleted file mode 100644 index 1e4198c9b..000000000 --- a/apps/DeviceConfig/res/values-nonav/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="navigation">NO NAV</string> -</resources> diff --git a/apps/DeviceConfig/res/values-normal/strings.xml b/apps/DeviceConfig/res/values-normal/strings.xml deleted file mode 100644 index 2be7ed056..000000000 --- a/apps/DeviceConfig/res/values-normal/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="screen_size">NORMAL</string> -</resources> diff --git a/apps/DeviceConfig/res/values-notlong/strings.xml b/apps/DeviceConfig/res/values-notlong/strings.xml deleted file mode 100644 index 13730e33b..000000000 --- a/apps/DeviceConfig/res/values-notlong/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="screen_long">NOTLONG</string> -</resources> diff --git a/apps/DeviceConfig/res/values-notnight/strings.xml b/apps/DeviceConfig/res/values-notnight/strings.xml deleted file mode 100644 index 596d27e07..000000000 --- a/apps/DeviceConfig/res/values-notnight/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="night">NOTNIGHT</string> -</resources> diff --git a/apps/DeviceConfig/res/values-notouch/strings.xml b/apps/DeviceConfig/res/values-notouch/strings.xml deleted file mode 100644 index cf643b995..000000000 --- a/apps/DeviceConfig/res/values-notouch/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="touch">NOTOUCH</string> -</resources> diff --git a/apps/DeviceConfig/res/values-port/strings.xml b/apps/DeviceConfig/res/values-port/strings.xml deleted file mode 100644 index 4dc45158c..000000000 --- a/apps/DeviceConfig/res/values-port/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="orientation">PORTRAIT</string> -</resources> diff --git a/apps/DeviceConfig/res/values-qwerty/strings.xml b/apps/DeviceConfig/res/values-qwerty/strings.xml deleted file mode 100644 index 7c58d63bd..000000000 --- a/apps/DeviceConfig/res/values-qwerty/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="text_input">QWERTY</string> -</resources> diff --git a/apps/DeviceConfig/res/values-small/strings.xml b/apps/DeviceConfig/res/values-small/strings.xml deleted file mode 100644 index 861eda799..000000000 --- a/apps/DeviceConfig/res/values-small/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="screen_size">SMALL</string> -</resources> diff --git a/apps/DeviceConfig/res/values-stylus/strings.xml b/apps/DeviceConfig/res/values-stylus/strings.xml deleted file mode 100644 index a59efa794..000000000 --- a/apps/DeviceConfig/res/values-stylus/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="touch">STYLUS</string> -</resources> diff --git a/apps/DeviceConfig/res/values-trackball/strings.xml b/apps/DeviceConfig/res/values-trackball/strings.xml deleted file mode 100644 index bb9b35f9e..000000000 --- a/apps/DeviceConfig/res/values-trackball/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="navigation">TRACKBALL</string> -</resources> diff --git a/apps/DeviceConfig/res/values-tvdpi/strings.xml b/apps/DeviceConfig/res/values-tvdpi/strings.xml deleted file mode 100644 index 1bcc8fa0d..000000000 --- a/apps/DeviceConfig/res/values-tvdpi/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="density">TV</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v1/strings.xml b/apps/DeviceConfig/res/values-v1/strings.xml deleted file mode 100644 index 78f474e23..000000000 --- a/apps/DeviceConfig/res/values-v1/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">1</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v14/strings.xml b/apps/DeviceConfig/res/values-v14/strings.xml deleted file mode 100644 index d0c64ce63..000000000 --- a/apps/DeviceConfig/res/values-v14/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">14</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v2/strings.xml b/apps/DeviceConfig/res/values-v2/strings.xml deleted file mode 100644 index 251dbd3ee..000000000 --- a/apps/DeviceConfig/res/values-v2/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">2</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v3/strings.xml b/apps/DeviceConfig/res/values-v3/strings.xml deleted file mode 100644 index 7b9d0be96..000000000 --- a/apps/DeviceConfig/res/values-v3/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">3</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v4/strings.xml b/apps/DeviceConfig/res/values-v4/strings.xml deleted file mode 100644 index 217ebe59a..000000000 --- a/apps/DeviceConfig/res/values-v4/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">4</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v5/strings.xml b/apps/DeviceConfig/res/values-v5/strings.xml deleted file mode 100644 index 56f1a6f5a..000000000 --- a/apps/DeviceConfig/res/values-v5/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">5</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v6/strings.xml b/apps/DeviceConfig/res/values-v6/strings.xml deleted file mode 100644 index 7846da8e4..000000000 --- a/apps/DeviceConfig/res/values-v6/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">6</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v7/strings.xml b/apps/DeviceConfig/res/values-v7/strings.xml deleted file mode 100644 index 55649e271..000000000 --- a/apps/DeviceConfig/res/values-v7/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">7</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v8/strings.xml b/apps/DeviceConfig/res/values-v8/strings.xml deleted file mode 100644 index e546c5fa1..000000000 --- a/apps/DeviceConfig/res/values-v8/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">8</string> -</resources> diff --git a/apps/DeviceConfig/res/values-v9/strings.xml b/apps/DeviceConfig/res/values-v9/strings.xml deleted file mode 100644 index 1a0bbae01..000000000 --- a/apps/DeviceConfig/res/values-v9/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="version">9</string> -</resources> diff --git a/apps/DeviceConfig/res/values-wheel/strings.xml b/apps/DeviceConfig/res/values-wheel/strings.xml deleted file mode 100644 index ef5fa852d..000000000 --- a/apps/DeviceConfig/res/values-wheel/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="navigation">WHEEL</string> -</resources> diff --git a/apps/DeviceConfig/res/values-xhdpi/strings.xml b/apps/DeviceConfig/res/values-xhdpi/strings.xml deleted file mode 100644 index 214329d4f..000000000 --- a/apps/DeviceConfig/res/values-xhdpi/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="density">XHIGH</string> -</resources> diff --git a/apps/DeviceConfig/res/values-xlarge/strings.xml b/apps/DeviceConfig/res/values-xlarge/strings.xml deleted file mode 100644 index f59006d95..000000000 --- a/apps/DeviceConfig/res/values-xlarge/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<string name="screen_size">XLARGE</string> -</resources> diff --git a/apps/DeviceConfig/res/values/strings.xml b/apps/DeviceConfig/res/values/strings.xml deleted file mode 100644 index d13facac4..000000000 --- a/apps/DeviceConfig/res/values/strings.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="app_name">DeviceConfig</string> - <string name="dock">DEFAULT</string> - <string name="nav_state">DEFAULT</string> - <string name="generate_config">Generate Config</string> - <string name="type">Type</string> - <string name="resource">Resource</string> -</resources> diff --git a/apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java b/apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java deleted file mode 100644 index 3dbdfdb78..000000000 --- a/apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java +++ /dev/null @@ -1,673 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.android.deviceconfig; - -import android.annotation.SuppressLint; -import android.annotation.TargetApi; -import android.content.Context; -import android.content.pm.FeatureInfo; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.hardware.Camera; -import android.hardware.Camera.CameraInfo; -import android.os.Build; -import android.os.Environment; -import android.os.StatFs; -import android.util.DisplayMetrics; -import android.util.Log; -import android.view.ViewConfiguration; -import android.widget.Toast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; -import java.util.Locale; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerFactoryConfigurationError; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -public class ConfigGenerator { - private Context mCtx; - private String mExtensions; - - public static final String NS_DEVICES_XSD = "http://schemas.android.com/sdk/devices/1"; - - /** - * The "devices" element is the root element of this schema. - * - * It must contain one or more "device" elements that each define the - * hardware, software, and states for a given device. - */ - public static final String NODE_DEVICES = "devices"; - - /** - * A "device" element contains a "hardware" element, a "software" element - * for each API version it supports, and a "state" element for each possible - * state the device could be in. - */ - public static final String NODE_DEVICE = "device"; - - /** - * The "hardware" element contains all of the hardware information for a - * given device. - */ - public static final String NODE_HARDWARE = "hardware"; - - /** - * The "software" element contains all of the software information for an - * API version of the given device. - */ - public static final String NODE_SOFTWARE = "software"; - - /** - * The "state" element contains all of the parameters for a given state of - * the device. It's also capable of redefining hardware configurations if - * they change based on state. - */ - - public static final String NODE_STATE = "state"; - - public static final String NODE_KEYBOARD = "keyboard"; - public static final String NODE_TOUCH = "touch"; - public static final String NODE_GL_EXTENSIONS = "gl-extensions"; - public static final String NODE_GL_VERSION = "gl-version"; - public static final String NODE_NETWORKING = "networking"; - public static final String NODE_REMOVABLE_STORAGE = "removable-storage"; - public static final String NODE_FLASH = "flash"; - public static final String NODE_LIVE_WALLPAPER_SUPPORT = "live-wallpaper-support"; - public static final String NODE_BUTTONS = "buttons"; - public static final String NODE_CAMERA = "camera"; - public static final String NODE_LOCATION = "location"; - public static final String NODE_GPU = "gpu"; - public static final String NODE_DOCK = "dock"; - public static final String NODE_YDPI = "ydpi"; - public static final String NODE_POWER_TYPE = "power-type"; - public static final String NODE_Y_DIMENSION = "y-dimension"; - public static final String NODE_SCREEN_RATIO = "screen-ratio"; - public static final String NODE_NAV_STATE = "nav-state"; - public static final String NODE_MIC = "mic"; - public static final String NODE_RAM = "ram"; - public static final String NODE_XDPI = "xdpi"; - public static final String NODE_DIMENSIONS = "dimensions"; - public static final String NODE_ABI = "abi"; - public static final String NODE_MECHANISM = "mechanism"; - public static final String NODE_MULTITOUCH = "multitouch"; - public static final String NODE_NAV = "nav"; - public static final String NODE_PIXEL_DENSITY = "pixel-density"; - public static final String NODE_SCREEN_ORIENTATION = "screen-orientation"; - public static final String NODE_AUTOFOCUS = "autofocus"; - public static final String NODE_SCREEN_SIZE = "screen-size"; - public static final String NODE_DESCRIPTION = "description"; - public static final String NODE_BLUETOOTH_PROFILES = "bluetooth-profiles"; - public static final String NODE_SCREEN = "screen"; - public static final String NODE_SENSORS = "sensors"; - public static final String NODE_DIAGONAL_LENGTH = "diagonal-length"; - public static final String NODE_SCREEN_TYPE = "screen-type"; - public static final String NODE_KEYBOARD_STATE = "keyboard-state"; - public static final String NODE_X_DIMENSION = "x-dimension"; - public static final String NODE_CPU = "cpu"; - public static final String NODE_INTERNAL_STORAGE = "internal-storage"; - public static final String NODE_NAME = "name"; - public static final String NODE_MANUFACTURER = "manufacturer"; - public static final String NODE_API_LEVEL = "api-level"; - public static final String ATTR_DEFAULT = "default"; - public static final String ATTR_UNIT = "unit"; - public static final String UNIT_BYTES = "B"; - public static final String UNIT_KIBIBYTES = "KiB"; - public static final String UNIT_MEBIBYTES = "MiB"; - public static final String UNIT_GIBIBYTES = "GiB"; - public static final String UNIT_TEBIBYTES = "TiB"; - public static final String LOCAL_NS = "d"; - public static final String PREFIX = LOCAL_NS + ":"; - - private static final String TAG = "ConfigGenerator"; - - public ConfigGenerator(Context context, String extensions) { - mCtx = context; - mExtensions = extensions; - } - - @SuppressLint("WorldReadableFiles") - public String generateConfig() { - Resources resources = mCtx.getResources(); - PackageManager packageMgr = mCtx.getPackageManager(); - DisplayMetrics metrics = resources.getDisplayMetrics(); - Configuration config = resources.getConfiguration(); - - try { - Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - - Element devices = doc.createElement(PREFIX + NODE_DEVICES); - devices.setAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":xsi", - XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI); - devices.setAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":" + LOCAL_NS, NS_DEVICES_XSD); - doc.appendChild(devices); - - Element device = doc.createElement(PREFIX + NODE_DEVICE); - devices.appendChild(device); - - Element name = doc.createElement(PREFIX + NODE_NAME); - device.appendChild(name); - name.appendChild(doc.createTextNode(android.os.Build.MODEL)); - Element manufacturer = doc.createElement(PREFIX + NODE_MANUFACTURER); - device.appendChild(manufacturer); - manufacturer.appendChild(doc.createTextNode(android.os.Build.MANUFACTURER)); - - Element hardware = doc.createElement(PREFIX + NODE_HARDWARE); - device.appendChild(hardware); - - Element screen = doc.createElement(PREFIX + NODE_SCREEN); - hardware.appendChild(screen); - - Element screenSize = doc.createElement(PREFIX + NODE_SCREEN_SIZE); - screen.appendChild(screenSize); - Text screenSizeText; - switch (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) { - case Configuration.SCREENLAYOUT_SIZE_SMALL: - screenSizeText = doc.createTextNode("small"); - break; - case Configuration.SCREENLAYOUT_SIZE_NORMAL: - screenSizeText = doc.createTextNode("normal"); - break; - case Configuration.SCREENLAYOUT_SIZE_LARGE: - screenSizeText = doc.createTextNode("large"); - break; - case Configuration.SCREENLAYOUT_SIZE_XLARGE: - screenSizeText = doc.createTextNode("xlarge"); - break; - default: - screenSizeText = doc.createTextNode(" "); - break; - } - screenSize.appendChild(screenSizeText); - - Element diagonalLength = doc.createElement(PREFIX + NODE_DIAGONAL_LENGTH); - screen.appendChild(diagonalLength); - double xin = metrics.widthPixels / metrics.xdpi; - double yin = metrics.heightPixels / metrics.ydpi; - double diag = Math.sqrt(Math.pow(xin, 2) + Math.pow(yin, 2)); - diagonalLength.appendChild(doc.createTextNode( - String.format(Locale.US, "%1$.2f", diag))); - - Element pixelDensity = doc.createElement(PREFIX + NODE_PIXEL_DENSITY); - screen.appendChild(pixelDensity); - Text pixelDensityText; - switch (metrics.densityDpi) { - case DisplayMetrics.DENSITY_LOW: - pixelDensityText = doc.createTextNode("ldpi"); - break; - case DisplayMetrics.DENSITY_MEDIUM: - pixelDensityText = doc.createTextNode("mdpi"); - break; - case DisplayMetrics.DENSITY_TV: - pixelDensityText = doc.createTextNode("tvdpi"); - break; - case DisplayMetrics.DENSITY_HIGH: - pixelDensityText = doc.createTextNode("hdpi"); - break; - case DisplayMetrics.DENSITY_XHIGH: - pixelDensityText = doc.createTextNode("xhdpi"); - break; - default: - pixelDensityText = doc.createTextNode(" "); - } - pixelDensity.appendChild(pixelDensityText); - - Element screenRatio = doc.createElement(PREFIX + NODE_SCREEN_RATIO); - screen.appendChild(screenRatio); - Text screenRatioText; - switch (config.screenLayout & Configuration.SCREENLAYOUT_LONG_MASK) { - case Configuration.SCREENLAYOUT_LONG_YES: - screenRatioText = doc.createTextNode("long"); - break; - case Configuration.SCREENLAYOUT_LONG_NO: - screenRatioText = doc.createTextNode("notlong"); - break; - default: - screenRatioText = doc.createTextNode(" "); - break; - } - screenRatio.appendChild(screenRatioText); - - Element dimensions = doc.createElement(PREFIX + NODE_DIMENSIONS); - screen.appendChild(dimensions); - - Element xDimension = doc.createElement(PREFIX + NODE_X_DIMENSION); - dimensions.appendChild(xDimension); - xDimension.appendChild(doc.createTextNode(Integer.toString(metrics.widthPixels))); - - Element yDimension = doc.createElement(PREFIX + NODE_Y_DIMENSION); - dimensions.appendChild(yDimension); - yDimension.appendChild(doc.createTextNode(Integer.toString(metrics.heightPixels))); - - Element xdpi = doc.createElement(PREFIX + NODE_XDPI); - screen.appendChild(xdpi); - xdpi.appendChild(doc.createTextNode(Double.toString(metrics.xdpi))); - - Element ydpi = doc.createElement(PREFIX + NODE_YDPI); - screen.appendChild(ydpi); - ydpi.appendChild(doc.createTextNode(Double.toString(metrics.ydpi))); - - Element touch = doc.createElement(PREFIX + NODE_TOUCH); - screen.appendChild(touch); - - Element multitouch = doc.createElement(PREFIX + NODE_MULTITOUCH); - touch.appendChild(multitouch); - Text multitouchText; - if (packageMgr - .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND)) { - multitouchText = doc.createTextNode("jazz-hands"); - } else if (packageMgr - .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT)) { - multitouchText = doc.createTextNode("distinct"); - } else if (packageMgr.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)) { - multitouchText = doc.createTextNode("basic"); - } else { - multitouchText = doc.createTextNode("none"); - } - multitouch.appendChild(multitouchText); - - Element mechanism = doc.createElement(PREFIX + NODE_MECHANISM); - touch.appendChild(mechanism); - Text mechanismText; - switch (config.touchscreen) { - case Configuration.TOUCHSCREEN_STYLUS: - mechanismText = doc.createTextNode("stylus"); - case Configuration.TOUCHSCREEN_FINGER: - mechanismText = doc.createTextNode("finger"); - case Configuration.TOUCHSCREEN_NOTOUCH: - mechanismText = doc.createTextNode("notouch"); - default: - mechanismText = doc.createTextNode(" "); - } - mechanism.appendChild(mechanismText); - - // Create an empty place holder node for screen-type since we can't - // actually determine it - - Element screenType = doc.createElement(PREFIX + NODE_SCREEN_TYPE); - touch.appendChild(screenType); - screenType.appendChild(doc.createTextNode(" ")); - - Element networking = doc.createElement(PREFIX + NODE_NETWORKING); - hardware.appendChild(networking); - Text networkingText = doc.createTextNode(""); - networking.appendChild(networkingText); - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_WIFI)) { - networkingText.appendData("\nWifi"); - } - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) { - networkingText.appendData("\nBluetooth"); - } - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_NFC)) { - networkingText.appendData("\nNFC"); - } - - Element sensors = doc.createElement(PREFIX + NODE_SENSORS); - hardware.appendChild(sensors); - Text sensorsText = doc.createTextNode(""); - sensors.appendChild(sensorsText); - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER)) { - sensorsText.appendData("\nAccelerometer"); - } - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_SENSOR_BAROMETER)) { - sensorsText.appendData("\nBarometer"); - } - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS)) { - sensorsText.appendData("\nCompass"); - } - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)) { - sensorsText.appendData("\nGPS"); - } - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_SENSOR_GYROSCOPE)) { - sensorsText.appendData("\nGyroscope"); - } - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_SENSOR_LIGHT)) { - sensorsText.appendData("\nLightSensor"); - } - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_SENSOR_PROXIMITY)) { - sensorsText.appendData("\nProximitySensor"); - } - - Element mic = doc.createElement(PREFIX + NODE_MIC); - hardware.appendChild(mic); - Text micText; - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_MICROPHONE)) { - micText = doc.createTextNode("true"); - } else { - micText = doc.createTextNode("false"); - } - mic.appendChild(micText); - - if (android.os.Build.VERSION.SDK_INT >= 9){ - List<Element> cameras = getCameraElements(doc); - for (Element cam : cameras){ - hardware.appendChild(cam); - } - } else { - Camera c = Camera.open(); - Element camera = doc.createElement(PREFIX + NODE_CAMERA); - hardware.appendChild(camera); - Element location = doc.createElement(PREFIX + NODE_LOCATION); - camera.appendChild(location); - // All camera's before API 9 were on the back - location.appendChild(doc.createTextNode("back")); - Camera.Parameters cParams = c.getParameters(); - Element autofocus = doc.createElement(PREFIX + NODE_AUTOFOCUS); - camera.appendChild(autofocus); - List<String> foci = cParams.getSupportedFocusModes(); - if (foci == null) { - autofocus.appendChild(doc.createTextNode(" ")); - } else if (foci.contains(Camera.Parameters.FOCUS_MODE_AUTO)) { - autofocus.appendChild(doc.createTextNode("true")); - } else { - autofocus.appendChild(doc.createTextNode("false")); - } - - Element flash = doc.createElement(PREFIX + NODE_FLASH); - camera.appendChild(flash); - List<String> flashes = cParams.getSupportedFlashModes(); - if (flashes == null || !flashes.contains(Camera.Parameters.FLASH_MODE_ON)) { - flash.appendChild(doc.createTextNode("false")); - } else { - flash.appendChild(doc.createTextNode("true")); - } - c.release(); - } - - - Element keyboard = doc.createElement(PREFIX + NODE_KEYBOARD); - hardware.appendChild(keyboard); - Text keyboardText; - switch (config.keyboard) { - case Configuration.KEYBOARD_NOKEYS: - keyboardText = doc.createTextNode("nokeys"); - break; - case Configuration.KEYBOARD_12KEY: - keyboardText = doc.createTextNode("12key"); - break; - case Configuration.KEYBOARD_QWERTY: - keyboardText = doc.createTextNode("qwerty"); - break; - default: - keyboardText = doc.createTextNode(" "); - } - keyboard.appendChild(keyboardText); - - Element nav = doc.createElement(PREFIX + NODE_NAV); - hardware.appendChild(nav); - Text navText; - switch (config.navigation) { - case Configuration.NAVIGATION_DPAD: - navText = doc.createTextNode("dpad"); - case Configuration.NAVIGATION_TRACKBALL: - navText = doc.createTextNode("trackball"); - case Configuration.NAVIGATION_WHEEL: - navText = doc.createTextNode("wheel"); - case Configuration.NAVIGATION_NONAV: - navText = doc.createTextNode("nonav"); - default: - navText = doc.createTextNode(" "); - } - nav.appendChild(navText); - - Element ram = doc.createElement(PREFIX + NODE_RAM); - hardware.appendChild(ram); - // totalMemory given in bytes, divide by 1048576 to get RAM in MiB - String line; - long ramAmount = 0; - String unit = UNIT_BYTES; - try { - BufferedReader meminfo = new BufferedReader(new FileReader("/proc/meminfo")); - while ((line = meminfo.readLine()) != null) { - String[] vals = line.split("[\\s]+"); - if (vals[0].equals("MemTotal:")) { - try { - /* - * We're going to want it as a string eventually, - * but parsing it lets us validate it's actually a - * number and something strange isn't going on - */ - ramAmount = Long.parseLong(vals[1]); - unit = vals[2]; - break; - } catch (NumberFormatException e) { - // Ignore - } - } - } - meminfo.close(); - } catch (FileNotFoundException e) { - // Ignore - } - if (ramAmount > 0) { - if (unit.equals("B")) { - unit = UNIT_BYTES; - } else if (unit.equals("kB")) { - unit = UNIT_KIBIBYTES; - } else if (unit.equals("MB")) { - unit = UNIT_MEBIBYTES; - } else if (unit.equals("GB")) { - unit = UNIT_GIBIBYTES; - } else { - unit = " "; - } - } - ram.setAttribute(ATTR_UNIT, unit); - ram.appendChild(doc.createTextNode(Long.toString(ramAmount))); - - Element buttons = doc.createElement(PREFIX + NODE_BUTTONS); - hardware.appendChild(buttons); - Text buttonsText; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - buttonsText = doc.createTextNode(getButtonsType()); - } else { - buttonsText = doc.createTextNode("hard"); - } - buttons.appendChild(buttonsText); - - Element internalStorage = doc.createElement(PREFIX + NODE_INTERNAL_STORAGE); - hardware.appendChild(internalStorage); - StatFs rootStat = new StatFs(Environment.getRootDirectory().getAbsolutePath()); - long bytesAvailable = rootStat.getBlockSize() * rootStat.getBlockCount(); - long internalStorageSize = bytesAvailable / (1024 * 1024); - internalStorage.appendChild(doc.createTextNode(Long.toString(internalStorageSize))); - internalStorage.setAttribute(ATTR_UNIT, UNIT_MEBIBYTES); - - Element externalStorage = doc.createElement(PREFIX + NODE_REMOVABLE_STORAGE); - hardware.appendChild(externalStorage); - externalStorage.appendChild(doc.createTextNode(" ")); - - - // Don't know CPU, GPU types - Element cpu = doc.createElement(PREFIX + NODE_CPU); - hardware.appendChild(cpu); - cpu.appendChild(doc.createTextNode(" ")); - Element gpu = doc.createElement(PREFIX + NODE_GPU); - hardware.appendChild(gpu); - gpu.appendChild(doc.createTextNode(" ")); - - Element abi = doc.createElement(PREFIX + NODE_ABI); - hardware.appendChild(abi); - Text abiText = doc.createTextNode(""); - abi.appendChild(abiText); - abiText.appendData("\n" + android.os.Build.CPU_ABI); - abiText.appendData("\n" + android.os.Build.CPU_ABI2); - - // Don't know about either the dock or plugged-in element - Element dock = doc.createElement(PREFIX + NODE_DOCK); - hardware.appendChild(dock); - dock.appendChild(doc.createTextNode(" ")); - - Element pluggedIn = doc.createElement(PREFIX + NODE_POWER_TYPE); - hardware.appendChild(pluggedIn); - pluggedIn.appendChild(doc.createTextNode(" ")); - - Element software = doc.createElement(PREFIX + NODE_SOFTWARE); - device.appendChild(software); - - Element apiLevel = doc.createElement(PREFIX + NODE_API_LEVEL); - software.appendChild(apiLevel); - apiLevel.appendChild(doc.createTextNode(Integer - .toString(android.os.Build.VERSION.SDK_INT))); - - Element liveWallpaperSupport = doc.createElement(PREFIX + NODE_LIVE_WALLPAPER_SUPPORT); - software.appendChild(liveWallpaperSupport); - if (packageMgr.hasSystemFeature(PackageManager.FEATURE_LIVE_WALLPAPER)) { - liveWallpaperSupport.appendChild(doc.createTextNode("true")); - } else { - liveWallpaperSupport.appendChild(doc.createTextNode("flase")); - } - - Element bluetoothProfiles = doc.createElement(PREFIX + NODE_BLUETOOTH_PROFILES); - software.appendChild(bluetoothProfiles); - bluetoothProfiles.appendChild(doc.createTextNode(" ")); - - Element glVersion = doc.createElement(PREFIX + NODE_GL_VERSION); - software.appendChild(glVersion); - String glVersionString = " "; - - FeatureInfo[] features = packageMgr.getSystemAvailableFeatures(); - for (FeatureInfo feature : features) { - if (feature.reqGlEsVersion > 0) { - glVersionString = feature.getGlEsVersion(); - break; - } - } - - glVersion.appendChild(doc.createTextNode(glVersionString)); - - Element glExtensions = doc.createElement(PREFIX + NODE_GL_EXTENSIONS); - software.appendChild(glExtensions); - if (mExtensions != null && !mExtensions.trim().equals("")) { - glExtensions.appendChild(doc.createTextNode(mExtensions)); - } else { - glExtensions.appendChild(doc.createTextNode(" ")); - } - - Transformer tf = TransformerFactory.newInstance().newTransformer(); - tf.setOutputProperty(OutputKeys.INDENT, "yes"); - tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); - DOMSource source = new DOMSource(doc); - String filename = String.format("devices_%1$tm_%1$td_%1$ty.xml", Calendar.getInstance() - .getTime()); - File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); - File outFile = new File(dir, filename); - FileOutputStream out = new FileOutputStream(new File(dir, filename)); - StreamResult result = new StreamResult(out); - tf.transform(source, result); - out.flush(); - out.close(); - return outFile.getAbsolutePath(); - } catch (ParserConfigurationException e) { - error("Parser config exception", e); - } catch (TransformerConfigurationException e) { - error("Transformer config exception", e); - } catch (TransformerFactoryConfigurationError e) { - error("TransformerFactory config exception", e); - } catch (TransformerException e) { - error("Error transforming", e); - } catch (IOException e) { - error("I/O Error", e); - } - return null; - } - - @TargetApi(9) - private List<Element> getCameraElements(Document doc) { - List<Element> cList = new ArrayList<Element>(); - for (int i = 0; i < Camera.getNumberOfCameras(); i++) { - Element camera = doc.createElement(PREFIX + NODE_CAMERA); - cList.add(camera); - Element location = doc.createElement(PREFIX + NODE_LOCATION); - camera.appendChild(location); - Text locationText; - Camera.CameraInfo cInfo = new Camera.CameraInfo(); - Camera.getCameraInfo(i, cInfo); - if (cInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { - locationText = doc.createTextNode("front"); - } else if (cInfo.facing == CameraInfo.CAMERA_FACING_BACK) { - locationText = doc.createTextNode("back"); - } else { - locationText = doc.createTextNode(" "); - } - location.appendChild(locationText); - - Camera c = Camera.open(i); - Camera.Parameters cParams = c.getParameters(); - - Element autofocus = doc.createElement(PREFIX + NODE_AUTOFOCUS); - camera.appendChild(autofocus); - List<String> foci = cParams.getSupportedFocusModes(); - if (foci == null) { - autofocus.appendChild(doc.createTextNode(" ")); - } else if (foci.contains(Camera.Parameters.FOCUS_MODE_AUTO)) { - autofocus.appendChild(doc.createTextNode("true")); - } else { - autofocus.appendChild(doc.createTextNode("false")); - } - - Element flash = doc.createElement(PREFIX + NODE_FLASH); - camera.appendChild(flash); - List<String> flashes = cParams.getSupportedFlashModes(); - if (flashes == null || !flashes.contains(Camera.Parameters.FLASH_MODE_ON)) { - flash.appendChild(doc.createTextNode("false")); - } else { - flash.appendChild(doc.createTextNode("true")); - } - c.release(); - } - return cList; - } - - @TargetApi(14) - private String getButtonsType() { - ViewConfiguration vConfig = ViewConfiguration.get(mCtx); - - if (vConfig.hasPermanentMenuKey()) { - return "hard"; - } else { - return "soft"; - } - } - - private void error(String err, Throwable e) { - Toast.makeText(mCtx, "Error Generating Configuration", Toast.LENGTH_SHORT).show(); - Log.e(TAG, err); - Log.e(TAG, e.getLocalizedMessage()); - } -} diff --git a/apps/DeviceConfig/src/com/example/android/deviceconfig/MyActivity.java b/apps/DeviceConfig/src/com/example/android/deviceconfig/MyActivity.java deleted file mode 100644 index 38a78cd1e..000000000 --- a/apps/DeviceConfig/src/com/example/android/deviceconfig/MyActivity.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.android.deviceconfig; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.content.res.Configuration; -import android.net.Uri; -import android.opengl.GLSurfaceView; -import android.os.Bundle; -import android.util.DisplayMetrics; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.LinearLayout; -import android.widget.TextView; - -import java.io.File; - -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; - -public class MyActivity extends Activity implements OnClickListener { - - public static final String TAG = "DeviceConfig"; - private static GLView mGl; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main); - // Instantiate a GL surface view so we can get extensions information - mGl = new GLView(this); - LinearLayout vg = (LinearLayout) findViewById(R.id.buttonHolder); - // If we set the layout to be 0, it just won't render - ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(1, 1); - mGl.setLayoutParams(params); - vg.addView(mGl); - - Button btn = (Button) findViewById(R.id.generateConfigButton); - btn.setOnClickListener(this); - Configuration config = getResources().getConfiguration(); - - TextView tv = (TextView) findViewById(R.id.keyboard_state_api); - if (tv != null) { - String separator = config.orientation == Configuration.ORIENTATION_PORTRAIT ? "\n" : ""; - String foo = "keyboardHidden=" + separator; - if (config.keyboardHidden == Configuration.KEYBOARDHIDDEN_NO) { - foo += "EXPOSED"; - } else if (config.keyboardHidden == Configuration.KEYBOARDHIDDEN_YES) { - foo += "HIDDEN"; - } else if (config.keyboardHidden == Configuration.KEYBOARDHIDDEN_UNDEFINED) { - foo += "UNDEFINED"; - } else { - foo += "?"; - } - foo += "\nhardKeyboardHidden=" + separator; - if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) { - foo = foo + "EXPOSED"; - } else if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) { - foo = foo + "HIDDEN"; - } else if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED) { - foo = foo + "UNDEFINED"; - } else { - foo = "?"; - } - - tv.setText(foo); - } - - tv = (TextView) findViewById(R.id.nav_state_api); - if (tv != null) { - if (config.navigationHidden == Configuration.NAVIGATIONHIDDEN_NO) { - tv.setText("EXPOSED"); - } else if (config.navigationHidden == Configuration.NAVIGATIONHIDDEN_YES) { - tv.setText("HIDDEN"); - } else if (config.navigationHidden == Configuration.NAVIGATIONHIDDEN_UNDEFINED) { - tv.setText("UNDEFINED"); - } else { - tv.setText("??"); - } - } - - DisplayMetrics metrics = getResources().getDisplayMetrics(); - - - tv = (TextView) findViewById(R.id.size_api); - if (tv != null) { - int a = metrics.heightPixels; - int b = metrics.widthPixels; - tv.setText(b + "x" + a); - } - - tv = (TextView) findViewById(R.id.xdpi); - if (tv != null) { - tv.setText(String.format("%f", metrics.xdpi)); - } - tv = (TextView) findViewById(R.id.ydpi); - if (tv != null) { - tv.setText(String.format("%f", metrics.ydpi)); - } - - tv = (TextView) findViewById(R.id.scaled_density); - if (tv != null) { - tv.setText(String.format("%f", metrics.scaledDensity)); - } - - tv = (TextView) findViewById(R.id.font_scale); - if (tv != null) { - tv.setText(String.format("%f", config.fontScale)); - } - - } - - public void onClick(View v) { - ConfigGenerator configGen = new ConfigGenerator(this, mGl.getExtensions()); - final String filename = configGen.generateConfig(); - if (filename != null) { - Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); - emailIntent.setType("text/xml"); - File devicesXml = new File(filename); - emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Device XML: " + devicesXml.getName()); - emailIntent.putExtra(Intent.EXTRA_TEXT, "Note: This is intended to generate a base " - + "XML description. After running this, you should double check the generated " - + "information and add all of the missing fields."); - emailIntent.putExtra(Intent.EXTRA_STREAM, - Uri.parse("file://" + devicesXml.getAbsolutePath())); - startActivity(emailIntent); - } - } - - private static class GLView extends GLSurfaceView { - private GlRenderer mRenderer; - - public GLView(Context context) { - super(context); - setEGLContextClientVersion(2); - mRenderer = new GlRenderer(); - setRenderer(mRenderer); - requestRender(); - } - - public String getExtensions() { - return mRenderer.extensions; - } - - } - - private static class GlRenderer implements GLSurfaceView.Renderer { - public String extensions = ""; - - public void onDrawFrame(GL10 gl) { - } - - public void onSurfaceChanged(GL10 gl, int width, int height) { - gl.glViewport(0, 0, 0, 0); - } - - public void onSurfaceCreated(GL10 gl, EGLConfig config) { - if (extensions.equals("")) { - String extensions10 = gl.glGetString(GL10.GL_EXTENSIONS); - if(extensions10 != null) { - extensions += extensions10; - } - } - } - } -} diff --git a/emulator/mksdcard/.gitignore b/emulator/mksdcard/.gitignore deleted file mode 100644 index 4a78fc83a..000000000 --- a/emulator/mksdcard/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -build -.gradle - diff --git a/emulator/mksdcard/Android.mk b/emulator/mksdcard/Android.mk deleted file mode 100644 index 0547f0073..000000000 --- a/emulator/mksdcard/Android.mk +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2006 The Android Open Source Project - -LOCAL_PATH:= $(call my-dir) - -# host executable -# -include $(CLEAR_VARS) -LOCAL_SRC_FILES:= src/source/mksdcard.c -LOCAL_MODULE = mksdcard -include $(BUILD_HOST_EXECUTABLE) - diff --git a/emulator/mksdcard/MODULE_LICENSE_BSD b/emulator/mksdcard/MODULE_LICENSE_BSD deleted file mode 100644 index e69de29bb..000000000 --- a/emulator/mksdcard/MODULE_LICENSE_BSD +++ /dev/null diff --git a/emulator/mksdcard/NOTICE b/emulator/mksdcard/NOTICE deleted file mode 100644 index 06a9081ca..000000000 --- a/emulator/mksdcard/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2005-2014, The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/emulator/mksdcard/build.gradle b/emulator/mksdcard/build.gradle deleted file mode 100644 index f2bbe733c..000000000 --- a/emulator/mksdcard/build.gradle +++ /dev/null @@ -1,54 +0,0 @@ -apply plugin: 'c' -apply plugin: 'sdk-files' -apply plugin: 'native-setup' - -executables { - mksdcard {} -} - -sources { - mksdcard { - c { - source { - srcDir "src/source" - include "**/*.c" - } - } - } -} - -binaries.all { - cCompiler.args "-D_FILE_OFFSET_BITS=64" - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - linker.args "-static-libgcc" - } -} - -sdk { - mac { - item( { getExeName("darwin") } ) { - executable true - builtBy 'darwinMksdcardExecutable' - } - } - linux { - item( { getExeName("linux") } ) { - executable true - builtBy 'linuxMksdcardExecutable' - } - } - windows { - item( { getExeName("windows32") } ) { - name 'mksdcard.exe' - builtBy 'windows32MksdcardExecutable' - } - } -} - -def getExeName(String platform) { - // binaries will return a set of binaries - def binaries = executables.mksdcard.binaries.matching { it.name == "${platform}MksdcardExecutable" } - // calling .exeFile on the set returns an array with the result from each item in the set... - return binaries.executableFile.get(0) -} - diff --git a/emulator/mksdcard/src/source/mksdcard.c b/emulator/mksdcard/src/source/mksdcard.c deleted file mode 100644 index ca23e6375..000000000 --- a/emulator/mksdcard/src/source/mksdcard.c +++ /dev/null @@ -1,364 +0,0 @@ -/* mksdcard.c -** -** Copyright 2007, The Android Open Source Project -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** * Neither the name of Google Inc. nor the names of its contributors may -** be used to endorse or promote products derived from this software -** without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -** EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* a simple and portable program used to generate a blank FAT32 image file - * - * usage: mksdcard [-l label] <size> <filename> - */ - -#include <time.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <unistd.h> - -/* believe me, you *don't* want to change these constants !! */ -#define BYTES_PER_SECTOR 512 -#define RESERVED_SECTORS 32 -#define BACKUP_BOOT_SECTOR 6 -#define NUM_FATS 2 - -/* sectors_per_disk is encoded as a signed int */ -#define MAX_SECTORS_PER_DISK 0x7FFFFFFF -#define MAX_DISK_SIZE ((Wide)MAX_SECTORS_PER_DISK * BYTES_PER_SECTOR) - -typedef long long Wide; /* might be something else if you don't use GCC */ -typedef unsigned char Byte; -typedef Byte* Bytes; - -#define BYTE_(p,i) (((Bytes)(p))[(i)]) - -#define POKEB(p,v) BYTE_(p,0) = (Byte)(v) -#define POKES(p,v) ( BYTE_(p,0) = (Byte)(v), BYTE_(p,1) = (Byte)((v) >> 8) ) -#define POKEW(p,v) ( BYTE_(p,0) = (Byte)(v), BYTE_(p,1) = (Byte)((v) >> 8), BYTE_(p,2) = (Byte)((v) >> 16), BYTE_(p,3) = (Byte)((v) >> 24) ) - -static Byte s_boot_sector [ BYTES_PER_SECTOR ]; /* boot sector */ -static Byte s_fsinfo_sector [ BYTES_PER_SECTOR ]; /* FS Info sector */ -static Byte s_fat_head [ BYTES_PER_SECTOR ]; /* first FAT sector */ -// static Byte s_zero_sector [ BYTES_PER_SECTOR ]; /* empty sector */ - -// For handling Unicode paths -#ifdef _WIN32 - #define WIDE_CHAR wchar_t - #define ARGC wargc - #define ARGV wargv - #define STRINGPRINT "%S" -#else - #define WIDE_CHAR char - #define ARGC argc - #define ARGV argv - #define STRINGPRINT "%s" -#endif - -/* this is the date and time when creating the disk */ -static int -get_serial_id( void ) -{ - unsigned short lo, hi; - time_t now = time(NULL); - struct tm tm = gmtime( &now )[0]; - - lo = (unsigned short)(tm.tm_mday + ((tm.tm_mon+1) << 8) + (tm.tm_sec << 8)); - hi = (unsigned short)(tm.tm_min + (tm.tm_hour << 8) + (tm.tm_year + 1900)); - - return lo + (hi << 16); -} - -static int -get_sectors_per_cluster( Wide disk_size ) -{ - Wide disk_MB = disk_size/(1024*1024); - - if (disk_MB < 260) - return 1; - - if (disk_MB < 8192) - return 4; - - if (disk_MB < 16384) - return 8; - - if (disk_MB < 32768) - return 16; - - return 32; -} - -static int -get_sectors_per_fat( Wide disk_size, int sectors_per_cluster ) -{ - Wide divider; - - /* weird computation from MS - see fatgen103.doc for details */ - disk_size -= RESERVED_SECTORS * BYTES_PER_SECTOR; /* don't count 32 reserved sectors */ - disk_size /= BYTES_PER_SECTOR; /* disk size in sectors */ - divider = ((256 * sectors_per_cluster) + NUM_FATS) / 2; - - return (int)( (disk_size + (divider-1)) / divider ); -} - -static void -boot_sector_init( Bytes boot, Bytes info, Wide disk_size, const char* label ) -{ - int sectors_per_cluster = get_sectors_per_cluster(disk_size); - int sectors_per_fat = get_sectors_per_fat(disk_size, sectors_per_cluster); - int sectors_per_disk = (int)(disk_size / BYTES_PER_SECTOR); - int serial_id = get_serial_id(); - int free_count; - - if (label == NULL) - label = "SDCARD"; - - POKEB(boot, 0xeb); - POKEB(boot+1, 0x5a); - POKEB(boot+2, 0x90); - strcpy( (char*)boot + 3, "MSWIN4.1" ); - POKES( boot + 0x0b, BYTES_PER_SECTOR ); /* sector size */ - POKEB( boot + 0xd, sectors_per_cluster ); /* sectors per cluster */ - POKES( boot + 0xe, RESERVED_SECTORS ); /* reserved sectors before first FAT */ - POKEB( boot + 0x10, NUM_FATS ); /* number of FATs */ - POKES( boot + 0x11, 0 ); /* max root directory entries for FAT12/FAT16, 0 for FAT32 */ - POKES( boot + 0x13, 0 ); /* total sectors, 0 to use 32-bit value at offset 0x20 */ - POKEB( boot + 0x15, 0xF8 ); /* media descriptor, 0xF8 == hard disk */ - POKES( boot + 0x16, 0 ); /* Sectors per FAT for FAT12/16, 0 for FAT32 */ - POKES( boot + 0x18, 9 ); /* Sectors per track (whatever) */ - POKES( boot + 0x1a, 2 ); /* Number of heads (whatever) */ - POKEW( boot + 0x1c, 0 ); /* Hidden sectors */ - POKEW( boot + 0x20, sectors_per_disk ); /* Total sectors */ - - /* extension */ - POKEW( boot + 0x24, sectors_per_fat ); /* Sectors per FAT */ - POKES( boot + 0x28, 0 ); /* FAT flags */ - POKES( boot + 0x2a, 0 ); /* version */ - POKEW( boot + 0x2c, 2 ); /* cluster number of root directory start */ - POKES( boot + 0x30, 1 ); /* sector number of FS information sector */ - POKES( boot + 0x32, BACKUP_BOOT_SECTOR ); /* sector number of a copy of this boot sector */ - POKEB( boot + 0x40, 0x80 ); /* physical drive number */ - POKEB( boot + 0x42, 0x29 ); /* extended boot signature ?? */ - POKEW( boot + 0x43, serial_id ); /* serial ID */ - strncpy( (char*)boot + 0x47, label, 11 ); /* Volume Label */ - memcpy( boot + 0x52, "FAT32 ", 8 ); /* FAT system type, padded with 0x20 */ - - POKEB( boot + BYTES_PER_SECTOR-2, 0x55 ); /* boot sector signature */ - POKEB( boot + BYTES_PER_SECTOR-1, 0xAA ); - - /* FSInfo sector */ - free_count = sectors_per_disk - 32 - 2*sectors_per_fat; - - POKEW( info + 0, 0x41615252 ); - POKEW( info + 484, 0x61417272 ); - POKEW( info + 488, free_count ); /* number of free clusters */ - POKEW( info + 492, 3 ); /* next free clusters, 0-1 reserved, 2 is used for the root dir */ - POKEW( info + 508, 0xAA550000 ); -} - -static void -fat_init( Bytes fat ) -{ - POKEW( fat, 0x0ffffff8 ); /* reserve cluster 1, media id in low byte */ - POKEW( fat + 4, 0x0fffffff ); /* reserve cluster 2 */ - POKEW( fat + 8, 0x0fffffff ); /* end of clust chain for root dir */ -} - - -static int -write_sector( FILE* file, Bytes sector ) -{ - int result = fwrite( sector, 1, BYTES_PER_SECTOR, file ) != BYTES_PER_SECTOR; - if (result) { - fprintf(stderr, "Failed to write sector of %d bytes: %s\n", BYTES_PER_SECTOR, strerror(errno)); - } - return result; -} - -static int -write_empty( FILE* file, Wide count ) -{ - static Byte empty[256*1024]; - memset(empty, 0, sizeof(empty)); - - count *= BYTES_PER_SECTOR; - while (count > 0) { - int len = sizeof(empty); - if (len > count) - len = count; - if ( fwrite( empty, 1, len, file ) != (size_t)len ) { - fprintf(stderr, "Failed to write %d bytes: %s\n", len, strerror(errno)); - return 1; - } - - count -= len; - } - return 0; -} - -static void usage (void) -{ - fprintf(stderr, "mksdcard: create a blank FAT32 image to be used with the Android emulator\n" ); - fprintf(stderr, "usage: mksdcard [-l label] <size> <file>\n\n"); - fprintf(stderr, " if <size> is a simple integer, it specifies a size in bytes\n" ); - fprintf(stderr, " if <size> is an integer followed by 'K', it specifies a size in KiB\n" ); - fprintf(stderr, " if <size> is an integer followed by 'M', it specifies a size in MiB\n" ); - fprintf(stderr, " if <size> is an integer followed by 'G', it specifies a size in GiB\n" ); - fprintf(stderr, "\nMinimum size is 9M. The Android emulator cannot use smaller images.\n" ); - fprintf(stderr, "Maximum size is %lld bytes, %lldK, %lldM or %lldG\n", - MAX_DISK_SIZE, MAX_DISK_SIZE >> 10, MAX_DISK_SIZE >> 20, MAX_DISK_SIZE >> 30); - exit(1); -} - -int main( int argc, char** argv ) -{ - Wide disk_size; - int sectors_per_fat; - int sectors_per_disk; - WIDE_CHAR* end; - const WIDE_CHAR* label = NULL; - FILE* f = NULL; - -#ifdef _WIN32 - int wargc; - WIDE_CHAR** wargv; - WIDE_CHAR** unused_environment; - WIDE_CHAR** unused_startupinfo; - - __wgetmainargs(&wargc, &wargv, &unused_environment, 0, &unused_startupinfo); -#endif - - for ( ; ARGC > 1 && ARGV[1][0] == '-'; ARGC--, ARGV++ ) - { - WIDE_CHAR* arg = ARGV[1] + 1; - switch (arg[0]) { - case 'l': - if (arg[1] != 0) - arg += 2; - else { - ARGC--; - ARGV++; - if (ARGC <= 1) - usage(); - arg = ARGV[1]; - } - label = arg; - break; - - default: - usage(); - } - } - - if (ARGC != 3) - usage(); - -#ifdef _WIN32 - disk_size = wcstoll( ARGV[1], &end, 10 ); -#else - disk_size = strtoll( ARGV[1], &end, 10 ); -#endif - - if (disk_size <= 0 || errno == EINVAL || errno == ERANGE) { - fprintf(stderr, "Invalid argument size '" STRINGPRINT "'\n\n", ARGV[1]); - usage(); - } - - if (*end == 'K') - disk_size *= 1024; - else if (*end == 'M') - disk_size *= 1024*1024; - else if (*end == 'G') - disk_size *= 1024*1024*1024; - - if (disk_size < 9*1024*1024) { - fprintf(stderr, "Invalid argument: size '" STRINGPRINT "' is too small.\n\n", ARGV[1]); - usage(); - } else if (disk_size > MAX_DISK_SIZE) { - fprintf(stderr, "Invalid argument: size '" STRINGPRINT "' is too large.\n\n", ARGV[1]); - usage(); - } - - sectors_per_disk = disk_size / BYTES_PER_SECTOR; - sectors_per_fat = get_sectors_per_fat( disk_size, get_sectors_per_cluster( disk_size ) ); - - boot_sector_init( s_boot_sector, s_fsinfo_sector, disk_size, NULL ); - fat_init( s_fat_head ); - -#ifdef _WIN32 - f = _wfopen( ARGV[2], L"wb" ); -#else - f = fopen( ARGV[2], "wb" ); -#endif - if ( !f ) { - fprintf(stderr, "Could not create file '" STRINGPRINT "': %s\n", ARGV[2], strerror(errno)); - goto FailWrite; - } - - /* here's the layout: - * - * boot_sector - * fsinfo_sector - * empty - * backup boot sector - * backup fsinfo sector - * RESERVED_SECTORS - 4 empty sectors (if backup sectors), or RESERVED_SECTORS - 2 (if no backup) - * first fat - * second fat - * zero sectors - */ - - if ( write_sector( f, s_boot_sector ) ) goto FailWrite; - if ( write_sector( f, s_fsinfo_sector ) ) goto FailWrite; - if ( BACKUP_BOOT_SECTOR > 0 ) { - if ( write_empty( f, BACKUP_BOOT_SECTOR - 2 ) ) goto FailWrite; - if ( write_sector( f, s_boot_sector ) ) goto FailWrite; - if ( write_sector( f, s_fsinfo_sector ) ) goto FailWrite; - if ( write_empty( f, RESERVED_SECTORS - 2 - BACKUP_BOOT_SECTOR ) ) goto FailWrite; - } - else if ( write_empty( f, RESERVED_SECTORS - 2 ) ) goto FailWrite; - - if ( write_sector( f, s_fat_head ) ) goto FailWrite; - if ( write_empty( f, sectors_per_fat-1 ) ) goto FailWrite; - - if ( write_sector( f, s_fat_head ) ) goto FailWrite; - if ( write_empty( f, sectors_per_fat-1 ) ) goto FailWrite; - - if ( write_empty( f, sectors_per_disk - RESERVED_SECTORS - 2*sectors_per_fat ) ) goto FailWrite; - - fclose(f); - return 0; - -FailWrite: - if (f != NULL) { - fclose(f); -#ifdef _WIN32 - _wunlink( ARGV[2] ); -#else - unlink( ARGV[2] ); -#endif - fprintf(stderr, "File '" STRINGPRINT "' was not created.\n", ARGV[2]); - } - return 1; -} diff --git a/emulator/mksdcard/vfat-empty-32MB.img.gz b/emulator/mksdcard/vfat-empty-32MB.img.gz Binary files differdeleted file mode 100644 index b205da34d..000000000 --- a/emulator/mksdcard/vfat-empty-32MB.img.gz +++ /dev/null |