Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0b0a7c7 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by android-build-merger
Browse files

Camera: Disallow dumping clients directly am: c4003965 am: 79524368 am: fb5043a7

am: 3a0d1df3

* commit '3a0d1df3':
  Camera: Disallow dumping clients directly
parents 6258d848 3a0d1df3
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1945,6 +1945,14 @@ void CameraService::BasicClient::disconnect() {
    mClientPid = 0;
}

status_t CameraService::BasicClient::dump(int, const Vector<String16>&) {
    // No dumping of clients directly over Binder,
    // must go through CameraService::dump
    android_errorWriteWithInfoLog(SN_EVENT_LOG_ID, "26265403",
            IPCThreadState::self()->getCallingUid(), NULL, 0);
    return OK;
}

String16 CameraService::BasicClient::getPackageName() const {
    return mClientPackageName;
}
@@ -2397,7 +2405,7 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) {
                    String8(client->getPackageName()).string());
            write(fd, result.string(), result.size());

            client->dump(fd, args);
            client->dumpClient(fd, args);
        }

        if (stateLocked) mCameraStatesLock.unlock();
+7 −1
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ public:
    // Default number of messages to store in eviction log
    static const size_t DEFAULT_EVENT_LOG_LENGTH = 100;

    // Event log ID
    static const int SN_EVENT_LOG_ID = 0x534e4554;

    // Implementation of BinderService<T>
    static char const* getServiceName() { return "media.camera"; }

@@ -201,7 +204,10 @@ public:
            return mRemoteBinder;
        }

        virtual status_t    dump(int fd, const Vector<String16>& args) = 0;
        // Disallows dumping over binder interface
        virtual status_t      dump(int fd, const Vector<String16>& args);
        // Internal dump method to be called by CameraService
        virtual status_t      dumpClient(int fd, const Vector<String16>& args) = 0;

        // Return the package name for this client
        virtual String16 getPackageName() const;
+4 −0
Original line number Diff line number Diff line
@@ -163,6 +163,10 @@ Camera2Client::~Camera2Client() {
}

status_t Camera2Client::dump(int fd, const Vector<String16>& args) {
    return BasicClient::dump(fd, args);
}

status_t Camera2Client::dumpClient(int fd, const Vector<String16>& args) {
    String8 result;
    result.appendFormat("Client2[%d] (%p) PID: %d, dump:\n", mCameraId,
            (getRemoteCallback() != NULL ?
+2 −0
Original line number Diff line number Diff line
@@ -100,6 +100,8 @@ public:

    virtual status_t dump(int fd, const Vector<String16>& args);

    virtual status_t dumpClient(int fd, const Vector<String16>& args);

    /**
     * Interface used by CameraDeviceBase
     */
+4 −0
Original line number Diff line number Diff line
@@ -108,6 +108,10 @@ CameraClient::~CameraClient() {
}

status_t CameraClient::dump(int fd, const Vector<String16>& args) {
    return BasicClient::dump(fd, args);
}

status_t CameraClient::dumpClient(int fd, const Vector<String16>& args) {
    const size_t SIZE = 256;
    char buffer[SIZE];

Loading