upload android base code part9

This commit is contained in:
August 2018-08-08 20:16:11 +08:00
parent 5425409085
commit 071cdf34cd
2679 changed files with 329442 additions and 0 deletions

49
android/sdk/CleanSpec.mk Normal file
View file

@ -0,0 +1,49 @@
# 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.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************

4
android/sdk/OWNERS Normal file
View file

@ -0,0 +1,4 @@
bohu@google.com
tnorbye@google.com
vsiva@google.com
xav@google.com

112
android/sdk/README.txt Normal file
View file

@ -0,0 +1,112 @@
Some of the SDK tools sources have moved out of the sdk.git project.
They are no longer found here.
Instead they can be found in the tools/base.git and the tools/swt.git projects.
If you need to view/change the source and lack these folders, you can bring
them by using a repo init command such as:
$ repo init -u https://android.googlesource.com/platform/manifest -g all,-notdefault,tools
$ repo sync [-j N]
The libraries that are sourced in tools/base and tools/swt are converted to
prebuilts which are located in prebuilts/devtools. These prebuilts are the
ones being used when doing a "make sdk".
----------
1- I don't build full SDKs but I want to change tool X:
----------
Let's say as an example you want to change lint.
It's now located in tools/base/lint.
To build it from the command-line, you'd use "gradle" as such:
$ cd tools/base
$ ./gradlew lint:build
Output is located in $TOP/out/host/gradle/tools/base/lint/libs/
Some comments/tips:
- Gradle is a build system, a bit like make or ant.
If you want to know more, visit http://www.gradle.org/
- On Windows with the CMD shell, use ./gradlew.bat.
For Cygwin, Linux or Mac, use ./gradlew.
- Gradle targets are in the form "project-name:task-name".
To get a list of possible tasks, try this: $ ./gradlew lint:tasks
- Generally there are only 2 task names to remember:
$ ./gradlew lint:assemble ==> builds but do not run tests.
$ ./gradlew lint:check ==> runs tests and checks such as findbugs.
- To find the list of project-names you can use with gradle:
$ ./gradlew projects
The new moved projects are unsurprisingly named like their former "make"
counterparts. They are split between 2 repos:
- tools/swt contains all SWT-dependent projects.
- tools/base contains all other non-SWT projects.
However that means that when you want to modify a project using both repos,
you need an extra step.
For example, the SDK Manager UI is located in /tools/swt/sdkmanager.
However it does depend on /tools/base/sdklib. Let's say you want to
make a change in both sdklib and sdkuilib. Here are the steps:
$ # Edit tools/base/sdklib files.
$ cd tools/base ; ./gradlew sdklib:publishLocal
=> this builds sdklib and "publishes" an sdklib.JAR into a local maven
repo located in the out/gradle folder. Note that this is just a
temporary build artifact and is NOT used by "make sdk".
$ # Edit tools/swt/sdkmanager/sdkuilib files to use the changes from sdklib.
$ cd ../../tools/swt ; ./gradlew sdkuilib:assemble
=> this builds sdkuilib by using the local JAR of sdklib that is
located in the out/gradlew folder.
----------
2- How do I change some tools sources and build a new SDK using these?
----------
Let's say you changed something in tools/base/lint and run "make sdk" from
the top dir. Your changes will NOT be included in the resulting SDK.
That's because the SDK has been changed to only rely on the prebuilts located
in /prebuilts/devtools. There are pros and cons with this approach and we're
not going to discuss them here. Instead we'll focus on what you need to do.
It's fairly simple. Go back to the top dir on your Android tree and run:
$ prebuilts/devtools/update_jars.sh -f
$ make sdk
Now your changes are included in the generated SDK.
What you should know about the update_jars.sh script:
- Without argument, it prints what it would do but does nothing.
Use the "-f" argument to make it build/copy stuff.
- It builds indiscriminiately. It just builds ALL the libs from
tools/base and tools/swt and updates all the JARs under prebuilts/devtools.
That should only take 20-30 seconds though. Eventually we'll work on
making it smarter because obviously we don't want anyone to just try
to submit 30 JARs just because their timestamp changed.
- It generates a git merge msg in prebuilts/devtools that has the sha1
of the corresponding tools/base and tools/swt projects.
Use option -m to prevent this.
------
Need a place to discuss all this?
http://groups.google.com/group/adt-dev is the right place.
--- RM 20130409

View file

@ -0,0 +1,26 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_JAVA_RESOURCE_DIRS := src
LOCAL_MODULE := annotations
LOCAL_MODULE_TAGS := optional
include $(BUILD_HOST_JAVA_LIBRARY)

View file

@ -0,0 +1,190 @@
Copyright (c) 2012-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

View file

