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

Commit e1f79a46 authored by Ajay Panicker's avatar Ajay Panicker Committed by android-build-merger
Browse files

Add guest mode functionality (1/5)

am: 6e2c4a13

* commit '6e2c4a13':
  Add guest mode functionality (1/5)
parents ac4c393b 6e2c4a13
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -744,13 +744,12 @@ static bool cleanupNative(JNIEnv *env, jobject obj) {
    return JNI_TRUE;
}

static jboolean enableNative(JNIEnv* env, jobject obj) {
static jboolean enableNative(JNIEnv* env, jobject obj, jboolean isGuest) {
    ALOGV("%s:",__FUNCTION__);

    jboolean result = JNI_FALSE;
    if (!sBluetoothInterface) return result;

    int ret = sBluetoothInterface->enable();
    int ret = sBluetoothInterface->enable(isGuest == JNI_TRUE ? 1 : 0);
    result = (ret == BT_STATUS_SUCCESS || ret == BT_STATUS_DONE) ? JNI_TRUE : JNI_FALSE;
    return result;
}
@@ -1270,7 +1269,7 @@ static JNINativeMethod sMethods[] = {
    {"classInitNative", "()V", (void *) classInitNative},
    {"initNative", "()Z", (void *) initNative},
    {"cleanupNative", "()V", (void*) cleanupNative},
    {"enableNative", "()Z",  (void*) enableNative},
    {"enableNative", "(Z)Z",  (void*) enableNative},
    {"disableNative", "()Z",  (void*) disableNative},
    {"setAdapterPropertyNative", "(I[B)Z", (void*) setAdapterPropertyNative},
    {"getAdapterPropertiesNative", "()Z", (void*) getAdapterPropertiesNative},
+1 −1
Original line number Diff line number Diff line
@@ -2392,7 +2392,7 @@ public class AdapterService extends Service {
    private native static void classInitNative();
    private native boolean initNative();
    private native void cleanupNative();
    /*package*/ native boolean enableNative();
    /*package*/ native boolean enableNative(boolean startRestricted);
    /*package*/ native boolean disableNative();
    /*package*/ native boolean setAdapterPropertyNative(int type, byte[] val);
    /*package*/ native boolean getAdapterPropertiesNative();
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.os.Message;
import android.os.UserManager;
import android.util.Log;

import com.android.internal.util.State;
@@ -360,7 +361,8 @@ final class AdapterState extends StateMachine {
                    removeMessages(BLE_START_TIMEOUT);

                    //Enable
                    if (!adapterService.enableNative()) {
                    boolean isGuest = UserManager.get(mAdapterService).isGuestUser();
                    if (!adapterService.enableNative(isGuest)) {
                        errorLog("Error while turning Bluetooth on");
                        notifyAdapterStateChange(BluetoothAdapter.STATE_OFF);
                        transitionTo(mOffState);