setTicketToken exposed to jni and java layer for Android apps to set tokens like AAD (#1131)
* Expose the setTicketToken to jni and java layer for Android apps to set Tokens like AAD with the event * Fix the fucntion call for jni * Fixed comments
This commit is contained in:
Родитель
0f06e94318
Коммит
5a511c3e1e
|
@ -23,6 +23,8 @@ public interface ILogManager extends AutoCloseable {
|
|||
|
||||
public Status resumeTransmission();
|
||||
|
||||
public Status setTicketToken(TicketType type, final String tokenValue);
|
||||
|
||||
public Status setTransmitProfile(TransmitProfile profile);
|
||||
|
||||
public Status setTransmitProfile(String profile);
|
||||
|
|
|
@ -495,6 +495,21 @@ public class LogManager {
|
|||
return Status.getEnum(nativeResumeTransmission());
|
||||
}
|
||||
|
||||
private static native int nativeSetIntTicketToken(int type, final String tokenValue);
|
||||
|
||||
/**
|
||||
* Sets the token ID with the value.
|
||||
*
|
||||
* @param type Type of token(like AAD etc)
|
||||
* @param tokenValue Value of the token
|
||||
* @return Status enum corresponding to the native API execution status_t.
|
||||
*/
|
||||
public static Status setTicketToken(TicketType type, final String tokenValue) {
|
||||
if (type == null) throw new IllegalArgumentException("type is null");
|
||||
|
||||
return Status.getEnum(nativeSetIntTicketToken(type.getValue(), tokenValue));
|
||||
}
|
||||
|
||||
private static native int nativeSetIntTransmitProfile(int profile);
|
||||
|
||||
/**
|
||||
|
|
|
@ -86,6 +86,13 @@ public class LogManagerProvider {
|
|||
return Status.getEnum(nativeResumeTransmission(nativeLogManager));
|
||||
}
|
||||
|
||||
protected native int nativeSetIntTicketToken(long nativeLogManager, int type, final String tokenValue);
|
||||
|
||||
@Override
|
||||
public Status setTicketToken(TicketType type, final String tokenValue) {
|
||||
return Status.getEnum(nativeSetIntTicketToken(nativeLogManager, type.getValue(), tokenValue));
|
||||
}
|
||||
|
||||
protected native int nativeSetTransmitProfileTP(long nativeLogManager, int profile);
|
||||
|
||||
@Override
|
||||
|
|
|
@ -585,6 +585,16 @@ namespace MAT_NS_BEGIN
|
|||
static IAuthTokensController* GetAuthTokensController()
|
||||
LM_SAFE_CALL_PTR(GetAuthTokensController);
|
||||
|
||||
/// <summary>
|
||||
///Sets the ticket token with a value
|
||||
/// </summary>
|
||||
static status_t SetTicketToken(TicketType type, const std::string& tokenValue)
|
||||
{
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetAuthTokensController()->SetTicketToken, type, tokenValue.c_str());
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Obtain event filter collection.
|
||||
/// Notes:
|
||||
|
|
|
@ -94,6 +94,18 @@ extern "C"
|
|||
return static_cast<jint>(WrapperLogManager::ResumeTransmission());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_microsoft_applications_events_LogManager_nativeSetIntTicketToken(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jint jType,
|
||||
jstring jstrTokenValue)
|
||||
{
|
||||
auto ticketValue = JStringToStdString(env, jstrTokenValue);
|
||||
return static_cast<jint>(WrapperLogManager::SetTicketToken(
|
||||
static_cast<TicketType>(jType), ticketValue));
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_microsoft_applications_events_LogManager_nativeSetIntTransmitProfile(
|
||||
JNIEnv* /* env */,
|
||||
|
|
Загрузка…
Ссылка в новой задаче