diff options
author | Bartosz Fabianowski <bartfab@google.com> | 2016-02-11 11:25:39 +0100 |
---|---|---|
committer | Bartosz Fabianowski <bartfab@google.com> | 2016-02-11 11:25:39 +0100 |
commit | bbb3149f3bc301e81c202438b77c45574a90a851 (patch) | |
tree | 9e1e2bf769af73e1e4e9c64bc2985591f7c1f46c /tests/wifitests/src/com/android/server/wifi/BinderUtil.java | |
parent | bfcea7de75875c900de19a8504416492ed96ae21 (diff) | |
download | android_frameworks_opt_net_wifi-bbb3149f3bc301e81c202438b77c45574a90a851.tar.gz android_frameworks_opt_net_wifi-bbb3149f3bc301e81c202438b77c45574a90a851.tar.bz2 android_frameworks_opt_net_wifi-bbb3149f3bc301e81c202438b77c45574a90a851.zip |
Allow managed profile to modify networks
If the current foreground user has a managed profile, apps running in that
profile should have the same permissions to add/remove/modify networks as
apps running as the foreground user itself.
BUG:26867426
Change-Id: I6ab891625b673e617e1c38863b9c6e71e4938a0b
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/BinderUtil.java')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/BinderUtil.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/BinderUtil.java b/tests/wifitests/src/com/android/server/wifi/BinderUtil.java new file mode 100644 index 000000000..107de7c8d --- /dev/null +++ b/tests/wifitests/src/com/android/server/wifi/BinderUtil.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2016 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. + */ + +package com.android.server.wifi; + +import android.os.Binder; + +/** + * Utilities for faking the calling uid in Binder. + */ +public class BinderUtil { + /** + * Fake the calling uid in Binder. + * @param uid the calling uid that Binder should return from now on + */ + public static void setUid(int uid) { + Binder.restoreCallingIdentity((((long) uid) << 32) | Binder.getCallingPid()); + } +} |