Respect the record audio app op - frameworks native
Change-Id: Id747767377953fd644a538aad3f603d6c50875a2
This commit is contained in:
parent
4afd8b67f9
commit
f1377f506c
@ -63,7 +63,31 @@ public:
|
||||
OP_ACCESS_NOTIFICATIONS = 25,
|
||||
OP_CAMERA = 26,
|
||||
OP_RECORD_AUDIO = 27,
|
||||
OP_PLAY_AUDIO = 28
|
||||
OP_PLAY_AUDIO = 28,
|
||||
OP_READ_CLIPBOARD = 29,
|
||||
OP_WRITE_CLIPBOARD = 30,
|
||||
OP_TAKE_MEDIA_BUTTONS = 31,
|
||||
OP_TAKE_AUDIO_FOCUS = 32,
|
||||
OP_AUDIO_MASTER_VOLUME = 33,
|
||||
OP_AUDIO_VOICE_VOLUME = 34,
|
||||
OP_AUDIO_RING_VOLUME = 35,
|
||||
OP_AUDIO_MEDIA_VOLUME = 36,
|
||||
OP_AUDIO_ALARM_VOLUME = 37,
|
||||
OP_AUDIO_NOTIFICATION_VOLUME = 38,
|
||||
OP_AUDIO_BLUETOOTH_VOLUME = 39,
|
||||
OP_WAKE_LOCK = 40,
|
||||
OP_MONITOR_LOCATION = 41,
|
||||
OP_MONITOR_HIGH_POWER_LOCATION = 42,
|
||||
OP_GET_USAGE_STATS = 43,
|
||||
OP_MUTE_MICROPHONE = 44,
|
||||
OP_TOAST_WINDOW = 45,
|
||||
OP_PROJECT_MEDIA = 46,
|
||||
OP_ACTIVATE_VPN = 47,
|
||||
OP_WRITE_WALLPAPER = 48,
|
||||
OP_ASSIST_STRUCTURE = 49,
|
||||
OP_ASSIST_SCREENSHOT = 50,
|
||||
OP_READ_PHONE_STATE = 51,
|
||||
OP_ADD_VOICEMAIL = 52
|
||||
};
|
||||
|
||||
AppOpsManager();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define ANDROID_IPERMISSION_CONTROLLER_H
|
||||
|
||||
#include <binder/IInterface.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
@ -29,11 +30,13 @@ class IPermissionController : public IInterface
|
||||
public:
|
||||
DECLARE_META_INTERFACE(PermissionController);
|
||||
|
||||
virtual bool checkPermission(const String16& permission,
|
||||
int32_t pid, int32_t uid) = 0;
|
||||
|
||||
virtual bool checkPermission(const String16& permission, int32_t pid, int32_t uid) = 0;
|
||||
|
||||
virtual void getPackagesForUid(const uid_t uid, Vector<String16> &packages) = 0;
|
||||
|
||||
enum {
|
||||
CHECK_PERMISSION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION
|
||||
CHECK_PERMISSION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
|
||||
GET_PACKAGES_FOR_UID_TRANSACTION = CHECK_PERMISSION_TRANSACTION + 1
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -48,6 +48,25 @@ public:
|
||||
if (reply.readExceptionCode() != 0) return 0;
|
||||
return reply.readInt32() != 0;
|
||||
}
|
||||
|
||||
virtual void getPackagesForUid(const uid_t uid, Vector<String16>& packages)
|
||||
{
|
||||
Parcel data, reply;
|
||||
data.writeInterfaceToken(IPermissionController::getInterfaceDescriptor());
|
||||
data.writeInt32(uid);
|
||||
remote()->transact(GET_PACKAGES_FOR_UID_TRANSACTION, data, &reply);
|
||||
// fail on exception
|
||||
if (reply.readExceptionCode() != 0) {
|
||||
return;
|
||||
}
|
||||
const int32_t size = reply.readInt32();
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
packages.push(reply.readString16());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_META_INTERFACE(PermissionController, "android.os.IPermissionController");
|
||||
@ -57,7 +76,6 @@ IMPLEMENT_META_INTERFACE(PermissionController, "android.os.IPermissionController
|
||||
status_t BnPermissionController::onTransact(
|
||||
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
|
||||
{
|
||||
//printf("PermissionController received: "); data.print();
|
||||
switch(code) {
|
||||
case CHECK_PERMISSION_TRANSACTION: {
|
||||
CHECK_INTERFACE(IPermissionController, data, reply);
|
||||
@ -69,6 +87,21 @@ status_t BnPermissionController::onTransact(
|
||||
reply->writeInt32(res ? 1 : 0);
|
||||
return NO_ERROR;
|
||||
} break;
|
||||
|
||||
case GET_PACKAGES_FOR_UID_TRANSACTION: {
|
||||
CHECK_INTERFACE(IPermissionController, data, reply);
|
||||
int32_t uid = data.readInt32();
|
||||
Vector<String16> packages;
|
||||
getPackagesForUid(uid, packages);
|
||||
reply->writeNoException();
|
||||
size_t size = packages.size();
|
||||
reply->writeInt32(size);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
reply->writeString16(packages[i]);
|
||||
}
|
||||
return NO_ERROR;
|
||||
} break;
|
||||
|
||||
default:
|
||||
return BBinder::onTransact(code, data, reply, flags);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user