M7350v1_en_gpl

This commit is contained in:
T
2024-09-09 08:52:07 +00:00
commit f9cc65cfda
65988 changed files with 26357421 additions and 0 deletions

View File

@@ -0,0 +1 @@
include $(call all-subdir-makefiles)

View File

@@ -0,0 +1,17 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
overlays.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libui \
libsurfaceflinger_client
LOCAL_MODULE:= test-overlays
LOCAL_MODULE_TAGS := tests
include $(BUILD_EXECUTABLE)

View File

@@ -0,0 +1,59 @@
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <utils/Log.h>
#include <ui/Overlay.h>
#include <surfaceflinger/Surface.h>
#include <surfaceflinger/ISurface.h>
#include <surfaceflinger/SurfaceComposerClient.h>
using namespace android;
namespace android {
class Test {
public:
static const sp<ISurface>& getISurface(const sp<Surface>& s) {
return s->getISurface();
}
};
};
int main(int argc, char** argv)
{
// set up the thread-pool
sp<ProcessState> proc(ProcessState::self());
ProcessState::self()->startThreadPool();
// create a client to surfaceflinger
sp<SurfaceComposerClient> client = new SurfaceComposerClient();
// create pushbuffer surface
sp<Surface> surface = client->createSurface(getpid(), 0, 320, 240,
PIXEL_FORMAT_UNKNOWN, ISurfaceComposer::ePushBuffers);
// get to the isurface
sp<ISurface> isurface = Test::getISurface(surface);
printf("isurface = %p\n", isurface.get());
// now request an overlay
sp<OverlayRef> ref = isurface->createOverlay(320, 240, PIXEL_FORMAT_RGB_565);
sp<Overlay> overlay = new Overlay(ref);
/*
* here we can use the overlay API
*/
overlay_buffer_t buffer;
overlay->dequeueBuffer(&buffer);
printf("buffer = %p\n", buffer);
void* address = overlay->getBufferAddress(buffer);
printf("address = %p\n", address);
overlay->queueBuffer(buffer);
return 0;
}

View File

@@ -0,0 +1,17 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
resize.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libui \
libsurfaceflinger_client
LOCAL_MODULE:= test-resize
LOCAL_MODULE_TAGS := tests
include $(BUILD_EXECUTABLE)

View File

@@ -0,0 +1,62 @@
#include <cutils/memory.h>
#include <utils/Log.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <surfaceflinger/Surface.h>
#include <surfaceflinger/ISurface.h>
#include <surfaceflinger/SurfaceComposerClient.h>
#include <ui/Overlay.h>
using namespace android;
namespace android {
class Test {
public:
static const sp<ISurface>& getISurface(const sp<Surface>& s) {
return s->getISurface();
}
};
};
int main(int argc, char** argv)
{
// set up the thread-pool
sp<ProcessState> proc(ProcessState::self());
ProcessState::self()->startThreadPool();
// create a client to surfaceflinger
sp<SurfaceComposerClient> client = new SurfaceComposerClient();
// create pushbuffer surface
sp<Surface> surface = client->createSurface(getpid(), 0, 160, 240,
PIXEL_FORMAT_RGB_565);
client->openTransaction();
surface->setLayer(100000);
client->closeTransaction();
Surface::SurfaceInfo info;
surface->lock(&info);
ssize_t bpr = info.s * bytesPerPixel(info.format);
android_memset16((uint16_t*)info.bits, 0xF800, bpr*info.h);
surface->unlockAndPost();
surface->lock(&info);
android_memset16((uint16_t*)info.bits, 0x07E0, bpr*info.h);
surface->unlockAndPost();
client->openTransaction();
surface->setSize(320, 240);
client->closeTransaction();
IPCThreadState::self()->joinThreadPool();
return 0;
}

View File

@@ -0,0 +1,26 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
screencap.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libbinder \
libskia \
libui \
libsurfaceflinger_client
LOCAL_MODULE:= test-screencap
LOCAL_MODULE_TAGS := tests
LOCAL_C_INCLUDES += \
external/skia/include/core \
external/skia/include/effects \
external/skia/include/images \
external/skia/src/ports \
external/skia/include/utils
include $(BUILD_EXECUTABLE)

View File

@@ -0,0 +1,63 @@
/*
* Copyright (C) 2010 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 <utils/Log.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <binder/IMemory.h>
#include <surfaceflinger/ISurfaceComposer.h>
#include <SkImageEncoder.h>
#include <SkBitmap.h>
using namespace android;
int main(int argc, char** argv)
{
if (argc != 2) {
printf("usage: %s path\n", argv[0]);
exit(0);
}
const String16 name("SurfaceFlinger");
sp<ISurfaceComposer> composer;
getService(name, &composer);
sp<IMemoryHeap> heap;
uint32_t w, h;
PixelFormat f;
status_t err = composer->captureScreen(0, &heap, &w, &h, &f, 0, 0);
if (err != NO_ERROR) {
fprintf(stderr, "screen capture failed: %s\n", strerror(-err));
exit(0);
}
printf("screen capture success: w=%u, h=%u, pixels=%p\n",
w, h, heap->getBase());
printf("saving file as PNG in %s ...\n", argv[1]);
SkBitmap b;
b.setConfig(SkBitmap::kARGB_8888_Config, w, h);
b.setPixels(heap->getBase());
SkImageEncoder::EncodeFile(argv[1], b,
SkImageEncoder::kPNG_Type, SkImageEncoder::kDefaultQuality);
return 0;
}

View File

@@ -0,0 +1,18 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
surface.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libbinder \
libui \
libsurfaceflinger_client
LOCAL_MODULE:= test-surface
LOCAL_MODULE_TAGS := tests
include $(BUILD_EXECUTABLE)

View File

@@ -0,0 +1,54 @@
#include <cutils/memory.h>
#include <utils/Log.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <surfaceflinger/Surface.h>
#include <surfaceflinger/ISurface.h>
#include <surfaceflinger/SurfaceComposerClient.h>
#include <ui/Overlay.h>
using namespace android;
int main(int argc, char** argv)
{
// set up the thread-pool
sp<ProcessState> proc(ProcessState::self());
ProcessState::self()->startThreadPool();
// create a client to surfaceflinger
sp<SurfaceComposerClient> client = new SurfaceComposerClient();
// create pushbuffer surface
sp<SurfaceControl> surfaceControl = client->createSurface(
getpid(), 0, 160, 240, PIXEL_FORMAT_RGB_565);
client->openTransaction();
surfaceControl->setLayer(100000);
client->closeTransaction();
// pretend it went cross-process
Parcel parcel;
SurfaceControl::writeSurfaceToParcel(surfaceControl, &parcel);
parcel.setDataPosition(0);
sp<Surface> surface = Surface::readFromParcel(parcel);
ANativeWindow* window = surface.get();
printf("window=%p\n", window);
int err = native_window_set_buffer_count(window, 8);
android_native_buffer_t* buffer;
for (int i=0 ; i<8 ; i++) {
window->dequeueBuffer(window, &buffer);
printf("buffer %d: %p\n", i, buffer);
}
printf("test complete. CTRL+C to finish.\n");
IPCThreadState::self()->joinThreadPool();
return 0;
}

View File

@@ -0,0 +1,19 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
TransformTest.cpp \
../../Transform.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libui \
LOCAL_MODULE:= test-transform
LOCAL_MODULE_TAGS := tests
LOCAL_C_INCLUDES += ../..
include $(BUILD_EXECUTABLE)

View File

@@ -0,0 +1,45 @@
/*
* 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 <utils/Errors.h>
#include "../../Transform.h"
using namespace android;
int main(int argc, char **argv)
{
Transform tr90(Transform::ROT_90);
Transform trFH(Transform::FLIP_H);
Transform trFV(Transform::FLIP_V);
Transform tr90FH(Transform::ROT_90 | Transform::FLIP_H);
Transform tr90FV(Transform::ROT_90 | Transform::FLIP_V);
tr90.dump("tr90");
trFH.dump("trFH");
trFV.dump("trFV");
tr90FH.dump("tr90FH");
tr90FV.dump("tr90FV");
(trFH*tr90).dump("trFH*tr90");
(trFV*tr90).dump("trFV*tr90");
(tr90*trFH).dump("tr90*trFH");
(tr90*trFV).dump("tr90*trFV");
return 0;
}