@ -0,0 +1,20 @@
apply plugin: 'java'
apply plugin: 'sdk-files'
jar {
archiveName = 'annotations.jar'
}
sourceSets {
main.java.srcDirs 'src'
}
sdk {
common {
item(jar.archivePath) {
into 'support'
notice 'NOTICE'
builtBy jar
}
}
}

View file

@ -0,0 +1,38 @@
/*
* 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 android.annotation;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/** Indicates that Lint should ignore the specified warnings for the annotated element. */
@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
@Retention(RetentionPolicy.CLASS)
public @interface SuppressLint {
/**
* The set of warnings (identified by the lint issue id) that should be
* ignored by lint. It is not an error to specify an unrecognized name.
*/
String[] value();
}

View file

@ -0,0 +1,35 @@
/*
* 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 android.annotation;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/** Indicates that Lint should treat this type as targeting a given API level, no matter what the
project target is. */
@Target({TYPE, METHOD, CONSTRUCTOR})
@Retention(RetentionPolicy.CLASS)
public @interface TargetApi {
/**
* This sets the target api level for the type..
*/
int value();
}

View file

@ -0,0 +1,190 @@
Copyright (c) 2005-2008, The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View file

@ -0,0 +1,69 @@
#!/bin/sh
# Copyright 2005-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.
# Set up prog to be the path of this script, including following symlinks,
# and set up progdir to be the fully-qualified pathname of its directory.
prog="$0"
while [ -h "${prog}" ]; do
newProg=`/bin/ls -ld "${prog}"`
newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
if expr "x${newProg}" : 'x/' >/dev/null; then
prog="${newProg}"
else
progdir=`dirname "${prog}"`
prog="${progdir}/${newProg}"
fi
done
oldwd=`pwd`
progdir=`dirname "${prog}"`
cd "${progdir}"
progdir=`pwd`
prog="${progdir}"/`basename "${prog}"`
cd "${oldwd}"
jarfile=sdklib.jar
frameworkdir="$progdir"
if [ ! -r "$frameworkdir/$jarfile" ]
then
frameworkdir=`dirname "$progdir"`/tools/lib
fi
if [ ! -r "$frameworkdir/$jarfile" ]
then
frameworkdir=`dirname "$progdir"`/framework
fi
if [ ! -r "$frameworkdir/$jarfile" ]
then
echo `basename "$prog"`": can't find $jarfile"
exit 1
fi
# Check args.
if [ debug = "$1" ]; then
# add this in for debugging
java_debug=-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y
shift 1
else
java_debug=
fi
if [ "$OSTYPE" = "cygwin" ] ; then
jarpath=`cygpath -w "$frameworkdir/$jarfile"`
else
jarpath="$frameworkdir/$jarfile"
fi
# might need more memory, e.g. -Xmx128M
exec java -Xmx128M $java_debug -classpath "$jarpath" com.android.sdklib.build.ApkBuilderMain "$@"

View file

@ -0,0 +1,45 @@
@echo off
rem Copyright (C) 2007 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem don't modify the caller's environment
setlocal
rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0
rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0
rem Check we have a valid Java.exe in the path.
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
set jarfile=sdklib.jar
set frameworkdir=.
if exist %frameworkdir%\%jarfile% goto JarFileOk
set frameworkdir=lib
if exist %frameworkdir%\%jarfile% goto JarFileOk
set frameworkdir=..\framework
:JarFileOk
set jarpath=%frameworkdir%\%jarfile%
call "%java_exe%" -classpath "%jarpath%" com.android.sdklib.build.ApkBuilderMain %*

View file

@ -0,0 +1,5 @@
The apkbuilder command line tool is deprecated, and is not maintained anymore.
It is lacking recent build improvements such as support for Library Projects.
Its source code has been moved into sdklib.
It is recommended to directly use the com.android.sdklib.build.ApkBuilder class instead.

View file

@ -0,0 +1,8 @@
<?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>

View file

@ -0,0 +1,33 @@
<?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>

View file

@ -0,0 +1,5 @@
#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

View file

@ -0,0 +1,29 @@
<?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>

View file

@ -0,0 +1,6 @@
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.

View file

@ -0,0 +1,90 @@
<?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>

View file

@ -0,0 +1,20 @@
# 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 *;
#}

View file

@ -0,0 +1,11 @@
# 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -0,0 +1,395 @@
<?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>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="text_input">12 KEY</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="dock">CAR</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="dock">DESK</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="navigation">D-PAD</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="touch">FINGER</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="density">HIGH</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="keyboard_state">EXPOSED</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="keyboard_state">HIDDEN</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="keyboard_state">SOFT</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="orientation">LANDSCAPE</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="screen_size">LARGE</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="density">LOW</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="screen_long">LONG</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="density">MEDIUM</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="nav_state">EXPOSED</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="nav_state">HIDDEN</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="night">NIGHT</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="density">NODPI</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="text_input">NO KEYS</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="navigation">NO NAV</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="screen_size">NORMAL</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="screen_long">NOTLONG</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="night">NOTNIGHT</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="touch">NOTOUCH</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="orientation">PORTRAIT</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="text_input">QWERTY</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="screen_size">SMALL</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="touch">STYLUS</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="navigation">TRACKBALL</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="density">TV</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">1</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">14</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">2</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">3</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">4</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">5</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">6</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">7</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">8</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version">9</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="navigation">WHEEL</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="density">XHIGH</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="screen_size">XLARGE</string>
</resources>

View file

@ -0,0 +1,9 @@
<?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>

View file

@ -0,0 +1,673 @@
/*
* 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());
}
}

View file

@ -0,0 +1,186 @@
/*
* 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;
}
}
}
}
}

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>NotificationStudio</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>

View file

@ -0,0 +1,4 @@
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

View file

@ -0,0 +1,38 @@
<!--
Copyright 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.notificationstudio"
android:versionCode="5"
android:versionName="0.5" >
<uses-sdk android:targetSdkVersion="16" android:minSdkVersion="10" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="@string/app_name" >
<activity
android:name=".NotificationStudioActivity"
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>

View file

@ -0,0 +1,14 @@
# 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 edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-16

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -0,0 +1,29 @@
<!--
Copyright 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape android:shape="rectangle">
<solid android:color="@color/icon_background" />
<stroke android:width="1px" android:color="@android:color/holo_blue_light" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/icon_background" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 KiB

View file

@ -0,0 +1,21 @@
<!--
Copyright 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.
-->
<Switch xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/editor_text_size"
android:visibility="gone" />

View file

@ -0,0 +1,33 @@
<!--
Copyright 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.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.android.notificationstudio.MaxHeightScrollView
android:id="@+id/preview_scroller"
android:layout_width="@dimen/notification_panel_width"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp" >
<include layout="@layout/preview" />
</com.android.notificationstudio.MaxHeightScrollView>
<include layout="@layout/editors" />
</FrameLayout>

View file

@ -0,0 +1,28 @@
<!--
Copyright 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include
android:layout_width="@dimen/notification_panel_width"
android:layout_height="match_parent"
layout="@layout/preview" />
<include layout="@layout/editors" />
</LinearLayout>

View file

@ -0,0 +1,20 @@
<!--
Copyright 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.
-->
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />

View file

@ -0,0 +1,40 @@
<!--
Copyright 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/divider_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/editor_inset"
android:layout_marginTop="3dp"
android:textAllCaps="true"
android:textColor="@color/divider_text"
android:textSize="@dimen/editor_text_size" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/editor_inset"
android:layout_marginRight="@dimen/editor_inset"
android:layout_marginTop="3dp"
android:background="@color/divider_text" />
</LinearLayout>

View file

@ -0,0 +1,111 @@
<!--
Copyright 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.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_item_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/editor_inset" >
<TextView
android:id="@+id/caption"
android:layout_width="@dimen/editor_caption_width"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/caption_padding_bottom"
android:paddingTop="@dimen/caption_padding_top"
android:textSize="@dimen/editor_text_size" />
<EditText
android:id="@+id/text_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/caption"
android:layout_toRightOf="@id/caption"
android:imeOptions="actionDone"
android:inputType="text"
android:paddingTop="0dp"
android:textSize="@dimen/editor_text_size"
android:visibility="gone" />
<View
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" />
<ViewStub
android:id="@+id/boolean_editor_stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/caption"
android:layout_toRightOf="@id/caption"
android:textSize="@dimen/editor_text_size"
android:visibility="gone" />
<Spinner
android:id="@+id/drop_down_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/caption"
android:layout_toRightOf="@id/caption"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="gone" />
<HorizontalScrollView
android:id="@+id/icon_editor_scroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/caption"
android:scrollbars="none"
android:visibility="gone" >
<LinearLayout
android:id="@+id/icon_editor_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
</HorizontalScrollView>
<Button
android:id="@+id/date_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/caption"
android:layout_toRightOf="@id/caption"
android:textSize="@dimen/editor_text_size"
android:visibility="gone" />
<Button
android:id="@+id/time_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/caption"
android:layout_toRightOf="@id/date_button"
android:textSize="@dimen/editor_text_size"
android:visibility="gone" />
<Button
android:id="@+id/reset_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/caption"
android:layout_toRightOf="@id/time_button"
android:text="@string/now"
android:textSize="@dimen/editor_text_size"
android:visibility="gone" />
</RelativeLayout>

View file

@ -0,0 +1,29 @@
<!--
Copyright 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.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/editors"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/black" >
<LinearLayout
android:id="@+id/items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</ScrollView>

View file

@ -0,0 +1,56 @@
<!--
Copyright 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.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<FrameLayout
android:id="@+id/ticker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<ImageView
android:id="@+id/large_icon"
android:layout_width="@android:dimen/notification_large_icon_width"
android:layout_height="@android:dimen/notification_large_icon_height"
android:layout_alignParentLeft="true"
android:layout_below="@id/ticker"
android:scaleType="center"
android:visibility="gone"
tools:ignore="ContentDescription" />
<FrameLayout
android:id="@+id/oneU"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ticker"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/large_icon"
android:visibility="gone" />
<FrameLayout
android:id="@+id/fourU"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/oneU"
android:layout_marginTop="5dp"
android:visibility="gone" />
</RelativeLayout>

View file

@ -0,0 +1,26 @@
<!--
Copyright 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="@layout/preview" />
<include layout="@layout/editors" />
</LinearLayout>

View file

@ -0,0 +1,30 @@
<!--
Copyright 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.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_share_code"
android:icon="@android:drawable/ic_menu_share"
android:showAsAction="never"
android:title="@string/share_generated_code"/>
<item
android:id="@+id/action_share_mockup"
android:icon="@android:drawable/ic_menu_share"
android:showAsAction="never"
android:title="@string/share_mockup"/>
</menu>

View file

@ -0,0 +1,24 @@
<!--
Copyright 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.
-->
<resources>
<dimen name="notification_panel_width">446dp</dimen>
<dimen name="caption_padding_bottom">6dp</dimen>
<dimen name="editor_text_size">16dp</dimen>
<dimen name="editor_caption_width">110dp</dimen>
</resources>

View file

@ -0,0 +1,21 @@
<!--
Copyright 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.
-->
<resources>
<dimen name="notification_panel_width">448dp</dimen>
</resources>

View file

@ -0,0 +1,21 @@
<!--
Copyright 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.
-->
<resources>
<color name="divider_text">@android:color/holo_blue_bright</color>
</resources>

View file

@ -0,0 +1,21 @@
<!--
Copyright 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.
-->
<resources>
<dimen name="caption_padding_top">6dp</dimen>
</resources>

View file

@ -0,0 +1,23 @@
<!--
Copyright 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.
-->
<resources>
<color name="gb_background">#dddddd</color>
<color name="divider_text">#dddddd</color>
<color name="icon_background">#3333B5E5</color>
</resources>

View file

@ -0,0 +1,33 @@
<!--
Copyright 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.
-->
<resources>
<dimen name="notification_panel_width">-1dp</dimen> <!-- MATCH_PARENT -->
<dimen name="editor_inset">8dp</dimen>
<dimen name="caption_padding_top">10dp</dimen>
<dimen name="caption_padding_bottom">0dp</dimen>
<dimen name="editor_text_size">12dp</dimen>
<dimen name="editor_caption_width">95dp</dimen>
<dimen name="editor_icon_size_small">40dp</dimen>
<dimen name="editor_icon_size_large">60dp</dimen>
<dimen name="editor_icon_outer_margin">5dp</dimen>
<dimen name="editor_icon_inner_margin">2dp</dimen>
<dimen name="editor_drop_down_padding">5dp</dimen>
<dimen name="editor_datetime_padding_v">0dp</dimen>
<dimen name="editor_datetime_padding_h">15dp</dimen>
</resources>

View file

@ -0,0 +1,55 @@
<!--
Copyright 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.
-->
<resources>
<string name="app_name">Notification Studio</string>
<string name="now">Now</string>
<string name="share_generated_code">Share generated code…</string>
<string name="share_mockup">Share mockup…</string>
<string name="preset">Preset</string>
<string name="small_icon">Small Icon</string>
<string name="content_title">Content Title</string>
<string name="content_text">Content Text</string>
<string name="sub_text">Sub Text</string>
<string name="large_icon">Large Icon</string>
<string name="content_info">Content Info</string>
<string name="number">Number</string>
<string name="when">When</string>
<string name="progress">Progress</string>
<string name="uses_chron">Uses Chron</string>
<string name="style">Style</string>
<string name="picture">Picture</string>
<string name="big_text">Big Text</string>
<string name="lines">Lines</string>
<string name="big_content_title">Big Content Title</string>
<string name="summary_text">Summary Text</string>
<string name="icon">Icon</string>
<string name="text">Text</string>
<string name="properties">Properties</string>
<string name="action_1">Action 1</string>
<string name="action_2">Action 2</string>
<string name="action_3">Action 3</string>
<string name="preset_custom">(custom)</string>
<string name="preset_basic">Basic example</string>
<string name="preset_email">Email example</string>
<string name="preset_photo">Photo example</string>
<string name="style_none">(none)</string>
<string name="style_big_picture">BigPictureStyle</string>
<string name="style_big_text">BigTextStyle</string>
<string name="style_inbox">InboxStyle</string>
</resources>

Some files were not shown because too many files have changed in this diff Show more