Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
016b2cad
Commit
016b2cad
authored
Oct 25, 2012
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 2473 Service connection leak in OpenCV Manager installation waiting fixed.
Some code refactoring done.
parent
92170959
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
37 deletions
+35
-37
android+AsyncServiceHelper.java
...s/java/generator/src/java/android+AsyncServiceHelper.java
+35
-37
No files found.
modules/java/generator/src/java/android+AsyncServiceHelper.java
View file @
016b2cad
...
@@ -46,7 +46,6 @@ class AsyncServiceHelper
...
@@ -46,7 +46,6 @@ class AsyncServiceHelper
protected
LoaderCallbackInterface
mUserAppCallback
;
protected
LoaderCallbackInterface
mUserAppCallback
;
protected
String
mOpenCVersion
;
protected
String
mOpenCVersion
;
protected
Context
mAppContext
;
protected
Context
mAppContext
;
protected
int
mStatus
=
LoaderCallbackInterface
.
SUCCESS
;
protected
static
boolean
mServiceInstallationProgress
=
false
;
protected
static
boolean
mServiceInstallationProgress
=
false
;
protected
static
boolean
mLibraryInstallationProgress
=
false
;
protected
static
boolean
mLibraryInstallationProgress
=
false
;
...
@@ -171,12 +170,11 @@ class AsyncServiceHelper
...
@@ -171,12 +170,11 @@ class AsyncServiceHelper
{
{
if
(
mEngineService
.
getEngineVersion
()
<
MINIMUM_ENGINE_VERSION
)
if
(
mEngineService
.
getEngineVersion
()
<
MINIMUM_ENGINE_VERSION
)
{
{
mStatus
=
LoaderCallbackInterface
.
INCOMPATIBLE_MANAGER_VERSION
;
Log
.
d
(
TAG
,
"Init finished with status "
+
LoaderCallbackInterface
.
INCOMPATIBLE_MANAGER_VERSION
);
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
(
LoaderCallbackInterface
.
INCOMPATIBLE_MANAGER_VERSION
);
return
;
return
;
}
}
...
@@ -193,43 +191,40 @@ class AsyncServiceHelper
...
@@ -193,43 +191,40 @@ class AsyncServiceHelper
}
}
public
void
install
()
{
public
void
install
()
{
Log
.
d
(
TAG
,
"Trying to install OpenCV lib via Google Play"
);
Log
.
d
(
TAG
,
"Trying to install OpenCV lib via Google Play"
);
boolean
result
;
try
try
{
{
if
(
mEngineService
.
installVersion
(
mOpenCVersion
))
if
(
mEngineService
.
installVersion
(
mOpenCVersion
))
{
{
mLibraryInstallationProgress
=
true
;
mLibraryInstallationProgress
=
true
;
result
=
true
;
Log
.
d
(
TAG
,
"Package installation statred"
);
Log
.
d
(
TAG
,
"Package installation statred"
);
Log
.
d
(
TAG
,
"Unbind from service"
);
mAppContext
.
unbindService
(
mServiceConnection
);
}
}
else
else
{
{
result
=
false
;
Log
.
d
(
TAG
,
"OpenCV package was not installed!"
);
Log
.
d
(
TAG
,
"OpenCV package was not installed!"
);
mStatus
=
LoaderCallbackInterface
.
MARKET_ERROR
;
Log
.
d
(
TAG
,
"Init finished with status "
+
LoaderCallbackInterface
.
MARKET_ERROR
);
Log
.
d
(
TAG
,
"Unbind from service"
);
mAppContext
.
unbindService
(
mServiceConnection
);
Log
.
d
(
TAG
,
"Calling using callback"
);
mUserAppCallback
.
onManagerConnected
(
LoaderCallbackInterface
.
MARKET_ERROR
);
}
}
}
catch
(
RemoteException
e
)
{
}
catch
(
RemoteException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();;
result
=
false
;
Log
.
d
(
TAG
,
"Init finished with status "
+
LoaderCallbackInterface
.
INIT_FAILED
);
mStatus
=
LoaderCallbackInterface
.
INIT_FAILED
;
}
if
(!
result
)
{
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
(
LoaderCallbackInterface
.
INIT_FAILED
);
}
}
}
}
public
void
cancel
()
{
public
void
cancel
()
{
Log
.
d
(
TAG
,
"OpenCV library installation was canceled"
);
Log
.
d
(
TAG
,
"OpenCV library installation was canceled"
);
mStatus
=
LoaderCallbackInterface
.
INSTALL_CANCELED
;
Log
.
d
(
TAG
,
"Init finished with status "
+
LoaderCallbackInterface
.
INSTALL_CANCELED
);
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
(
LoaderCallbackInterface
.
INSTALL_CANCELED
);
}
}
public
void
wait_install
()
{
public
void
wait_install
()
{
Log
.
e
(
TAG
,
"Instalation was not started! Nothing to wait!"
);
Log
.
e
(
TAG
,
"Instalation was not started! Nothing to wait!"
);
...
@@ -253,12 +248,11 @@ class AsyncServiceHelper
...
@@ -253,12 +248,11 @@ class AsyncServiceHelper
{
{
Log
.
d
(
TAG
,
"OpenCV library installation was canceled"
);
Log
.
d
(
TAG
,
"OpenCV library installation was canceled"
);
mLibraryInstallationProgress
=
false
;
mLibraryInstallationProgress
=
false
;
mStatus
=
LoaderCallbackInterface
.
INSTALL_CANCELED
;
Log
.
d
(
TAG
,
"Init finished with status "
+
LoaderCallbackInterface
.
INSTALL_CANCELED
);
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
(
LoaderCallbackInterface
.
INSTALL_CANCELED
);
}
}
public
void
wait_install
()
{
public
void
wait_install
()
{
Log
.
d
(
TAG
,
"Waiting for current installation"
);
Log
.
d
(
TAG
,
"Waiting for current installation"
);
...
@@ -267,21 +261,25 @@ class AsyncServiceHelper
...
@@ -267,21 +261,25 @@ class AsyncServiceHelper
if
(!
mEngineService
.
installVersion
(
mOpenCVersion
))
if
(!
mEngineService
.
installVersion
(
mOpenCVersion
))
{
{
Log
.
d
(
TAG
,
"OpenCV package was not installed!"
);
Log
.
d
(
TAG
,
"OpenCV package was not installed!"
);
mStatus
=
LoaderCallbackInterface
.
MARKET_ERROR
;
Log
.
d
(
TAG
,
"Init finished with status "
+
LoaderCallbackInterface
.
MARKET_ERROR
);
Log
.
d
(
TAG
,
"Init finished with status "
+
mStatus
);
Log
.
d
(
TAG
,
"Unbind from service"
);
mAppContext
.
unbindService
(
mServiceConnection
);
Log
.
d
(
TAG
,
"Calling using callback"
);
Log
.
d
(
TAG
,
"Calling using callback"
);
mUserAppCallback
.
onManagerConnected
(
mStatus
);
mUserAppCallback
.
onManagerConnected
(
LoaderCallbackInterface
.
MARKET_ERROR
);
}
else
{
Log
.
d
(
TAG
,
"Wating for package installation"
);
}
}
Log
.
d
(
TAG
,
"Unbind from service"
);
mAppContext
.
unbindService
(
mServiceConnection
);
}
catch
(
RemoteException
e
)
{
}
catch
(
RemoteException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
mStatus
=
LoaderCallbackInterface
.
INIT_FAILED
;
Log
.
d
(
TAG
,
"Init finished with status "
+
LoaderCallbackInterface
.
INIT_FAILED
);
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
(
LoaderCallbackInterface
.
INIT_FAILED
);
}
}
}
}
};
};
...
@@ -297,33 +295,33 @@ class AsyncServiceHelper
...
@@ -297,33 +295,33 @@ class AsyncServiceHelper
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"
);
int
status
;
if
(
initOpenCVLibs
(
path
,
libs
))
if
(
initOpenCVLibs
(
path
,
libs
))
{
{
Log
.
d
(
TAG
,
"First attempt to load libs is OK"
);
Log
.
d
(
TAG
,
"First attempt to load libs is OK"
);
mS
tatus
=
LoaderCallbackInterface
.
SUCCESS
;
s
tatus
=
LoaderCallbackInterface
.
SUCCESS
;
}
}
else
else
{
{
Log
.
d
(
TAG
,
"First attempt to load libs fails"
);
Log
.
d
(
TAG
,
"First attempt to load libs fails"
);
mS
tatus
=
LoaderCallbackInterface
.
INIT_FAILED
;
s
tatus
=
LoaderCallbackInterface
.
INIT_FAILED
;
}
}
Log
.
d
(
TAG
,
"Init finished with status "
+
mS
tatus
);
Log
.
d
(
TAG
,
"Init finished with status "
+
s
tatus
);
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
(
mS
tatus
);
mUserAppCallback
.
onManagerConnected
(
s
tatus
);
}
}
}
}
catch
(
RemoteException
e
)
catch
(
RemoteException
e
)
{
{
e
.
printStackTrace
();
e
.
printStackTrace
();
mStatus
=
LoaderCallbackInterface
.
INIT_FAILED
;
Log
.
d
(
TAG
,
"Init finished with status "
+
LoaderCallbackInterface
.
INIT_FAILED
);
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
(
LoaderCallbackInterface
.
INIT_FAILED
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment