|
|
@ -186,55 +186,110 @@ class AsyncServiceHelper |
|
|
|
String path = mEngineService.getLibPathByVersion(mOpenCVersion); |
|
|
|
String path = mEngineService.getLibPathByVersion(mOpenCVersion); |
|
|
|
if ((null == path) || (path.length() == 0)) |
|
|
|
if ((null == path) || (path.length() == 0)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
InstallCallbackInterface InstallQuery = new InstallCallbackInterface() { |
|
|
|
if (!mLibraryInstallationProgress) |
|
|
|
public String getPackageName() |
|
|
|
{ |
|
|
|
{ |
|
|
|
InstallCallbackInterface InstallQuery = new InstallCallbackInterface() { |
|
|
|
return "OpenCV library"; |
|
|
|
public String getPackageName() |
|
|
|
} |
|
|
|
|
|
|
|
public void install() { |
|
|
|
|
|
|
|
Log.d(TAG, "Trying to install OpenCV lib via Google Play"); |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (mEngineService.installVersion(mOpenCVersion)) |
|
|
|
return "OpenCV library"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void install() { |
|
|
|
|
|
|
|
Log.d(TAG, "Trying to install OpenCV lib via Google Play"); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
mStatus = LoaderCallbackInterface.RESTART_REQUIRED; |
|
|
|
if (mEngineService.installVersion(mOpenCVersion)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mLibraryInstallationProgress = true; |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.RESTART_REQUIRED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Log.d(TAG, "OpenCV package was not installed!"); |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.MARKET_ERROR; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (RemoteException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.INIT_FAILED; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
|
|
|
|
Log.d(TAG, "Init finished with status " + mStatus); |
|
|
|
|
|
|
|
Log.d(TAG, "Unbind from service"); |
|
|
|
|
|
|
|
mAppContext.unbindService(mServiceConnection); |
|
|
|
|
|
|
|
Log.d(TAG, "Calling using callback"); |
|
|
|
|
|
|
|
mUserAppCallback.onManagerConnected(mStatus); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void cancel() { |
|
|
|
|
|
|
|
Log.d(TAG, "OpenCV library installation was canceled"); |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.INSTALL_CANCELED; |
|
|
|
|
|
|
|
Log.d(TAG, "Init finished with status " + mStatus); |
|
|
|
|
|
|
|
Log.d(TAG, "Unbind from service"); |
|
|
|
|
|
|
|
mAppContext.unbindService(mServiceConnection); |
|
|
|
|
|
|
|
Log.d(TAG, "Calling using callback"); |
|
|
|
|
|
|
|
mUserAppCallback.onManagerConnected(mStatus); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void wait_install() { |
|
|
|
|
|
|
|
Log.e(TAG, "Instalation was not started! Nothing to wait!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mUserAppCallback.onPackageInstall(InstallCallbackInterface.NEW_INSTALLATION, InstallQuery); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
InstallCallbackInterface WaitQuery = new InstallCallbackInterface() { |
|
|
|
|
|
|
|
public String getPackageName() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return "OpenCV library"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void install() { |
|
|
|
|
|
|
|
Log.e(TAG, "Nothing to install we just wait current installation"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void cancel() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Log.d(TAG, "OpenCV library installation was canceled"); |
|
|
|
|
|
|
|
mLibraryInstallationProgress = false; |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.INSTALL_CANCELED; |
|
|
|
|
|
|
|
Log.d(TAG, "Init finished with status " + mStatus); |
|
|
|
|
|
|
|
Log.d(TAG, "Unbind from service"); |
|
|
|
|
|
|
|
mAppContext.unbindService(mServiceConnection); |
|
|
|
|
|
|
|
Log.d(TAG, "Calling using callback"); |
|
|
|
|
|
|
|
mUserAppCallback.onManagerConnected(mStatus); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void wait_install() { |
|
|
|
|
|
|
|
Log.d(TAG, "Waiting for current installation"); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
Log.d(TAG, "OpenCV package was not installed!"); |
|
|
|
if (mEngineService.installVersion(mOpenCVersion)) |
|
|
|
mStatus = LoaderCallbackInterface.MARKET_ERROR; |
|
|
|
{ |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.RESTART_REQUIRED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Log.d(TAG, "OpenCV package was not installed!"); |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.MARKET_ERROR; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (RemoteException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.INIT_FAILED; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (RemoteException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.INIT_FAILED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Log.d(TAG, "Init finished with status " + mStatus); |
|
|
|
Log.d(TAG, "Init finished with status " + mStatus); |
|
|
|
Log.d(TAG, "Unbind from service"); |
|
|
|
Log.d(TAG, "Unbind from service"); |
|
|
|
mAppContext.unbindService(mServiceConnection); |
|
|
|
mAppContext.unbindService(mServiceConnection); |
|
|
|
Log.d(TAG, "Calling using callback"); |
|
|
|
Log.d(TAG, "Calling using callback"); |
|
|
|
mUserAppCallback.onManagerConnected(mStatus); |
|
|
|
mUserAppCallback.onManagerConnected(mStatus); |
|
|
|
} |
|
|
|
} |
|
|
|
public void cancel() { |
|
|
|
}; |
|
|
|
Log.d(TAG, "OpenCV library installation was canceled"); |
|
|
|
|
|
|
|
mStatus = LoaderCallbackInterface.INSTALL_CANCELED; |
|
|
|
|
|
|
|
Log.d(TAG, "Init finished with status " + mStatus); |
|
|
|
|
|
|
|
Log.d(TAG, "Unbind from service"); |
|
|
|
|
|
|
|
mAppContext.unbindService(mServiceConnection); |
|
|
|
|
|
|
|
Log.d(TAG, "Calling using callback"); |
|
|
|
|
|
|
|
mUserAppCallback.onManagerConnected(mStatus); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void wait_install() { |
|
|
|
|
|
|
|
Log.e(TAG, "Instalation was not started! Nothing to wait!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mUserAppCallback.onPackageInstall(InstallCallbackInterface.NEW_INSTALLATION, InstallQuery); |
|
|
|
mUserAppCallback.onPackageInstall(InstallCallbackInterface.INSTALLATION_PROGRESS, WaitQuery); |
|
|
|
|
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
Log.d(TAG, "Trying to get library list"); |
|
|
|
Log.d(TAG, "Trying to get library list"); |
|
|
|
|
|
|
|
mLibraryInstallationProgress = false; |
|
|
|
String libs = mEngineService.getLibraryList(mOpenCVersion); |
|
|
|
String libs = mEngineService.getLibraryList(mOpenCVersion); |
|
|
|
Log.d(TAG, "Library list: \"" + libs + "\""); |
|
|
|
Log.d(TAG, "Library list: \"" + libs + "\""); |
|
|
|
Log.d(TAG, "First attempt to load libs"); |
|
|
|
Log.d(TAG, "First attempt to load libs"); |
|
|
|