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,21 @@
#ifndef _FRAMEWORK_CLIENT_H
#define _FRAMEWORK_CLIENT_H
#include "../../../frameworks/base/include/utils/List.h"
#include <pthread.h>
class FrameworkClient {
int mSocket;
pthread_mutex_t mWriteMutex;
public:
FrameworkClient(int sock);
virtual ~FrameworkClient() {}
int sendMsg(const char *msg);
int sendMsg(const char *msg, const char *data);
};
typedef android::List<FrameworkClient *> FrameworkClientCollection;
#endif

View File

@@ -0,0 +1,38 @@
/*
* 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.
*/
#ifndef __FRAMEWORK_CMD_HANDLER_H
#define __FRAMEWORK_CMD_HANDLER_H
#include "../../../frameworks/base/include/utils/List.h"
class SocketClient;
class FrameworkCommand {
private:
const char *mCommand;
public:
FrameworkCommand(const char *cmd);
virtual ~FrameworkCommand() { }
virtual int runCommand(SocketClient *c, int argc, char **argv) = 0;
const char *getCommand() { return mCommand; }
};
typedef android::List<FrameworkCommand *> FrameworkCommandCollection;
#endif

View File

@@ -0,0 +1,41 @@
/*
* 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.
*/
#ifndef _FRAMEWORKSOCKETLISTENER_H
#define _FRAMEWORKSOCKETLISTENER_H
#include "SocketListener.h"
#include "FrameworkCommand.h"
class SocketClient;
class FrameworkListener : public SocketListener {
public:
static const int CMD_ARGS_MAX = 16;
private:
FrameworkCommandCollection *mCommands;
public:
FrameworkListener(const char *socketName);
virtual ~FrameworkListener() {}
protected:
void registerCmd(FrameworkCommand *cmd);
virtual bool onDataAvailable(SocketClient *c);
private:
void dispatchCommand(SocketClient *c, char *data);
};
#endif

View File

@@ -0,0 +1,46 @@
/*
* 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.
*/
#ifndef _NETLINKEVENT_H
#define _NETLINKEVENT_H
#define NL_PARAMS_MAX 32
class NetlinkEvent {
int mSeq;
char *mPath;
int mAction;
char *mSubsystem;
char *mParams[NL_PARAMS_MAX];
public:
const static int NlActionUnknown;
const static int NlActionAdd;
const static int NlActionRemove;
const static int NlActionChange;
NetlinkEvent();
virtual ~NetlinkEvent();
bool decode(char *buffer, int size);
const char *findParam(const char *paramName);
const char *getSubsystem() { return mSubsystem; }
int getAction() { return mAction; }
void dump();
};
#endif

View File

@@ -0,0 +1,34 @@
/*
* 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.
*/
#ifndef _NETLINKLISTENER_H
#define _NETLINKLISTENER_H
#include "SocketListener.h"
class NetlinkEvent;
class NetlinkListener : public SocketListener {
char mBuffer[64 * 1024];
public:
NetlinkListener(int socket);
virtual ~NetlinkListener() {}
protected:
virtual bool onDataAvailable(SocketClient *cli);
virtual void onEvent(NetlinkEvent *evt) = 0;
};
#endif

View File

@@ -0,0 +1,30 @@
/*
* 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.
*/
#ifndef _SERVICE_MANAGER_H
#define _SERVICE_MANAGER_H
class ServiceManager {
public:
ServiceManager();
virtual ~ServiceManager() {}
int start(const char *name);
int stop(const char *name);
bool isRunning(const char *name);
};
#endif

View File

@@ -0,0 +1,36 @@
#ifndef _SOCKET_CLIENT_H
#define _SOCKET_CLIENT_H
#include "../../../frameworks/base/include/utils/List.h"
#include <pthread.h>
#include <sys/types.h>
class SocketClient {
int mSocket;
pthread_mutex_t mWriteMutex;
/* Peer process ID */
pid_t mPid;
/* Peer user ID */
uid_t mUid;
/* Peer group ID */
gid_t mGid;
public:
SocketClient(int sock);
virtual ~SocketClient() {}
int getSocket() { return mSocket; }
pid_t getPid() const { return mPid; }
uid_t getUid() const { return mUid; }
gid_t getGid() const { return mGid; }
int sendMsg(int code, const char *msg, bool addErrno);
int sendMsg(const char *msg);
};
typedef android::List<SocketClient *> SocketClientCollection;
#endif

View File

@@ -0,0 +1,50 @@
/*
* 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.
*/
#ifndef _SOCKETLISTENER_H
#define _SOCKETLISTENER_H
#include <pthread.h>
#include <sysutils/SocketClient.h>
class SocketListener {
int mSock;
const char *mSocketName;
SocketClientCollection *mClients;
pthread_mutex_t mClientsLock;
bool mListen;
int mCtrlPipe[2];
pthread_t mThread;
public:
SocketListener(const char *socketNames, bool listen);
SocketListener(int socketFd, bool listen);
virtual ~SocketListener();
int startListener();
int stopListener();
void sendBroadcast(int code, const char *msg, bool addErrno);
void sendBroadcast(const char *msg);
protected:
virtual bool onDataAvailable(SocketClient *c) = 0;
private:
static void *threadStart(void *obj);
void runListener();
};
#endif