Commit f7f0d433 by onuma

Task #42647 OS10 で THETAが認識されない。

parent f443fdba
......@@ -134,19 +134,6 @@ android {
abiFilters "arm64-v8a", ""
}
}
x86 {
versionCode defaultConfig.versionCode + 2
ndk {
abiFilters "x86", ""
}
}
x86_64 {
versionCode defaultConfig.versionCode + 3
ndk {
abiFilters "x86_64", ""
}
}
}
}
}
......
......@@ -6,7 +6,7 @@ buildscript {
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
compileSdkVersion 29
buildToolsVersion '28.0.3'
defaultConfig {
......
......@@ -26,7 +26,7 @@ dependencies {
}
android {
compileSdkVersion 26
compileSdkVersion 29
buildToolsVersion '28.0.3'
defaultConfig {
......
......@@ -47,6 +47,7 @@ public class ThetaHelper {
* @return true:接続成功、false:接続失敗
*/
public boolean connectThetaCameraWifi(int networkId) {
Logger.i(TAG,"connectThetaCameraWifi : " + networkId);
WifiManager wifiManager = (WifiManager)mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifiManager == null) {
Logger.e(TAG, "wifiManager == null");
......@@ -66,6 +67,7 @@ public class ThetaHelper {
* @return networkIdを返す(-1は失敗)
*/
public int saveThetaCameraWifi(String ssid) {
Logger.i(TAG, "saveThetaCameraWifi : " + ssid);
WifiManager wifiManager = (WifiManager)mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifiManager == null) {
Logger.e(TAG, "wifiManager == null");
......@@ -107,6 +109,7 @@ public class ThetaHelper {
* @return 存在有無(true:存在する,false:存在しない)
*/
private boolean checkWifiNetwork(String ssid) {
Logger.i(TAG,"checkWifiNetwork : " + ssid);
WifiManager wifiManager = (WifiManager)mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifiManager == null) {
Logger.e(TAG, "wifiManager == null");
......@@ -118,7 +121,7 @@ public class ThetaHelper {
for (ScanResult scanResult : wifiManager.getScanResults()) {
String scanResultSSID = scanResult.SSID.replace("\"", "");
int index = scanResultSSID.indexOf(ssid);
Logger.d(TAG, "scanResultSSID = " + scanResultSSID);
Logger.i(TAG, "scanResultSSID = " + scanResultSSID);
if (index != -1) {
hasWifiList = true;
}
......@@ -131,7 +134,7 @@ public class ThetaHelper {
* @param ssid アクセスポイント
* @return 接続パスワード
*/
private String getPassword(String ssid) {
public static String getPassword(String ssid) {
String password = ssid.replace("THETA","");
password = password.replace(".OSC","");
return password.substring(2);
......@@ -216,6 +219,7 @@ public class ThetaHelper {
* @return true:接続状態、false:非接続状態
*/
public boolean checkThetaCameraWifiConnected(@NonNull WifiManager wifiManager) {
Logger.i(TAG,"--- checkThetaCameraWifiConnected");
List<ScanResult> results = wifiManager.getScanResults();
boolean isConnected = false;
for (ScanResult scanResult : results) {
......@@ -247,48 +251,38 @@ public class ThetaHelper {
* THETAカメラWi-Fiと非接続
*/
public void disConnectThetaCameraWifi(WifiManager wifiManager) {
Logger.i(TAG,"--- disConnectThetaCameraWifi");
//既存接続中のネットワーク切断
WifiInfo wifi_inf = wifiManager.getConnectionInfo();
if (wifi_inf.getNetworkId() != -1 ) {
wifiManager.disableNetwork(wifi_inf.getNetworkId());
wifiManager.disconnect();
}
//通常Wi-Fi再接続処理
// boolean disconnect = true;
// for (WifiConfiguration configuration : wifiManager.getConfiguredNetworks()) {
// if (wifi_inf.getNetworkId() == configuration.networkId) {
// String packageName = mContext.getPackageName();
// int result = configuration.toString().indexOf(packageName);
// if (result != -1) {
// disconnect = false;
// break;
// }
// }
// }
// if (disconnect) {
// //一番近くにあるの通常Wi-Fiに接続
// List<ScanResult> results = wifiManager.getScanResults();
// int level = 0;
// int networkId = -1;
// for (WifiConfiguration configuration : wifiManager.getConfiguredNetworks()) {
// int index = configuration.SSID.indexOf(ABookValues.THETA_MODEL_NAME_THETA);
// if (index != -1) {
// continue;
// }
// for (ScanResult scanResult : results) {
// if (configuration.SSID.indexOf(scanResult.SSID) != -1) {
// if (level == 0 || WifiManager.compareSignalLevel(level, scanResult.level) < 0) {
// level = scanResult.level;
// networkId = configuration.networkId;
// }
// break;
// }
// }
// }
// if (networkId != -1) {
// wifiManager.enableNetwork(networkId, true);
// }
// }
wifiManager.disconnect();
}
public static ConnectivityManager.NetworkCallback networkCallback_ = new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(@NonNull Network network) {
super.onAvailable(network);
}
@Override
public void onLost(@NonNull Network network) {
super.onLost(network);
}
@Override
public void onUnavailable() {
super.onUnavailable();
}
};
public static ConnectivityManager.NetworkCallback getNetworkCallback(){
if (networkCallback_ == null) {
networkCallback_ = new ConnectivityManager.NetworkCallback();
}
return networkCallback_;
}
......@@ -316,6 +310,7 @@ public class ThetaHelper {
* ConnectivityManagerを利用してアプリ(プロセス)全体のネットワークを解除する。
*/
public void appConnectedWifiDefault() {
Logger.i(TAG,"---- appConnectedWifiDefault");
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
ConnectivityManager connectivityManager = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null) {
......
......@@ -10,10 +10,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import jp.agentec.abook.abv.bl.common.log.Logger;
/**
* Input stream for motion JPEG data
*/
public class MJpegInputStream extends DataInputStream {
private static final String TAG = "MJpegInputStream";
private final byte[] SOI_MARKER = {(byte) 0xFF, (byte) 0xD8};
private final byte[] EOF_MARKER = {(byte) 0xFF, (byte) 0xD9};
private final static String CONTENT_LENGTH = "Content-Length";
......@@ -77,13 +80,17 @@ public class MJpegInputStream extends DataInputStream {
properties.load(bais);
return Integer.parseInt(properties.getProperty(CONTENT_LENGTH));
}
private int systemCount_ = 0;
/**
* Acquire image data for 1 frame
* @return Image data for 1 frame
* @throws IOException
*/
public Bitmap readMJpegFrame() throws IOException {
if (systemCount_%10 == 0) {
Logger.i(TAG, "--- readMJpegFrame");
}
systemCount_++;
mark(FRAME_MAX_LENGTH);
int headerLength = getStartOfSequence(this, SOI_MARKER);
int contentLength;
......
......@@ -25,7 +25,23 @@ public class PreferenceUtil {
public static boolean get(Context context, String key, boolean def) {
return getPref(context).getBoolean(key, def);
}
/**
* SharedPreference から、指定のキーで値をとりだす。String[]
* @param context
* @param key キー
* @return String[] 、データがなければnull
*/
public static String[] get(Context context , String key) {
SharedPreferences prefs = getUserPreference(context);
String result = prefs.getString(key,"");
if (result.length() > 0) {
return result.split(",");
}
return null;
}
public static boolean contains(Context context, String key) {
return getPref(context).contains(key);
}
......@@ -41,6 +57,26 @@ public class PreferenceUtil {
public static void put(Context context, String key, String val) {
getEditor(context).putString(key, val).commit();
}
/**
* SharedPreference に String[] で値を保存します。
* @param context
* @param key キー
* @param vals 保存する値 String[]
*/
public static void put(Context context, String key, String[] vals) {
StringBuffer buffer = new StringBuffer();
String stringItem;
for(String val : vals){
buffer.append(val + ",");
};
String buf = buffer.toString();
stringItem = buf.substring(0, buf.length() - 1);
SharedPreferences prefs = getUserPreference(context);
Editor editor = prefs.edit();
editor.putString(key, stringItem).commit();
}
public static void clear(Context context) {
getEditor(context).clear().commit();
......
......@@ -534,6 +534,7 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
* @return true:有効, false:無効
*/
protected boolean deviceWifiEnable() {
Logger.i(TAG,"--------- deviceWifiEnable");
if (DeviceInfo.isDeviceWifiEnabled(this)) {
return true;
} else {
......
......@@ -25,6 +25,7 @@ public interface AppDefType {
String CURSOR_ENABLE = "cursorEnable";
String DISPLAY_MARKING = "displayMarking";
String APP_VERSIONUP_PROCESSING = "appVersionProcessingFlag";
String THETA_SSID_STRING = "THETA_SSID";
}
interface UserPrefKey {
......
......@@ -1884,6 +1884,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
* THETAカメラと接続が切れたときにTHETA関連Activityをすべて終了させる
*/
public synchronized void finishAllThetaActivity() {
Logger.i(TAG,"---- finishAllThetaActivity");
for (ABVAuthenticatedActivity activity : currentActivityStack) {
if (activity instanceof ThetaActivity) {
activity.finish();
......
......@@ -9,10 +9,16 @@ import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.net.Uri;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiNetworkSpecifier;
import android.os.Build;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.provider.MediaStore;
......@@ -31,6 +37,7 @@ import com.theta.helper.ThetaHelper;
import com.theta.network.ThetaDeviceInfo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
......@@ -42,6 +49,7 @@ import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.constant.ABookValues;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.environment.DeviceInfo;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -101,6 +109,10 @@ public class DeviceImageListActivity extends ABVUIActivity {
private SceneSendHelper mSceneSendHelper = new SceneSendHelper(this);
private WifiManager mWifiManager;
private List<String> savedThetaList_ = new ArrayList<>();
private boolean isStartCamera_ = false; // THETAとの接続開始フラグ
private ConnectivityManager.NetworkCallback networkCallback_ = null; // ネットワーク状態更新時のコールバック
@Override
public void onCreate(Bundle savedInstanceState) {
Logger.i(TAG, "onCreate");
......@@ -221,6 +233,17 @@ public class DeviceImageListActivity extends ABVUIActivity {
displayGalleryGridView();
}
mIsOnResume = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// Android10の場合は、コールバック登録解除で、THETAとの接続が切れる
if (networkCallback_ != null && isStartCamera_) {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) {
cm.unregisterNetworkCallback(networkCallback_);
isStartCamera_ = false;
}
}
}
}
//端末の戻るボタン禁止
......@@ -508,6 +531,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logger.i(TAG,"registerButton.onClick");
buttonDoubleTapControl(registerButton);
if (deviceWifiEnable()) {
wifiScanStart();
......@@ -561,6 +585,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
* ブロードキャスト リスナーを登録し、Wifiスキャンを開始する。
*/
private void wifiScanStart() {
Logger.i(TAG,"---- wifiScanStart");
showProgressPopup();
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
mWifiManager.startScan();
......@@ -571,35 +596,92 @@ public class DeviceImageListActivity extends ABVUIActivity {
* @param ssid アクセスポイント
* @param networkId 接続可能なネットワークID
*/
private void connectThetaWifi(String ssid, int networkId) {
showProgressPopup(getString(R.string.msg_wifi_connecting));
if (networkId == -1) {
networkId = mThetaHelper.saveThetaCameraWifi(ssid);
if (networkId == -1) {
Logger.e(TAG, "saveThetaCameraWifi networkId -1");
closeProgressPopup();
showSimpleAlertDialog(getString(R.string.msg_fail_connect_theta_wifi));
return;
}
}
private void connectThetaWifi(final String ssid, int networkId) {
Logger.i(TAG,"connectThetaWifi");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
Logger.i(TAG,"connectThetaWifi Android10");
showProgressPopup(getString(R.string.msg_wifi_connecting));
WifiNetworkSpecifier.Builder builder = new WifiNetworkSpecifier.Builder();
builder.setSsid(ssid);
String pass = ThetaHelper.getPassword(ssid);
builder.setWpa2Passphrase(pass);
WifiNetworkSpecifier wifiNetworkSpecifier = builder.build();
NetworkRequest.Builder networkRequestBuilder = new NetworkRequest.Builder();
networkRequestBuilder.addTransportType(NetworkCapabilities.TRANSPORT_WIFI);
networkRequestBuilder.setNetworkSpecifier(wifiNetworkSpecifier);
NetworkRequest networkRequest = networkRequestBuilder.build();
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) {
networkCallback_ = new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
closeProgressPopup();
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) {
// 接続したら保存
addThetaSSID(ssid);
PreferenceUtil.put(getApplicationContext(), AppDefType.DefPrefKey.THETA_SSID_STRING, savedThetaList_.toArray(new String[savedThetaList_.size()]));
cm.bindProcessToNetwork(network);
handler.postDelayed(new Runnable() {
@Override
public void run() {
new DeviceInfoTask(DeviceImageListActivity.this).execute();
}
}, GET_THETA_CAMERA_INFO_DELAY);
}
}
@Override
public void onLost(Network network) {
super.onLost(network);
closeProgressPopup();
}
boolean isSuccess = mThetaHelper.connectThetaCameraWifi(networkId);
if (isSuccess) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
new DeviceInfoTask(DeviceImageListActivity.this).execute();
}
}, GET_THETA_CAMERA_INFO_DELAY);
@Override
public void onUnavailable() {
super.onUnavailable();
closeProgressPopup();
}
};
cm.requestNetwork(networkRequest, networkCallback_);
}
} else {
Logger.e(TAG, "connectThetaCameraWifi fail");
closeProgressPopup();
AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_fail_connect_theta_wifi, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
wifiScanStart();
Logger.i(TAG,"connectThetaWifi Android9以下");
showProgressPopup(getString(R.string.msg_wifi_connecting));
if (networkId == -1) {
networkId = mThetaHelper.saveThetaCameraWifi(ssid);
if (networkId == -1) {
Logger.e(TAG, "saveThetaCameraWifi networkId -1");
closeProgressPopup();
showSimpleAlertDialog(getString(R.string.msg_fail_connect_theta_wifi));
return;
}
});
}
boolean isSuccess = mThetaHelper.connectThetaCameraWifi(networkId);
if (isSuccess) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
new DeviceInfoTask(DeviceImageListActivity.this).execute();
}
}, GET_THETA_CAMERA_INFO_DELAY);
} else {
Logger.e(TAG, "connectThetaCameraWifi fail");
closeProgressPopup();
AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_fail_connect_theta_wifi, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Logger.i(TAG, "---AlertDialogUtil.onClick");
wifiScanStart();
}
});
}
}
}
......@@ -623,14 +705,15 @@ public class DeviceImageListActivity extends ABVUIActivity {
* @param deviceInfo THETAカメラ情報
*/
public void thetaDeviceInfoTaskFinish(ThetaDeviceInfo deviceInfo) {
Logger.i(TAG, "--- thetaDeviceInfoTaskFinish");
closeProgressPopup();
if (deviceInfo != null && deviceInfo.getModel().length() != 0) {
if (deviceInfo.getModel().equals(ABookValues.THETA_MODEL_NAME_THETA_S) || deviceInfo.getModel().equals(ABookValues.THETA_MODEL_NAME_THETA_SC)) {
putUserPref(ABookKeys.THETA_OLD_VERSION_FLG, true);
Logger.d(TAG, "thetaDeviceInfoTaskFinish use API2.0");
Logger.i(TAG, "thetaDeviceInfoTaskFinish use API2.0");
} else {
putUserPref(ABookKeys.THETA_OLD_VERSION_FLG, false);
Logger.d(TAG, "thetaDeviceInfoTaskFinish use API2.1");
Logger.i(TAG, "thetaDeviceInfoTaskFinish use API2.1");
}
if (mThetaDeviceConnectDialog != null && mThetaDeviceConnectDialog.isShowing()) {
......@@ -641,10 +724,12 @@ public class DeviceImageListActivity extends ABVUIActivity {
Intent intent = new Intent();
intent.setClassName(getPackageName(), ThetaCameraActivity.class.getName());
startActivity(intent);
isStartCamera_ = true;
} else {
AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_fail_connect_theta_wifi, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Logger.i(TAG,"---AlertDialogUtil.onClick");
wifiScanStart();
}
});
......@@ -657,6 +742,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
BroadcastReceiver wifiReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Logger.i(TAG,"--- wifiReceiver onReceive");
unregisterReceiver(wifiReceiver);
thetaWifiScanResult();
}
......@@ -669,35 +755,51 @@ public class DeviceImageListActivity extends ABVUIActivity {
* ③未登録の端末情報取得し、画面再描画
*/
public void thetaWifiScanResult() {
Logger.i(TAG, "--- thetaWifiScanResult");
List<ScanResult> results = mWifiManager.getScanResults();
boolean isConnected = false;
List<ThetaDeviceInfo> scanWifiList = new ArrayList<>();
List<ThetaDeviceInfo> scanSavedWifiList = new ArrayList<>();
for (ScanResult scanResult : results) {
String scanSSID = scanResult.SSID.replace("\"", "");
Logger.d(TAG, "*****scanSSID = "+ scanSSID);
Logger.i(TAG, "*****scanSSID = "+ scanSSID);
if (scanSSID.length() != 0) {
int index = scanSSID.indexOf(ABookValues.THETA_MODEL_NAME_THETA);
ThetaDeviceInfo deviceInfo = new ThetaDeviceInfo();
if (index != -1) {
int networkId = -1;
for (WifiConfiguration configuration : mWifiManager.getConfiguredNetworks()) {
// Android4.2以降よりダブルクォーテーションが付いてくるので除去
String configurationSSID = configuration.SSID.replace("\"", "");
if (configurationSSID.equals(scanSSID)) {
if (configuration.status == WifiConfiguration.Status.CURRENT) {
isConnected = true;
} else {
networkId = configuration.networkId;
deviceInfo.setSSID(configurationSSID);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
Logger.i(TAG, "--- thetaWifiScanResult --- Q以上");
deviceInfo.setSSID(scanSSID);
String[] ssid = PreferenceUtil.get(getApplicationContext(), AppDefType.DefPrefKey.THETA_SSID_STRING);
if (ssid != null) {
savedThetaList_ = Arrays.asList(ssid);
if (findThetaSSID(scanSSID)) {
networkId = 0; // -1 だと未登録になるので
deviceInfo.setSSID(scanSSID);
deviceInfo.setNetworkId(networkId);
}
}
} else {
Logger.i(TAG, "--- thetaWifiScanResult --- OS9 以下");
for (WifiConfiguration configuration : mWifiManager.getConfiguredNetworks()) {
// Android4.2以降よりダブルクォーテーションが付いてくるので除去
String configurationSSID = configuration.SSID.replace("\"", "");
if (configurationSSID.equals(scanSSID)) {
if (configuration.status == WifiConfiguration.Status.CURRENT) {
isConnected = true;
} else {
networkId = configuration.networkId;
deviceInfo.setSSID(configurationSSID);
deviceInfo.setNetworkId(networkId);
}
break;
}
}
if (isConnected) {
break;
}
}
if (isConnected) {
break;
}
if (networkId == -1) { //保存されてない
deviceInfo.setSSID(scanSSID);
scanWifiList.add(deviceInfo);
......@@ -707,11 +809,12 @@ public class DeviceImageListActivity extends ABVUIActivity {
}
}
}
//THETA接続状態の場合、カメラ画面へ遷移
if (isConnected) {
//THETA接続状態の場合、カメラ画面へ遷移
changeProgressPopup(getString(R.string.msg_wifi_connecting));
new DeviceInfoTask(DeviceImageListActivity.this).execute();
} else { //カメラ選択画面再描画
} else {
//カメラ選択画面再描画
WifiThetaConnectAdapter savedAdapter = (WifiThetaConnectAdapter) savedListView.getAdapter();
savedAdapter.setListItem(scanSavedWifiList);
savedAdapter.notifyDataSetChanged();
......@@ -719,7 +822,39 @@ public class DeviceImageListActivity extends ABVUIActivity {
notSaveAdapter.setListItem(scanWifiList);
notSaveAdapter.notifyDataSetChanged();
}
closeProgressPopup();
}
/**
* savedThetaList_ に新しい ssidを追加する
* @param ssid
* @return ssidの追加された、あたらしいsavedThetaList_
*/
private List<String> addThetaSSID(String ssid) {
if (savedThetaList_.size()==0){
// 最初の1つめは必ず登録
savedThetaList_.add(ssid);
} else {
for (String id : savedThetaList_) {
if (!findThetaSSID(id)) {
savedThetaList_.add(id);
}
}
}
return savedThetaList_;
}
/**
* savedThetaList_ に、すでにssidが存在するか?
* @param ssid
* @return 存在するならtrue
*/
private boolean findThetaSSID(String ssid) {
for (String id : savedThetaList_) {
if (id.equals(ssid)) {
return true;
}
}
return false;
}
}
......@@ -5,12 +5,15 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import com.theta.helper.ThetaHelper;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
......@@ -40,11 +43,13 @@ public class ThetaActivity extends ABVUIActivity {
BroadcastReceiver wifiReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Logger.i(TAG,"---- wifiReceiver onReceive");
unregisterReceiver(wifiReceiver);
boolean isConnected = mThetaHelper.checkThetaCameraWifiConnected(mWifiManager);
closeProgressPopup();
//THETAカメラ画面閉じる
if (mWifiScanType == Constant.WifiScanType.CloseCameraActivity) {
isConnected = true;
if (isConnected) {
mThetaHelper.disConnectThetaCameraWifi(mWifiManager);
}
......@@ -89,6 +94,7 @@ public class ThetaActivity extends ABVUIActivity {
* Wi-Fiが接続状態かチェックする。
*/
protected void closeThetaCameraActivity() {
Logger.i(TAG,"---- closeThetaCameraActivity");
showProgressPopup();
//現在接続状態なのかチェック
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
......
......@@ -62,7 +62,7 @@ public class ThetaCameraActivity extends ThetaActivity {
closeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logger.v(TAG, "CloseBtn.onClick");
Logger.i(TAG, "--- CloseBtn.onClick");
buttonDoubleTapControl(closeBtn);
mLiveView.stopPlay();
if (deviceWifiEnable()) {
......@@ -78,6 +78,7 @@ public class ThetaCameraActivity extends ThetaActivity {
mShootBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logger.i(TAG, "--- mShootBtn.onClick");
buttonDoubleTapControl(mShootBtn);
showProgressPopup();
new ShootTask(ThetaCameraActivity.this).execute();
......@@ -91,6 +92,7 @@ public class ThetaCameraActivity extends ThetaActivity {
mImageListBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logger.i(TAG, "--- mImageListBtn.onClick");
buttonDoubleTapControl(mImageListBtn);
Intent intent = new Intent();
intent.setClassName(getPackageName(), ThetaImageListActivity.class.getName());
......@@ -232,6 +234,7 @@ public class ThetaCameraActivity extends ThetaActivity {
* @param fileId ファイルID
*/
public void shootTaskFinish(final String fileId) {
Logger.i(TAG,"shootTaskFinish : " + fileId);
handler.post(new Runnable() {
@Override
public void run() {
......@@ -254,7 +257,7 @@ public class ThetaCameraActivity extends ThetaActivity {
* @param mJpegInputStream Live画像データ
*/
public void showLiveViewTaskFinish(MJpegInputStream mJpegInputStream) {
Logger.i(TAG,"----- showLiveViewTaskFinish");
if (mJpegInputStream != null) {
mLiveView.setSource(mJpegInputStream);
new GetOptionExposureTask(ThetaCameraActivity.this).execute();
......@@ -311,6 +314,7 @@ public class ThetaCameraActivity extends ThetaActivity {
*/
@Override
protected void thetaCameraWifiConnected() {
Logger.i(TAG,"thetaCameraWifiConnected");
if (mLiveView.getSource() == null) {
if (mLivePreviewTask != null) {
mLivePreviewTask.cancel(true);
......
......@@ -40,6 +40,7 @@ public class ThetaImageListActivity extends ThetaActivity {
private boolean isSelected = false;
@Override
public void onCreate(Bundle savedInstanceState) {
Logger.i(TAG, "--- onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_theta_image_list);
mImageListView = findViewById(R.id.lv_theta_image);
......
......@@ -40,7 +40,7 @@ public class ThetaImagePreviewActivity extends ThetaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Logger.d(TAG, "onCreate");
Logger.i(TAG, "onCreate");
setContentView(R.layout.ac_theta_image_preview);
isSavedSuccess = false;
// 戻るボタン
......@@ -48,6 +48,7 @@ public class ThetaImagePreviewActivity extends ThetaActivity {
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logger.i(TAG, "--- backBtn.onClick");
//転送後にTHETAライブラリ再描画のため
if (isThetaListActivityBack && isSavedSuccess) {
setResult(RESULT_OK);
......@@ -61,6 +62,7 @@ public class ThetaImagePreviewActivity extends ThetaActivity {
mSaveBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logger.i(TAG,"mSaveBtn.onClick");
buttonDoubleTapControl(mSaveBtn);
AlertDialogUtil.showAlertDialog(ThetaImagePreviewActivity.this, R.string.app_name, R.string.msg_theta_image_send_confirm, false, new DialogInterface.OnClickListener() {
@Override
......@@ -70,9 +72,11 @@ public class ThetaImagePreviewActivity extends ThetaActivity {
@Override
public void run() {
if (mThetaHelper.thetaImageLocalSave(mTexture.getPhoto(), mFileId)) {
Logger.i(TAG,"画像転送に成功しました。");
showSimpleAlertDialog(R.string.app_name, R.string.msg_theta_image_send_success);
isSavedSuccess = true;
} else {
Logger.i(TAG,"画像転送に失敗しました。");
showSimpleAlertDialog(R.string.app_name, R.string.msg_theta_image_send_fail);
}
closeProgressPopup();
......@@ -98,7 +102,7 @@ public class ThetaImagePreviewActivity extends ThetaActivity {
//端末の戻るボタン禁止
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
Logger.v(TAG, "dispatchKeyEvent %s", event);
Logger.i(TAG, "dispatchKeyEvent %s", event);
if (event.getAction()==KeyEvent.ACTION_UP) { // 戻るボタンを抑止
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
return true;
......@@ -112,6 +116,7 @@ public class ThetaImagePreviewActivity extends ThetaActivity {
* @param imageData 画像データ
*/
public void loadPhotoTaskFinish(ImageData imageData) {
Logger.i(TAG, "--- loadPhotoTaskFinish");
if (imageData != null) {
byte[] dataObject = imageData.getRawData();
if (dataObject == null) {
......
......@@ -24,12 +24,13 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
private static final int FAIL_RETRAY_DELAY_MILLIS = 2000;
public DeviceInfoTask(DeviceImageListActivity refActivity) {
Logger.i(TAG,"--- DeviceInfoTask");
this.refActivity = new WeakReference<>(refActivity);
}
@Override
protected ThetaDeviceInfo doInBackground(Void... params) {
Logger.d(TAG, "doInBackground");
Logger.i(TAG, "--- doInBackground");
HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS);
final int MAX_RETRY_COUNT = 6;
ThetaDeviceInfo deviceInfo = null;
......@@ -56,7 +57,7 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
@Override
protected void onPostExecute(ThetaDeviceInfo deviceInfo) {
Logger.d(TAG, "onPostExecute");
Logger.i(TAG, "--- onPostExecute");
DeviceImageListActivity activity = refActivity.get();
activity.thetaDeviceInfoTaskFinish(deviceInfo);
}
......
......@@ -32,6 +32,7 @@ public class ImageListTask extends AsyncTask<Void, String, List<ImageRow>> {
private final WeakReference<ThetaImageListActivity> refActivity;
public ImageListTask(ThetaImageListActivity refActivity) {
Logger.i(TAG, "--- ImageListTask");
this.refActivity = new WeakReference<>(refActivity);
}
......@@ -43,7 +44,7 @@ public class ImageListTask extends AsyncTask<Void, String, List<ImageRow>> {
@Override
protected List<ImageRow> doInBackground(Void... params) {
try {
Logger.d(TAG, "doInBackground");
Logger.i(TAG, "---- doInBackground");
boolean isOldApi = PreferenceUtil.getUserPref(refActivity.get(), ABookKeys.THETA_OLD_VERSION_FLG, false);
HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS, isOldApi);
ArrayList<ImageInfo> objects = camera.getList();
......
......@@ -34,13 +34,14 @@ public class LoadPhotoTask extends AsyncTask<Void, Object, ImageData> {
private long receivedDataSize = 0;
public LoadPhotoTask(Activity refActivity, String fileId) {
Logger.i(TAG,"--- LoadPhotoTask");
this.refActivity = new WeakReference<>(refActivity);
this.mFileId = fileId;
}
@Override
protected void onPreExecute() {
Logger.d(TAG, "onPreExecute");
Logger.i(TAG, "--- onPreExecute");
Activity activity = refActivity.get();
if (activity instanceof ThetaImagePreviewActivity) {
ThetaImagePreviewActivity previewActivity = (ThetaImagePreviewActivity)activity;
......@@ -52,17 +53,19 @@ public class LoadPhotoTask extends AsyncTask<Void, Object, ImageData> {
@Override
protected ImageData doInBackground(Void... params) {
try {
Logger.d(TAG,"start to download image" + mFileId);
Logger.i(TAG,"start to download image" + mFileId);
boolean isOldApi = PreferenceUtil.getUserPref(refActivity.get(), ABookKeys.THETA_OLD_VERSION_FLG, false);
HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS, isOldApi);
ImageData resizedImageData = camera.getImage(mFileId, new HttpDownloadListener() {
@Override
public void onTotalSize(long totalSize) {
Logger.i(TAG,"----onTotalSize : " + totalSize);
fileSize = totalSize;
}
@Override
public void onDataReceived(int size) {
//Logger.i(TAG,"----onDataReceived : " + size);
receivedDataSize += size;
if (fileSize != 0) {
......@@ -87,10 +90,12 @@ public class LoadPhotoTask extends AsyncTask<Void, Object, ImageData> {
ThetaImagePreviewActivity previewActivity = (ThetaImagePreviewActivity)activity;
for (Object param : values) {
if (param instanceof Integer) {
Logger.d(TAG, "onProgressUpdate progress = " + param);
if ((Integer)((Integer) param).intValue()%10 == 0) {
Logger.i(TAG, "--- onProgressUpdate progress = " + param);
}
previewActivity.progressDialogHorizontal.setProgress((Integer) param);
} else if (param instanceof String) {
Logger.d(TAG, "onProgressUpdate param = " + param);
Logger.i(TAG, "onProgressUpdate param = " + param);
}
}
}
......@@ -98,7 +103,7 @@ public class LoadPhotoTask extends AsyncTask<Void, Object, ImageData> {
@Override
protected void onPostExecute(ImageData imageData) {
Logger.d(TAG, "onPostExecute");
Logger.i(TAG, "---- onPostExecute");
Activity activity = refActivity.get();
if (activity instanceof ThetaImagePreviewActivity) {
ThetaImagePreviewActivity previewActivity = (ThetaImagePreviewActivity)activity;
......
......@@ -29,23 +29,30 @@ public class ShowLiveViewTask extends AsyncTask<Void, String, MJpegInputStream>
private final WeakReference<ThetaCameraActivity> refActivity;
public ShowLiveViewTask(ThetaCameraActivity refActivity) {
Logger.i(TAG,"---- ShowLiveViewTask");
this.refActivity = new WeakReference<>(refActivity);
}
@Override
protected MJpegInputStream doInBackground(Void... params) {
Logger.d(TAG, "doInBackground");
Logger.i(TAG, "--- doInBackground");
MJpegInputStream mjis = null;
final int MAX_RETRY_COUNT = 5;
for (int retryCount = 0; retryCount < MAX_RETRY_COUNT; retryCount++) {
Logger.i(TAG,"retryCount = " + retryCount);
try {
boolean isOldApi = PreferenceUtil.getUserPref(refActivity.get(), ABookKeys.THETA_OLD_VERSION_FLG, false);
//boolean isOldApi = false;
Logger.i(TAG,"1");
HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS, isOldApi);
Logger.i(TAG,"2");
InputStream is = camera.getLivePreview();
Logger.i(TAG,"3");
mjis = new MJpegInputStream(is);
Logger.i(TAG,"4");
//正常にライブ再生されるか確認
mjis.readMJpegFrame();
Logger.i(TAG,"5");
retryCount = MAX_RETRY_COUNT;
} catch (IOException e) {
Logger.e(TAG,"doInBackground fail e = " + e.toString());
......
......@@ -35,7 +35,7 @@ public class ActionZoomLayout extends RelativeLayout {
@Override
protected void dispatchDraw(Canvas canvas) {
canvas.save(Canvas.ALL_SAVE_FLAG);
canvas.save();
canvas.concat(imgMatrix);
super.dispatchDraw(canvas);
canvas.restore();
......
......@@ -179,7 +179,7 @@ public class ZoomRelativeLayout extends RelativeLayout {
@Override
protected void dispatchDraw(Canvas canvas) {
canvas.save(Canvas.ALL_SAVE_FLAG);
canvas.save();
if (!isOperationPdf) {
canvas.concat(imgMatrix);
}
......
......@@ -44,7 +44,7 @@ download_server_address=https://check.abookcloud.com/acms
#syncview server
websocket_server_http_url=https://chatdev2.abook.bz/v1
websocket_server_ws_url=wss://chatdev2.abook.bz/v1
#WebSocket debug出力
#WebSocket debug出力
websocket_debug=false
#Payment Settings
......@@ -54,38 +54,38 @@ google_public_key3=LShEIudH7Q7jLZERczfa0PknZCC5I3G0bTNa/EndTMLIR6/W3DLHToDk5L5Nk
#Application Settings
app_name=ABook Check
#true:スリープ禁止, false:スリープ許可
#true:スリープ禁止, false:スリープ許可
keep_screen=false
scheme_url=jp.agentec.abook.check
#true:自動バージョン確認を行わない false:CMSへ自動バージョン確認を行う
#true:自動バージョン確認を行わない false:CMSへ自動バージョン確認を行う
store_version=false
product_code=1
#コンテンツリソースをcacheフォルダに展開するかしないか
#コンテンツリソースをcacheフォルダに展開するかしないか
use_cache=true
#コンテンツリソースをcacheフォルダに展開する数
#コンテンツリソースをcacheフォルダに展開する数
cache_size=0
#コンテンツのHead暗号化するかしないか
#コンテンツのHead暗号化するかしないか
content_protected=true
#use_cacheと同様にPDFサムネイルimageをファイル化するかしないか
#use_cacheと同様にPDFサムネイルimageをファイル化するかしないか
pdf_thumbnail_output=true
#use_cacheと同様にPDFページimageをファイル化するかしないか
#use_cacheと同様にPDFページimageをファイル化するかしないか
pdf_image_output=true
#自動新着更新間隔(分) -1のとき自動更新しない
#自動新着更新間隔(分) -1のとき自動更新しない
content_refresh_interval=30
#アプリ異常終了時会議室再入室アラート表示期限(分)
#アプリ異常終了時会議室再入室アラート表示期限(分)
meeting_reenter_alert=1440
#これより小さい閲覧時間(秒)のページログは送信しない
#これより小さい閲覧時間(秒)のページログは送信しない
min_page_log_second=3
#メニュー表示をサービスオプションに従う
#メニュー表示をサービスオプションに従う
follow_service_option=true
#パスワード失敗時の回数チェックを行うか否か
#パスワード失敗時の回数チェックを行うか否か
is_check_invalid_passward_limit=true
#リピート再生のデフォルト値
#リピート再生のデフォルト値
repeat_default=true
#Setting Info(設定画面のABookについての設定情報)
#Setting Info(設定画面のABookについての設定情報)
version_name=1.2.362
release_date=2021/01/27
copy_right=2016 AGENTEC Co.,Ltd. All rights reserved.
......@@ -95,10 +95,10 @@ contact_email=abook-appsupport@agentec.jp
#Log Settings
log_level=0
default_log_name=abvje
#エラーレポート/Exportログ送信方法 1:acms 2:平文メール(開発・テスト時のみ) 3:暗号化添付メール
#エラーレポート/Exportログ送信方法 1:acms 2:平文メール(開発・テスト時のみ) 3:暗号化添付メール
error_report_flg=1
error_report_email=abook-appsupport@agentec.jp
#アプリ専用ログ保存期間(日)(0はログ出力なし)
#アプリ専用ログ保存期間(日)(0はログ出力なし)
app_log_retention=7
hprof=false
......@@ -107,26 +107,26 @@ repository_fqdn=s.abook.bz
# abvFunctionOptions.xml
#Login
#0:認証なし, 1:ログインID、パスワード, 2:アカウント文字列、ログインID、パスワード, 3:サイトID、アカウント文字列、ログインID、パスワード4:サイトID、アカウント文字列
#0:認証なし, 1:ログインID、パスワード, 2:アカウント文字列、ログインID、パスワード, 3:サイトID、アカウント文字列、ログインID、パスワード4:サイトID、アカウント文字列
login_mode=2
#login_modeが0、1の場合のアカウントパス
#login_modeが0、1の場合のアカウントパス
account_path=agtcatalog
#GCM
push_message=1
#手動更新
#0:非表示 1:表示 1.3.1
#手動更新
#0:非表示 1:表示 1.3.1
check_app_update=1
#ユーザ切り替え時全社グループのコンテンツを削除しない
#0:全てのコンテンツ削除 1:全社のコンテンツ削除しない 1.5.3
#ユーザ切り替え時全社グループのコンテンツを削除しない
#0:全てのコンテンツ削除 1:全社のコンテンツ削除しない 1.5.3
not_delete_all_contents=0
BLJAR_NAME=ABVJE_BL.jar
#store用の場合、armv7,x86両方ビルド
#storeではない場合、armv7のみビルド
#store用の場合、armv7,x86両方ビルド
#storeではない場合、armv7のみビルド
isStoreProduct=false
#1.2.302 Edition
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment