Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
f2bf58fb
Commit
f2bf58fb
authored
4 years ago
by
Yo Chiang
Committed by
Gerrit Code Review
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fix DynamicSystemClient.start() exceptions"
parents
88baf235
a5c6f7fd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/java/android/os/image/DynamicSystemClient.java
+17
-31
17 additions, 31 deletions
core/java/android/os/image/DynamicSystemClient.java
with
17 additions
and
31 deletions
core/java/android/os/image/DynamicSystemClient.java
+
17
−
31
View file @
f2bf58fb
...
@@ -35,8 +35,6 @@ import android.os.Message;
...
@@ -35,8 +35,6 @@ import android.os.Message;
import
android.os.Messenger
;
import
android.os.Messenger
;
import
android.os.ParcelableException
;
import
android.os.ParcelableException
;
import
android.os.RemoteException
;
import
android.os.RemoteException
;
import
android.os.SystemProperties
;
import
android.util.FeatureFlagUtils
;
import
android.util.Slog
;
import
android.util.Slog
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.Retention
;
...
@@ -251,13 +249,7 @@ public class DynamicSystemClient {
...
@@ -251,13 +249,7 @@ public class DynamicSystemClient {
mService
.
send
(
msg
);
mService
.
send
(
msg
);
}
catch
(
RemoteException
e
)
{
}
catch
(
RemoteException
e
)
{
Slog
.
e
(
TAG
,
"Unable to get status from installation service"
);
Slog
.
e
(
TAG
,
"Unable to get status from installation service"
);
if
(
mExecutor
!=
null
)
{
notifyOnStatusChangedListener
(
STATUS_UNKNOWN
,
CAUSE_ERROR_IPC
,
0
,
e
);
mExecutor
.
execute
(()
->
{
mListener
.
onStatusChanged
(
STATUS_UNKNOWN
,
CAUSE_ERROR_IPC
,
0
,
e
);
});
}
else
{
mListener
.
onStatusChanged
(
STATUS_UNKNOWN
,
CAUSE_ERROR_IPC
,
0
,
e
);
}
}
}
}
}
...
@@ -311,6 +303,20 @@ public class DynamicSystemClient {
...
@@ -311,6 +303,20 @@ public class DynamicSystemClient {
mExecutor
=
null
;
mExecutor
=
null
;
}
}
private
void
notifyOnStatusChangedListener
(
int
status
,
int
cause
,
long
progress
,
Throwable
detail
)
{
if
(
mListener
!=
null
)
{
if
(
mExecutor
!=
null
)
{
mExecutor
.
execute
(
()
->
{
mListener
.
onStatusChanged
(
status
,
cause
,
progress
,
detail
);
});
}
else
{
mListener
.
onStatusChanged
(
status
,
cause
,
progress
,
detail
);
}
}
}
/**
/**
* Bind to {@code DynamicSystem} installation service. Binding to the installation service
* Bind to {@code DynamicSystem} installation service. Binding to the installation service
* allows it to send status updates to {@link #OnStatusChangedListener}. It is recommanded
* allows it to send status updates to {@link #OnStatusChangedListener}. It is recommanded
...
@@ -320,11 +326,6 @@ public class DynamicSystemClient {
...
@@ -320,11 +326,6 @@ public class DynamicSystemClient {
@RequiresPermission
(
android
.
Manifest
.
permission
.
INSTALL_DYNAMIC_SYSTEM
)
@RequiresPermission
(
android
.
Manifest
.
permission
.
INSTALL_DYNAMIC_SYSTEM
)
@SystemApi
@SystemApi
public
void
bind
()
{
public
void
bind
()
{
if
(!
featureFlagEnabled
())
{
Slog
.
w
(
TAG
,
FeatureFlagUtils
.
DYNAMIC_SYSTEM
+
" not enabled; bind() aborted."
);
return
;
}
Intent
intent
=
new
Intent
();
Intent
intent
=
new
Intent
();
intent
.
setClassName
(
"com.android.dynsystem"
,
intent
.
setClassName
(
"com.android.dynsystem"
,
"com.android.dynsystem.DynamicSystemInstallationService"
);
"com.android.dynsystem.DynamicSystemInstallationService"
);
...
@@ -395,11 +396,6 @@ public class DynamicSystemClient {
...
@@ -395,11 +396,6 @@ public class DynamicSystemClient {
@RequiresPermission
(
android
.
Manifest
.
permission
.
INSTALL_DYNAMIC_SYSTEM
)
@RequiresPermission
(
android
.
Manifest
.
permission
.
INSTALL_DYNAMIC_SYSTEM
)
public
void
start
(
@NonNull
Uri
systemUrl
,
@BytesLong
long
systemSize
,
public
void
start
(
@NonNull
Uri
systemUrl
,
@BytesLong
long
systemSize
,
@BytesLong
long
userdataSize
)
{
@BytesLong
long
userdataSize
)
{
if
(!
featureFlagEnabled
())
{
Slog
.
w
(
TAG
,
FeatureFlagUtils
.
DYNAMIC_SYSTEM
+
" not enabled; start() aborted."
);
return
;
}
Intent
intent
=
new
Intent
();
Intent
intent
=
new
Intent
();
intent
.
setClassName
(
"com.android.dynsystem"
,
intent
.
setClassName
(
"com.android.dynsystem"
,
...
@@ -407,6 +403,7 @@ public class DynamicSystemClient {
...
@@ -407,6 +403,7 @@ public class DynamicSystemClient {
intent
.
setData
(
systemUrl
);
intent
.
setData
(
systemUrl
);
intent
.
setAction
(
ACTION_START_INSTALL
);
intent
.
setAction
(
ACTION_START_INSTALL
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
putExtra
(
KEY_SYSTEM_SIZE
,
systemSize
);
intent
.
putExtra
(
KEY_SYSTEM_SIZE
,
systemSize
);
intent
.
putExtra
(
KEY_USERDATA_SIZE
,
userdataSize
);
intent
.
putExtra
(
KEY_USERDATA_SIZE
,
userdataSize
);
...
@@ -414,11 +411,6 @@ public class DynamicSystemClient {
...
@@ -414,11 +411,6 @@ public class DynamicSystemClient {
mContext
.
startActivity
(
intent
);
mContext
.
startActivity
(
intent
);
}
}
private
boolean
featureFlagEnabled
()
{
return
SystemProperties
.
getBoolean
(
FeatureFlagUtils
.
PERSIST_PREFIX
+
FeatureFlagUtils
.
DYNAMIC_SYSTEM
,
false
);
}
private
void
handleMessage
(
Message
msg
)
{
private
void
handleMessage
(
Message
msg
)
{
switch
(
msg
.
what
)
{
switch
(
msg
.
what
)
{
case
MSG_POST_STATUS:
case
MSG_POST_STATUS:
...
@@ -432,13 +424,7 @@ public class DynamicSystemClient {
...
@@ -432,13 +424,7 @@ public class DynamicSystemClient {
Throwable
detail
=
t
==
null
?
null
:
t
.
getCause
();
Throwable
detail
=
t
==
null
?
null
:
t
.
getCause
();
if
(
mExecutor
!=
null
)
{
notifyOnStatusChangedListener
(
status
,
cause
,
progress
,
detail
);
mExecutor
.
execute
(()
->
{
mListener
.
onStatusChanged
(
status
,
cause
,
progress
,
detail
);
});
}
else
{
mListener
.
onStatusChanged
(
status
,
cause
,
progress
,
detail
);
}
break
;
break
;
default
:
default
:
// do nothing
// do nothing
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment