diff options
Diffstat (limited to 'cmds')
-rwxr-xr-x | cmds/am/am | 2 | ||||
-rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 40 | ||||
-rw-r--r-- | cmds/app_process/app_main.cpp | 4 | ||||
-rw-r--r-- | cmds/backup/Android.mk | 15 | ||||
-rw-r--r-- | cmds/backup/NOTICE | 190 | ||||
-rw-r--r-- | cmds/backup/backup.cpp | 122 | ||||
-rw-r--r-- | cmds/bootanimation/Android.mk | 32 | ||||
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 248 | ||||
-rw-r--r-- | cmds/bootanimation/BootAnimation.h | 78 | ||||
-rw-r--r-- | cmds/bootanimation/bootanimation_main.cpp | 52 | ||||
-rw-r--r-- | cmds/dumpsys/Android.mk | 4 | ||||
-rw-r--r-- | cmds/dumpsys/dumpsys.cpp | 6 | ||||
-rw-r--r-- | cmds/runtime/Android.mk | 1 | ||||
-rw-r--r-- | cmds/runtime/ServiceManager.cpp | 4 | ||||
-rw-r--r-- | cmds/runtime/main_runtime.cpp | 4 | ||||
-rw-r--r-- | cmds/service/Android.mk | 3 | ||||
-rw-r--r-- | cmds/service/service.cpp | 6 | ||||
-rw-r--r-- | cmds/surfaceflinger/Android.mk | 1 | ||||
-rw-r--r-- | cmds/surfaceflinger/main_surfaceflinger.cpp | 6 | ||||
-rw-r--r-- | cmds/system_server/Android.mk | 1 | ||||
-rw-r--r-- | cmds/system_server/library/Android.mk | 1 | ||||
-rw-r--r-- | cmds/system_server/library/system_init.cpp | 6 | ||||
-rw-r--r-- | cmds/system_server/system_main.cpp | 2 |
23 files changed, 790 insertions, 38 deletions
@@ -3,5 +3,5 @@ # base=/system export CLASSPATH=$base/framework/am.jar -exec app_process $base/bin com.android.commands.am.Am $* +exec app_process $base/bin com.android.commands.am.Am "$@" diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 6d4b455..88ad265 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -194,18 +194,17 @@ public class Am { if (intent != null) { System.out.println("Starting: " + intent); try { - intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // XXX should do something to determine the MIME type. int res = mAm.startActivity(null, intent, intent.getType(), null, 0, null, null, 0, false, mDebugOption); switch (res) { case IActivityManager.START_SUCCESS: break; - case IActivityManager.START_CLASS_NOT_FOUND: - System.err.println("Error type 3"); - System.err.println("Error: Activity class " + - intent.getComponent().toShortString() - + " does not exist."); + case IActivityManager.START_SWITCHES_CANCELED: + System.err.println( + "Warning: Activity not started because the " + + " current activity is being kept for the user."); break; case IActivityManager.START_DELIVERED_TO_TOP: System.err.println( @@ -213,25 +212,36 @@ public class Am { + "been delivered to currently running " + "top-most instance."); break; - case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT: + case IActivityManager.START_RETURN_INTENT_TO_CALLER: System.err.println( - "Error: Activity not started, you requested to " - + "both forward and receive its result"); + "Warning: Activity not started because intent " + + "should be handled by the caller"); + break; + case IActivityManager.START_TASK_TO_FRONT: + System.err.println( + "Warning: Activity not started, its current " + + "task has been brought to the front"); break; case IActivityManager.START_INTENT_NOT_RESOLVED: System.err.println( "Error: Activity not started, unable to " + "resolve " + intent.toString()); break; - case IActivityManager.START_RETURN_INTENT_TO_CALLER: + case IActivityManager.START_CLASS_NOT_FOUND: + System.err.println("Error type 3"); + System.err.println("Error: Activity class " + + intent.getComponent().toShortString() + + " does not exist."); + break; + case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT: System.err.println( - "Warning: Activity not started because intent " - + "should be handled by the caller"); + "Error: Activity not started, you requested to " + + "both forward and receive its result"); break; - case IActivityManager.START_TASK_TO_FRONT: + case IActivityManager.START_PERMISSION_DENIED: System.err.println( - "Warning: Activity not started, its current " - + "task has been brought to the front"); + "Error: Activity not started, you do not " + + "have permission to access it."); break; default: System.err.println( diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp index d825d5a..7decf9a 100644 --- a/cmds/app_process/app_main.cpp +++ b/cmds/app_process/app_main.cpp @@ -7,8 +7,8 @@ #define LOG_TAG "appproc" -#include <utils/IPCThreadState.h> -#include <utils/ProcessState.h> +#include <binder/IPCThreadState.h> +#include <binder/ProcessState.h> #include <utils/Log.h> #include <cutils/process_name.h> #include <cutils/memory.h> diff --git a/cmds/backup/Android.mk b/cmds/backup/Android.mk new file mode 100644 index 0000000..508aec0 --- /dev/null +++ b/cmds/backup/Android.mk @@ -0,0 +1,15 @@ +# Copyright 2009 The Android Open Source Project + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= backup.cpp + +LOCAL_SHARED_LIBRARIES := libcutils libutils + +LOCAL_MODULE:= btool + +LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) +LOCAL_MODULE_TAGS := debug + +include $(BUILD_EXECUTABLE) diff --git a/cmds/backup/NOTICE b/cmds/backup/NOTICE new file mode 100644 index 0000000..c5b1efa --- /dev/null +++ b/cmds/backup/NOTICE @@ -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 + diff --git a/cmds/backup/backup.cpp b/cmds/backup/backup.cpp new file mode 100644 index 0000000..51ac943 --- /dev/null +++ b/cmds/backup/backup.cpp @@ -0,0 +1,122 @@ + +#include <utils/backup_helpers.h> +#include <utils/String8.h> + +#include <fcntl.h> +#include <stdio.h> +#include <string.h> + +using namespace android; + +#include <unistd.h> + +int +usage(int argc, const char** argv) +{ + const char* p = argv[0]; + + fprintf(stderr, "%s: Backs up your data.\n" + "\n" + "usage: %s\n" + " Prints all of the data that can be backed up to stdout.\n" + "\n" + "usage: %s list FILE\n" + " Lists the backup entities in the file.\n" + "\n" + "usage: %s print NAME FILE\n" + " Prints the entity named NAME in FILE.\n", + p, p, p, p); + return 1; +} + +int +perform_full_backup() +{ + printf("this would have written all of your data to stdout\n"); + return 0; +} + +int +perform_list(const char* filename) +{ + int err; + int fd; + + fd = open(filename, O_RDONLY); + if (fd == -1) { + fprintf(stderr, "Error opening: %s\n", filename); + return 1; + } + + BackupDataReader reader(fd); + int type; + + while (reader.ReadNextHeader(&type) == 0) { + switch (type) { + case BACKUP_HEADER_APP_V1: + { + String8 packageName; + int cookie; + err = reader.ReadAppHeader(&packageName, &cookie); + if (err == 0) { + printf("App header: %s 0x%08x (%d)\n", packageName.string(), cookie, cookie); + } else { + printf("Error reading app header\n"); + } + break; + } + case BACKUP_HEADER_ENTITY_V1: + { + String8 key; + size_t dataSize; + err = reader.ReadEntityHeader(&key, &dataSize); + if (err == 0) { + printf(" entity: %s (%d bytes)\n", key.string(), dataSize); + } else { + printf(" Error reading entity header\n"); + } + break; + } + case BACKUP_FOOTER_APP_V1: + { + int cookie; + err = reader.ReadAppFooter(&cookie); + if (err == 0) { + printf(" App footer: 0x%08x (%d)\n", cookie, cookie); + } else { + printf(" Error reading entity header\n"); + } + break; + } + default: + { + printf("Unknown chunk type: 0x%08x\n", type); + break; + } + } + } + + return 0; +} + +int perform_print(const char* entityname, const char* filename) +{ + printf("perform_print(%s, %s);", entityname, filename); + return 0; +} + +int +main(int argc, const char** argv) +{ + if (argc <= 1) { + return perform_full_backup(); + } + if (argc == 3 && 0 == strcmp(argv[1], "list")) { + return perform_list(argv[2]); + } + if (argc == 4 && 0 == strcmp(argv[1], "print")) { + return perform_print(argv[2], argv[3]); + } + return usage(argc, argv); +} + diff --git a/cmds/bootanimation/Android.mk b/cmds/bootanimation/Android.mk new file mode 100644 index 0000000..d31d81c --- /dev/null +++ b/cmds/bootanimation/Android.mk @@ -0,0 +1,32 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + bootanimation_main.cpp \ + BootAnimation.cpp + +# need "-lrt" on Linux simulator to pick up clock_gettime +ifeq ($(TARGET_SIMULATOR),true) + ifeq ($(HOST_OS),linux) + LOCAL_LDLIBS += -lrt + endif +endif + +LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ + libui \ + libcorecg \ + libsgl \ + libEGL \ + libGLESv1_CM + +LOCAL_C_INCLUDES := \ + $(call include-path-for, corecg graphics) + +LOCAL_MODULE:= bootanimation + + +include $(BUILD_EXECUTABLE) diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp new file mode 100644 index 0000000..e2d01de --- /dev/null +++ b/cmds/bootanimation/BootAnimation.cpp @@ -0,0 +1,248 @@ +/* + * 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. + */ + +#include <stdint.h> +#include <sys/types.h> +#include <math.h> +#include <fcntl.h> +#include <utils/misc.h> + +#include <binder/IPCThreadState.h> +#include <utils/threads.h> +#include <utils/Atomic.h> +#include <utils/Errors.h> +#include <utils/Log.h> +#include <utils/AssetManager.h> + +#include <ui/PixelFormat.h> +#include <ui/Rect.h> +#include <ui/Region.h> +#include <ui/DisplayInfo.h> +#include <ui/ISurfaceComposer.h> +#include <ui/ISurfaceFlingerClient.h> +#include <ui/FramebufferNativeWindow.h> + +#include <core/SkBitmap.h> +#include <images/SkImageDecoder.h> + +#include <GLES/gl.h> +#include <GLES/glext.h> +#include <EGL/eglext.h> + +#include "BootAnimation.h" + +namespace android { + +// --------------------------------------------------------------------------- + +BootAnimation::BootAnimation() : Thread(false) +{ + mSession = new SurfaceComposerClient(); +} + +BootAnimation::~BootAnimation() { +} + +void BootAnimation::onFirstRef() { + run("BootAnimation", PRIORITY_DISPLAY); +} + +const sp<SurfaceComposerClient>& BootAnimation::session() const { + return mSession; +} + +status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets, + const char* name) { + Asset* asset = assets.open(name, Asset::ACCESS_BUFFER); + if (!asset) + return NO_INIT; + SkBitmap bitmap; + SkImageDecoder::DecodeMemory(asset->getBuffer(false), asset->getLength(), + &bitmap, SkBitmap::kNo_Config, SkImageDecoder::kDecodePixels_Mode); + asset->close(); + delete asset; + + // ensure we can call getPixels(). No need to call unlock, since the + // bitmap will go out of scope when we return from this method. + bitmap.lockPixels(); + + const int w = bitmap.width(); + const int h = bitmap.height(); + const void* p = bitmap.getPixels(); + + GLint crop[4] = { 0, h, w, -h }; + texture->w = w; + texture->h = h; + + glGenTextures(1, &texture->name); + glBindTexture(GL_TEXTURE_2D, texture->name); + + switch (bitmap.getConfig()) { + case SkBitmap::kA8_Config: + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_ALPHA, + GL_UNSIGNED_BYTE, p); + break; + case SkBitmap::kARGB_4444_Config: + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, + GL_UNSIGNED_SHORT_4_4_4_4, p); + break; + case SkBitmap::kARGB_8888_Config: + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, + GL_UNSIGNED_BYTE, p); + break; + case SkBitmap::kRGB_565_Config: + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, + GL_UNSIGNED_SHORT_5_6_5, p); + break; + default: + break; + } + + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + return NO_ERROR; +} + +status_t BootAnimation::readyToRun() { + mAssets.addDefaultAssets(); + + DisplayInfo dinfo; + status_t status = session()->getDisplayInfo(0, &dinfo); + if (status) + return -1; + + // create the native surface + sp<SurfaceControl> control = session()->createSurface( + getpid(), 0, dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565, + ISurfaceComposer::eGPU); + session()->openTransaction(); + control->setLayer(0x40000000); + session()->closeTransaction(); + + sp<Surface> s = control->getSurface(); + + // initialize opengl and egl + const EGLint attribs[] = { EGL_RED_SIZE, 5, EGL_GREEN_SIZE, 6, + EGL_BLUE_SIZE, 5, EGL_DEPTH_SIZE, 0, EGL_NONE }; + EGLint w, h, dummy; + EGLint numConfigs; + EGLConfig config; + EGLSurface surface; + EGLContext context; + + EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); + + eglInitialize(display, 0, 0); + eglChooseConfig(display, attribs, &config, 1, &numConfigs); + + surface = eglCreateWindowSurface(display, config, s.get(), NULL); + + context = eglCreateContext(display, config, NULL, NULL); + eglQuerySurface(display, surface, EGL_WIDTH, &w); + eglQuerySurface(display, surface, EGL_HEIGHT, &h); + eglMakeCurrent(display, surface, surface, context); + mDisplay = display; + mContext = context; + mSurface = surface; + mWidth = w; + mHeight = h; + mFlingerSurfaceControl = control; + mFlingerSurface = s; + + // initialize GL + glShadeModel(GL_FLAT); + glEnable(GL_TEXTURE_2D); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + return NO_ERROR; +} + +bool BootAnimation::threadLoop() { + bool r = android(); + eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroyContext(mDisplay, mContext); + eglDestroySurface(mDisplay, mSurface); + mFlingerSurface.clear(); + mFlingerSurfaceControl.clear(); + eglTerminate(mDisplay); + IPCThreadState::self()->stopProcess(); + return r; +} + +bool BootAnimation::android() { + initTexture(&mAndroid[0], mAssets, "images/android-logo-mask.png"); + initTexture(&mAndroid[1], mAssets, "images/android-logo-shine.png"); + + // clear screen + glDisable(GL_DITHER); + glDisable(GL_SCISSOR_TEST); + glClear(GL_COLOR_BUFFER_BIT); + eglSwapBuffers(mDisplay, mSurface); + + const GLint xc = (mWidth - mAndroid[0].w) / 2; + const GLint yc = (mHeight - mAndroid[0].h) / 2; + const Rect updateRect(xc, yc, xc + mAndroid[0].w, yc + mAndroid[0].h); + + // draw and update only what we need + mFlingerSurface->setSwapRectangle(updateRect); + + glEnable(GL_SCISSOR_TEST); + glScissor(updateRect.left, mHeight - updateRect.bottom, updateRect.width(), + updateRect.height()); + + // Blend state + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + const nsecs_t startTime = systemTime(); + do { + nsecs_t now = systemTime(); + double time = now - startTime; + float t = 4.0f * float(time / us2ns(16667)) / mAndroid[1].w; + GLint offset = (1 - (t - floorf(t))) * mAndroid[1].w; + GLint x = xc - offset; + + glDisable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, mAndroid[1].name); + glDrawTexiOES(x, yc, 0, mAndroid[1].w, mAndroid[1].h); + glDrawTexiOES(x + mAndroid[1].w, yc, 0, mAndroid[1].w, mAndroid[1].h); + + glEnable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, mAndroid[0].name); + glDrawTexiOES(xc, yc, 0, mAndroid[0].w, mAndroid[0].h); + + EGLBoolean res = eglSwapBuffers(mDisplay, mSurface); + if (res == EGL_FALSE) + break; + + // 12fps: don't animate too fast to preserve CPU + const nsecs_t sleepTime = 83333 - ns2us(systemTime() - now); + if (sleepTime > 0) + usleep(sleepTime); + } while (!exitPending()); + + glDeleteTextures(1, &mAndroid[0].name); + glDeleteTextures(1, &mAndroid[1].name); + return false; +} + +// --------------------------------------------------------------------------- + +} +; // namespace android diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h new file mode 100644 index 0000000..796077d --- /dev/null +++ b/cmds/bootanimation/BootAnimation.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_BOOTANIMATION_H +#define ANDROID_BOOTANIMATION_H + +#include <stdint.h> +#include <sys/types.h> + +#include <utils/threads.h> +#include <utils/AssetManager.h> + +#include <ui/ISurfaceComposer.h> +#include <ui/SurfaceComposerClient.h> + +#include <EGL/egl.h> +#include <GLES/gl.h> + +class SkBitmap; + +namespace android { + +class AssetManager; + +// --------------------------------------------------------------------------- + +class BootAnimation : public Thread +{ +public: + BootAnimation(); + virtual ~BootAnimation(); + + const sp<SurfaceComposerClient>& session() const; + +private: + virtual bool threadLoop(); + virtual status_t readyToRun(); + virtual void onFirstRef(); + + struct Texture { + GLint w; + GLint h; + GLuint name; + }; + + status_t initTexture(Texture* texture, AssetManager& asset, const char* name); + bool android(); + + sp<SurfaceComposerClient> mSession; + AssetManager mAssets; + Texture mAndroid[2]; + int mWidth; + int mHeight; + EGLDisplay mDisplay; + EGLDisplay mContext; + EGLDisplay mSurface; + sp<SurfaceControl> mFlingerSurfaceControl; + sp<Surface> mFlingerSurface; +}; + +// --------------------------------------------------------------------------- + +}; // namespace android + +#endif // ANDROID_BOOTANIMATION_H diff --git a/cmds/bootanimation/bootanimation_main.cpp b/cmds/bootanimation/bootanimation_main.cpp new file mode 100644 index 0000000..346f156 --- /dev/null +++ b/cmds/bootanimation/bootanimation_main.cpp @@ -0,0 +1,52 @@ +/* + * 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. + */ + +#define LOG_TAG "BootAnimation" + +#include <binder/IPCThreadState.h> +#include <binder/ProcessState.h> +#include <binder/IServiceManager.h> +#include <utils/Log.h> +#include <utils/threads.h> + +#include <ui/ISurfaceComposer.h> + +#if defined(HAVE_PTHREADS) +# include <pthread.h> +# include <sys/resource.h> +#endif + +#include "BootAnimation.h" + +using namespace android; + +// --------------------------------------------------------------------------- + +int main(int argc, char** argv) +{ +#if defined(HAVE_PTHREADS) + setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY); +#endif + + sp<ProcessState> proc(ProcessState::self()); + ProcessState::self()->startThreadPool(); + + // create the boot animation object + sp<BootAnimation> boot = new BootAnimation(); + + IPCThreadState::self()->joinThreadPool(); + return 0; +} diff --git a/cmds/dumpsys/Android.mk b/cmds/dumpsys/Android.mk index 0c623cc..42b1b73 100644 --- a/cmds/dumpsys/Android.mk +++ b/cmds/dumpsys/Android.mk @@ -5,7 +5,9 @@ LOCAL_SRC_FILES:= \ dumpsys.cpp LOCAL_SHARED_LIBRARIES := \ - libutils + libutils \ + libbinder + ifeq ($(TARGET_OS),linux) LOCAL_CFLAGS += -DXP_UNIX diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp index a62fe55..945a690 100644 --- a/cmds/dumpsys/dumpsys.cpp +++ b/cmds/dumpsys/dumpsys.cpp @@ -6,9 +6,9 @@ #define LOG_TAG "dumpsys" #include <utils/Log.h> -#include <utils/Parcel.h> -#include <utils/ProcessState.h> -#include <utils/IServiceManager.h> +#include <binder/Parcel.h> +#include <binder/ProcessState.h> +#include <binder/IServiceManager.h> #include <utils/TextOutput.h> #include <utils/Vector.h> diff --git a/cmds/runtime/Android.mk b/cmds/runtime/Android.mk index 521eb2b..6a72d10 100644 --- a/cmds/runtime/Android.mk +++ b/cmds/runtime/Android.mk @@ -10,6 +10,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libutils \ + libbinder \ libandroid_runtime \ libcutils \ libui \ diff --git a/cmds/runtime/ServiceManager.cpp b/cmds/runtime/ServiceManager.cpp index 758a95c..b2bef07 100644 --- a/cmds/runtime/ServiceManager.cpp +++ b/cmds/runtime/ServiceManager.cpp @@ -9,9 +9,9 @@ #include <utils/Debug.h> #include <utils/Log.h> -#include <utils/Parcel.h> +#include <binder/Parcel.h> #include <utils/String8.h> -#include <utils/ProcessState.h> +#include <binder/ProcessState.h> #include <private/utils/Static.h> diff --git a/cmds/runtime/main_runtime.cpp b/cmds/runtime/main_runtime.cpp index 1531a9e..718ea67 100644 --- a/cmds/runtime/main_runtime.cpp +++ b/cmds/runtime/main_runtime.cpp @@ -8,8 +8,8 @@ #include "SignalHandler.h" #include <utils.h> -#include <utils/IPCThreadState.h> -#include <utils/ProcessState.h> +#include <binder/IPCThreadState.h> +#include <binder/ProcessState.h> #include <utils/Log.h> #include <cutils/zygote.h> diff --git a/cmds/service/Android.mk b/cmds/service/Android.mk index 8c5005c..275bbb2 100644 --- a/cmds/service/Android.mk +++ b/cmds/service/Android.mk @@ -4,8 +4,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ service.cpp -LOCAL_SHARED_LIBRARIES := \ - libutils +LOCAL_SHARED_LIBRARIES := libutils libbinder ifeq ($(TARGET_OS),linux) LOCAL_CFLAGS += -DXP_UNIX diff --git a/cmds/service/service.cpp b/cmds/service/service.cpp index 859a9bf..32db83b 100644 --- a/cmds/service/service.cpp +++ b/cmds/service/service.cpp @@ -3,9 +3,9 @@ * */ -#include <utils/Parcel.h> -#include <utils/ProcessState.h> -#include <utils/IServiceManager.h> +#include <binder/Parcel.h> +#include <binder/ProcessState.h> +#include <binder/IServiceManager.h> #include <utils/TextOutput.h> #include <getopt.h> diff --git a/cmds/surfaceflinger/Android.mk b/cmds/surfaceflinger/Android.mk index 37c3d94..bfa58a1 100644 --- a/cmds/surfaceflinger/Android.mk +++ b/cmds/surfaceflinger/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libsurfaceflinger \ + libbinder \ libutils LOCAL_C_INCLUDES := \ diff --git a/cmds/surfaceflinger/main_surfaceflinger.cpp b/cmds/surfaceflinger/main_surfaceflinger.cpp index 7c89578..d650721 100644 --- a/cmds/surfaceflinger/main_surfaceflinger.cpp +++ b/cmds/surfaceflinger/main_surfaceflinger.cpp @@ -1,6 +1,6 @@ -#include <utils/IPCThreadState.h> -#include <utils/ProcessState.h> -#include <utils/IServiceManager.h> +#include <binder/IPCThreadState.h> +#include <binder/ProcessState.h> +#include <binder/IServiceManager.h> #include <utils/Log.h> #include <SurfaceFlinger.h> diff --git a/cmds/system_server/Android.mk b/cmds/system_server/Android.mk index 0a684e8..ad537977 100644 --- a/cmds/system_server/Android.mk +++ b/cmds/system_server/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libutils \ + libbinder \ libsystem_server LOCAL_C_INCLUDES := \ diff --git a/cmds/system_server/library/Android.mk b/cmds/system_server/library/Android.mk index 580331a..1813d3e 100644 --- a/cmds/system_server/library/Android.mk +++ b/cmds/system_server/library/Android.mk @@ -20,6 +20,7 @@ LOCAL_SHARED_LIBRARIES := \ libcameraservice \ libmediaplayerservice \ libutils \ + libbinder \ libcutils LOCAL_MODULE:= libsystem_server diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp index 73b23e2..ea78461 100644 --- a/cmds/system_server/library/system_init.cpp +++ b/cmds/system_server/library/system_init.cpp @@ -8,9 +8,9 @@ #define LOG_TAG "sysproc" -#include <utils/IPCThreadState.h> -#include <utils/ProcessState.h> -#include <utils/IServiceManager.h> +#include <binder/IPCThreadState.h> +#include <binder/ProcessState.h> +#include <binder/IServiceManager.h> #include <utils/TextOutput.h> #include <utils/Log.h> diff --git a/cmds/system_server/system_main.cpp b/cmds/system_server/system_main.cpp index ca16e57..543f650 100644 --- a/cmds/system_server/system_main.cpp +++ b/cmds/system_server/system_main.cpp @@ -9,7 +9,7 @@ #define LOG_TAG "sysproc" -#include <utils/IPCThreadState.h> +#include <binder/IPCThreadState.h> #include <utils/Log.h> #include <private/android_filesystem_config.h> |