2 * Copyright (C) 2013 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #define LOG_TAG "AppOpsCallback"
19 #include <binder/IAppOpsCallback.h>
21 #include <utils/Debug.h>
22 #include <utils/Log.h>
23 #include <binder/Parcel.h>
24 #include <utils/String8.h>
26 #include <private/binder/Static.h>
30 // ----------------------------------------------------------------------
32 class BpAppOpsCallback : public BpInterface<IAppOpsCallback>
35 BpAppOpsCallback(const sp<IBinder>& impl)
36 : BpInterface<IAppOpsCallback>(impl)
40 virtual void opChanged(int32_t op, const String16& packageName) {
42 data.writeInterfaceToken(IAppOpsCallback::getInterfaceDescriptor());
44 data.writeString16(packageName);
45 remote()->transact(OP_CHANGED_TRANSACTION, data, &reply);
49 IMPLEMENT_META_INTERFACE(AppOpsCallback, "com.android.internal.app.IAppOpsCallback");
51 // ----------------------------------------------------------------------
53 status_t BnAppOpsCallback::onTransact(
54 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
57 case OP_CHANGED_TRANSACTION: {
58 CHECK_INTERFACE(IAppOpsCallback, data, reply);
59 int32_t op = data.readInt32();
60 String16 packageName = data.readString16();
61 opChanged(op, packageName);
62 reply->writeNoException();
66 return BBinder::onTransact(code, data, reply, flags);
70 }; // namespace android