正在查看: FanCode v7.24.0 应用的 Client.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: FanCode v7.24.0 应用的 Client.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.conviva.sdk;
import com.connectsdk.service.webos.lgcast.common.utils.StringUtil;
import com.conviva.api.ClientSettings;
import com.conviva.api.ContentMetadata;
import com.conviva.api.ConvivaBackgroundManager;
import com.conviva.api.ConvivaConstants;
import com.conviva.api.ConvivaException;
import com.conviva.api.SystemFactory;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import y7.f;
import y7.g;
import z7.c;
import z7.d;
import z7.i;
import z7.l;
class Client {
public static final int NO_SESSION_KEY = -2;
private d _exceptionCatcher;
private String _globalVersion;
protected g _sessionFactory;
private ClientSettings _settings;
protected SystemFactory _systemFactory;
private String _version;
private boolean defaultGatewayURLError;
private volatile boolean initialized;
protected i _logger = null;
private int _globalSessionKey = -1;
private int _hintedGlobalSessionKeyIPv4 = -1;
private int _hintedGlobalSessionKeyIPv6 = -1;
private boolean _released = false;
private ConvivaBackgroundManager mBackgroundManger = null;
private c _config = null;
private int _id = -1;
class C7MyCallable implements Callable<Void> {
int id = -2;
final ContentMetadata val$adMetadata;
final int val$contentSessionKey;
final PlayerStateManagerAPI val$playerStateManagerAPI;
public String version;
C7MyCallable(int i9, ContentMetadata contentMetadata, PlayerStateManagerAPI playerStateManagerAPI) {
this.val$contentSessionKey = i9;
this.val$adMetadata = contentMetadata;
this.val$playerStateManagerAPI = playerStateManagerAPI;
}
public int getSessionId() {
return this.id;
}
@Override
public Void call() throws Exception {
this.id = Client.this._sessionFactory.l(this.val$contentSessionKey, this.val$adMetadata, this.val$playerStateManagerAPI, this.version);
return null;
}
}
public Client(ClientSettings clientSettings, SystemFactory systemFactory, String str) {
this._settings = null;
this._exceptionCatcher = null;
this.initialized = false;
this.defaultGatewayURLError = false;
if (clientSettings.isInitialized()) {
try {
if (new URL(ClientSettings.defaultProductionGatewayUrl).getHost().equals(new URL(clientSettings.gatewayUrl).getHost())) {
this.defaultGatewayURLError = true;
}
} catch (MalformedURLException unused) {
}
if (str != null) {
this._version = str;
}
this._globalVersion = "4.0.42";
ClientSettings clientSettings2 = new ClientSettings(clientSettings);
this._settings = clientSettings2;
clientSettings2.version = str;
this._systemFactory = systemFactory;
systemFactory.configure("SDK", clientSettings2);
d buildExceptionCatcher = this._systemFactory.buildExceptionCatcher();
this._exceptionCatcher = buildExceptionCatcher;
try {
buildExceptionCatcher.b(new Callable<Void>(this, clientSettings) {
Client _client;
final ClientSettings val$clientSettings;
{
this.val$clientSettings = clientSettings;
this._client = this;
}
@Override
public Void call() throws Exception {
Client client = Client.this;
client._logger = client._systemFactory.buildLogger();
Client.this._logger.a("Client");
Client.this._logger.e("init(): url=" + Client.this._settings.gatewayUrl);
if (Client.this.defaultGatewayURLError) {
Client.this._logger.error("Gateway URL should not be set to https://cws.conviva.com or http://cws.conviva.com, therefore this call is ignored");
Client.this.defaultGatewayURLError = false;
}
Client client2 = Client.this;
client2._config = client2._systemFactory.buildConfig();
Client.this._config.g();
Client client3 = Client.this;
client3._id = ((Integer) client3._config.e("iid")).intValue();
Client.this._logger.e("iid fetched from the config in Client:init()=" + Client.this._id);
if (Client.this._id == -1) {
Client.this._id = l.a();
}
Client client4 = Client.this;
client4._sessionFactory = client4._systemFactory.buildSessionFactory(client4._settings, Client.this._config);
Client.this._logger.e("init(): done.");
y7.b.r(this.val$clientSettings, Client.this._systemFactory);
return null;
}
}, "Client.init");
this.initialized = true;
} catch (Exception unused2) {
this.initialized = false;
this._systemFactory = null;
this._exceptionCatcher = null;
g gVar = this._sessionFactory;
if (gVar != null) {
gVar.f();
}
this._sessionFactory = null;
}
}
}
public void startBackgroundManager(boolean z9) {
if (z9) {
try {
if (this.mBackgroundManger == null) {
this.mBackgroundManger = ConvivaBackgroundManager.initConvivaBackgroundManager();
}
} catch (Exception e9) {
e9.printStackTrace();
return;
}
}
if (this.mBackgroundManger != null) {
stopBackgroundManager();
}
}
public void stopBackgroundManager() {
try {
ConvivaBackgroundManager convivaBackgroundManager = this.mBackgroundManger;
if (convivaBackgroundManager != null) {
convivaBackgroundManager.deregisterCallback();
}
this.mBackgroundManger = null;
} catch (Exception e9) {
e9.printStackTrace();
}
}
public void adEnd(final int i9) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.f();
return null;
}
}, "Client.adEnd");
}
}
public void adStart(final int i9, final ConvivaConstants.AdStream adStream, final ConvivaConstants.AdPlayer adPlayer, final ConvivaConstants.AdPosition adPosition) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.g(adStream, adPlayer, adPosition);
return null;
}
}, "Client.adStart");
}
}
public void attachPlayer(final int i9, final PlayerStateManagerAPI playerStateManagerAPI) throws ConvivaException {
if (isInitialized()) {
if (playerStateManagerAPI == null) {
this._logger.error("attachPlayer(): expecting an instance of PlayerStateManager for playerStateManager parameter");
} else {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.j(playerStateManagerAPI);
return null;
}
}, "Client.attachPlayer");
}
}
}
public void cleanupSession(final int i9) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
if (Client.this._sessionFactory.k(i9) == null) {
return null;
}
Client.this._sessionFactory.g(i9, true);
return null;
}
}, "Client.cleanupSession");
}
}
public void contentPreload(final int i9) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.n();
return null;
}
}, "Client.contentPreload");
}
}
public void contentStart(final int i9) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.o();
return null;
}
}, "Client.contentStart");
}
}
public int createAdSession(final int i9, final ContentMetadata contentMetadata) throws ConvivaException {
if (!isInitialized()) {
return -2;
}
?? r02 = new Callable<Void>() {
int id = -2;
public int getSessionId() {
return this.id;
}
@Override
public Void call() throws Exception {
this.id = Client.this._sessionFactory.l(i9, contentMetadata, null, null);
return null;
}
};
this._exceptionCatcher.b(r02, "Client.createAdSession");
return r02.getSessionId();
}
public void createHintedGlobalSession() throws ConvivaException {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
String clientId = Client.this.getClientId();
if (clientId == null || x7.a.f17310c == clientId) {
return null;
}
String str = Client.this._settings.gatewayUrl.endsWith("testonly.conviva.com") ? "testonly.conviva.com" : "cws.conviva.com";
if (Client.this._hintedGlobalSessionKeyIPv4 < 0) {
ContentMetadata contentMetadata = new ContentMetadata();
HashMap hashMap = new HashMap();
contentMetadata.custom = hashMap;
hashMap.put("c3.IPV4IPV6Collection", "T");
contentMetadata.custom.put("c3.domain", "ipv4." + str);
Client client = Client.this;
client._hintedGlobalSessionKeyIPv4 = client._sessionFactory.m(contentMetadata, g.a.HINTED_IPV4);
}
if (Client.this._hintedGlobalSessionKeyIPv6 >= 0) {
return null;
}
ContentMetadata contentMetadata2 = new ContentMetadata();
HashMap hashMap2 = new HashMap();
contentMetadata2.custom = hashMap2;
hashMap2.put("c3.IPV4IPV6Collection", "T");
contentMetadata2.custom.put("c3.domain", "ipv6." + str);
Client client2 = Client.this;
client2._hintedGlobalSessionKeyIPv6 = client2._sessionFactory.m(contentMetadata2, g.a.HINTED_IPV6);
return null;
}
}, "Client.createHintedGlobalSession");
}
public int createSession(final ContentMetadata contentMetadata) throws ConvivaException {
if (!isInitialized()) {
return -2;
}
?? r02 = new Callable<Void>() {
int id = -2;
public int getSessionId() {
return this.id;
}
@Override
public Void call() throws Exception {
this.id = Client.this._sessionFactory.o(contentMetadata, null);
return null;
}
};
this._exceptionCatcher.b(r02, "Client.createSession");
return r02.getSessionId();
}
public void detachPlayer(final int i9) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.r();
return null;
}
}, "Client.detachPlayer");
}
}
public String getAppVersion() {
try {
?? r02 = new Callable<Void>() {
private String version;
public String getVersion() {
return this.version;
}
@Override
public Void call() throws Exception {
this.version = Client.this._systemFactory.getMetadataInterface().getAppVersion();
return null;
}
};
this._exceptionCatcher.b(r02, "getAppVersion");
return r02.getVersion();
} catch (ConvivaException unused) {
return StringUtil.EMPTY;
}
}
public String getClientGlobalVersion() {
return this._globalVersion;
}
public String getClientId() {
c cVar = this._config;
if (cVar == null || cVar.e("clientId") == null) {
return null;
}
return String.valueOf(this._config.e("clientId"));
}
public String getClientVersion() {
return this._version;
}
public int getId() {
return this._id;
}
public int getInstanceId() {
return this._id;
}
public PlayerStateManagerAPI getPlayerStateManager() throws ConvivaException {
if (isInitialized()) {
return new PlayerStateManagerAPI(this._systemFactory);
}
throw new ConvivaException("This instance of Conviva.Client is not active.");
}
public f getSessionByInternalId(final int i9) throws ConvivaException {
if (!isInitialized()) {
try {
throw new ConvivaException("This instance of Conviva.Client is not active.");
} catch (ConvivaException e9) {
e9.printStackTrace();
}
}
?? r02 = new Callable<Void>() {
f session = null;
public f getSessionByInternalId() {
return this.session;
}
@Override
public Void call() throws Exception {
this.session = Client.this._sessionFactory.j(i9);
return null;
}
};
this._exceptionCatcher.b(r02, "Client.getSessionByInternalId");
return r02.getSessionByInternalId();
}
public int getSessionId(final int i9) throws ConvivaException {
if (!isInitialized()) {
try {
throw new ConvivaException("This instance of Conviva.Client is not active.");
} catch (ConvivaException e9) {
e9.printStackTrace();
}
}
?? r02 = new Callable<Void>() {
int sessionId = -2;
public int getSessionId() {
return this.sessionId;
}
@Override
public Void call() throws Exception {
f i10 = Client.this._sessionFactory.i(i9);
if (i10 == null) {
return null;
}
this.sessionId = i10.z();
return null;
}
};
this._exceptionCatcher.b(r02, "Client.getSessionId");
return r02.getSessionId();
}
public ClientSettings getSettings() {
if (isInitialized()) {
return new ClientSettings(this._settings);
}
return null;
}
public SystemFactory getSystemFactory() {
if (isInitialized()) {
return this._systemFactory;
}
return null;
}
public boolean isInitialized() {
return this.initialized && !this._released;
}
public void release() throws ConvivaException {
if (!this._released && isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
Client.this._logger.e("release()");
y7.b.m();
Client.this.stopBackgroundManager();
if (Client.this._hintedGlobalSessionKeyIPv4 >= 0) {
Client client = Client.this;
client.cleanupSession(client._hintedGlobalSessionKeyIPv4);
Client.this._hintedGlobalSessionKeyIPv4 = -1;
}
if (Client.this._hintedGlobalSessionKeyIPv6 >= 0) {
Client client2 = Client.this;
client2.cleanupSession(client2._hintedGlobalSessionKeyIPv6);
Client.this._hintedGlobalSessionKeyIPv6 = -1;
}
if (Client.this._globalSessionKey >= 0) {
Client client3 = Client.this;
client3.cleanupSession(client3._globalSessionKey);
Client.this._globalSessionKey = -1;
}
Client.this._sessionFactory.f();
Client client4 = Client.this;
client4._sessionFactory = null;
client4._logger = null;
client4._id = -1;
Client.this._exceptionCatcher = null;
Client.this._settings = null;
SystemFactory systemFactory = Client.this._systemFactory;
if (systemFactory != null) {
systemFactory.release();
Client.this._systemFactory = null;
}
Client.this._released = true;
return null;
}
}, "Client.release");
}
}
public void releasePlayerStateManager(final PlayerStateManagerAPI playerStateManagerAPI) throws ConvivaException {
if (!isInitialized()) {
throw new ConvivaException("This instance of Conviva.Client is not active.");
}
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
PlayerStateManagerAPI playerStateManagerAPI2 = playerStateManagerAPI;
if (!(playerStateManagerAPI2 instanceof PlayerStateManagerAPI)) {
return null;
}
playerStateManagerAPI2.release();
return null;
}
}, "Client.releasePlayerStateManager");
}
public void reportError(final int i9, final String str, final ConvivaConstants.ErrorSeverity errorSeverity) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.K(str, errorSeverity);
return null;
}
}, "Client.reportPlaybackError");
}
}
public void sendCustomEvent(final int i9, final String str, final Map<String, Object> map) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
int i10 = i9;
if (i10 == -2) {
if (Client.this._globalSessionKey < 0) {
ContentMetadata contentMetadata = new ContentMetadata();
Client client = Client.this;
client._globalSessionKey = client._sessionFactory.m(contentMetadata, g.a.GLOBAL);
}
i10 = Client.this._globalSessionKey;
}
f i11 = Client.this._sessionFactory.i(i10);
if (i11 == null) {
return null;
}
i11.M(str, map);
return null;
}
}, "Client.sendCustomEvent");
}
}
public void setUserPreferenceForDataCollection(Map<String, Boolean> map) {
if (isInitialized()) {
SystemFactory.setUserPreferenceForDataCollection(map);
}
}
public void setUserPreferenceForDataDeletion(Map<String, Boolean> map) {
if (isInitialized()) {
SystemFactory.setUserPreferenceForDataDeletion(map);
}
}
public void updateContentMetadata(final int i9, final ContentMetadata contentMetadata) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
Client.this.startBackgroundManager(contentMetadata.isOfflinePlayback);
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.S(contentMetadata);
return null;
}
}, "Client.updateContentMetadata");
}
}
public void updateCustomMetric(final int i9, final String str, final String str2) throws ConvivaException {
if (!isInitialized()) {
throw new ConvivaException("This instance of Conviva.Client is not active.");
}
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f i10 = Client.this._sessionFactory.i(i9);
if (i10 == null) {
return null;
}
i10.T(str, str2);
return null;
}
}, "Client.updateCustomMetric");
}
public void updateDeviceInfo(Map<String, Object> map) {
if (isInitialized() && map != null) {
this._systemFactory.configureDeviceInfo(map);
}
}
public void detachPlayer(final int i9, final boolean z9) throws ConvivaException {
if (isInitialized()) {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.s(z9);
return null;
}
}, "Client.detachPlayer");
}
}
public void attachPlayer(final int i9, PlayerStateManager playerStateManager, boolean z9) throws ConvivaException {
if (isInitialized()) {
if (playerStateManager == null) {
this._logger.error("attachPlayer(): expecting an instance of PlayerStateManager for playerStateManager parameter");
} else {
this._exceptionCatcher.b(new Callable<Void>() {
@Override
public Void call() throws Exception {
f k9 = Client.this._sessionFactory.k(i9);
if (k9 == null) {
return null;
}
k9.i();
return null;
}
}, "Client.attachPlayer");
}
}
}
public int createAdSession(int i9, ContentMetadata contentMetadata, PlayerStateManagerAPI playerStateManagerAPI) throws ConvivaException {
return createAdSession(i9, contentMetadata, playerStateManagerAPI, null);
}
public int createSession(final ContentMetadata contentMetadata, final PlayerStateManagerAPI playerStateManagerAPI) throws ConvivaException {
if (!isInitialized()) {
return -2;
}
?? r02 = new Callable<Void>() {
int id = -2;
public int getSessionId() {
return this.id;
}
@Override
public Void call() throws Exception {
this.id = Client.this._sessionFactory.o(contentMetadata, playerStateManagerAPI);
return null;
}
};
this._exceptionCatcher.b(r02, "Client.createSession");
return r02.getSessionId();
}
public int createAdSession(int i9, ContentMetadata contentMetadata, PlayerStateManagerAPI playerStateManagerAPI, String str) throws ConvivaException {
if (!isInitialized()) {
return -2;
}
C7MyCallable c7MyCallable = new C7MyCallable(i9, contentMetadata, playerStateManagerAPI);
c7MyCallable.version = str;
this._exceptionCatcher.b(c7MyCallable, "Client.createAdSession");
return c7MyCallable.getSessionId();
}
}