Skip to content

Commit 0d7f14a

Browse files
authored
Merge pull request iqiyi#13 from iqiyi/fixPublishEvent
mainly fixed a publish event bug and remove some useless code
2 parents b5fcd03 + 27ddc17 commit 0d7f14a

File tree

19 files changed

+190
-237
lines changed

19 files changed

+190
-237
lines changed

Andromeda-Lib/src/main/java/org/qiyi/video/svg/fragment/RemoteManagerFragment.java

Lines changed: 23 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
/*
2-
* Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3-
*
4-
* Redistribution and use in source and binary forms, with or without modification,
5-
* are permitted provided that the following conditions are met:
6-
*
7-
* 1. Redistributions of source code must retain the above copyright notice,
8-
* this list of conditions and the following disclaimer.
9-
*
10-
* 2. Redistributions in binary form must reproduce the above copyright notice,
11-
* this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12-
*
13-
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14-
* from this software without specific prior written permission.
15-
*
16-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17-
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18-
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19-
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20-
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22-
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23-
*
24-
*/
2+
* Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without modification,
5+
* are permitted provided that the following conditions are met:
6+
*
7+
* 1. Redistributions of source code must retain the above copyright notice,
8+
* this list of conditions and the following disclaimer.
9+
*
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12+
*
13+
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14+
* from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18+
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19+
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23+
*
24+
*/
2525
package org.qiyi.video.svg.fragment;
2626

2727
import android.annotation.SuppressLint;
@@ -34,7 +34,6 @@
3434
import org.qiyi.video.svg.life.ActivityFragLifecycle;
3535
import org.qiyi.video.svg.log.Logger;
3636
import org.qiyi.video.svg.remote.IRemoteManager;
37-
import org.qiyi.video.svg.remote.IRemoteManagerTreeNode;
3837

3938
import java.util.Collections;
4039
import java.util.HashSet;
@@ -56,8 +55,6 @@ public class RemoteManagerFragment extends Fragment {
5655

5756
private final Set<RemoteManagerFragment> childRemoteManagerFrags = new HashSet<>();
5857

59-
private final FragmentRemoteManagerTreeNode remoteManagerTreeNode = new FragmentRemoteManagerTreeNode();
60-
6158
public RemoteManagerFragment() {
6259
this(new ActivityFragLifecycle());
6360
}
@@ -192,28 +189,10 @@ private Fragment getParentFragmentUsingHint() {
192189
return fragment != null ? fragment : parentFragmentHint;
193190
}
194191

195-
private class FragmentRemoteManagerTreeNode implements IRemoteManagerTreeNode {
196-
@Override
197-
public Set<IRemoteManager> getDescendants() {
198-
Set<RemoteManagerFragment> descendantFragments = getDescendantRemoteManagerFragments();
199-
Set<IRemoteManager> descendants = new HashSet<>(descendantFragments.size());
200-
for (RemoteManagerFragment fragment : descendantFragments) {
201-
if (fragment.getRemoteManager() != null) {
202-
descendants.add(fragment.getRemoteManager());
203-
}
204-
}
205-
return descendants;
206-
}
207-
}
208-
209192
public ActivityFragLifecycle getLifecycle() {
210193
return lifecycle;
211194
}
212195

213-
public FragmentRemoteManagerTreeNode getRemoteManagerTreeNode() {
214-
return remoteManagerTreeNode;
215-
}
216-
217196
public void setRemoteManager(IRemoteManager remoteManager) {
218197
this.remoteManager = remoteManager;
219198
}

Andromeda-Lib/src/main/java/org/qiyi/video/svg/fragment/SupportRemoteManagerFragment.java

Lines changed: 23 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
/*
2-
* Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3-
*
4-
* Redistribution and use in source and binary forms, with or without modification,
5-
* are permitted provided that the following conditions are met:
6-
*
7-
* 1. Redistributions of source code must retain the above copyright notice,
8-
* this list of conditions and the following disclaimer.
9-
*
10-
* 2. Redistributions in binary form must reproduce the above copyright notice,
11-
* this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12-
*
13-
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14-
* from this software without specific prior written permission.
15-
*
16-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17-
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18-
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19-
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20-
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22-
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23-
*
24-
*/
2+
* Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without modification,
5+
* are permitted provided that the following conditions are met:
6+
*
7+
* 1. Redistributions of source code must retain the above copyright notice,
8+
* this list of conditions and the following disclaimer.
9+
*
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12+
*
13+
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14+
* from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18+
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19+
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23+
*
24+
*/
2525
package org.qiyi.video.svg.fragment;
2626

2727
import android.annotation.SuppressLint;
@@ -33,7 +33,6 @@
3333
import org.qiyi.video.svg.life.ActivityFragLifecycle;
3434
import org.qiyi.video.svg.log.Logger;
3535
import org.qiyi.video.svg.remote.IRemoteManager;
36-
import org.qiyi.video.svg.remote.IRemoteManagerTreeNode;
3736

3837
import java.util.Collections;
3938
import java.util.HashSet;
@@ -55,8 +54,6 @@ public class SupportRemoteManagerFragment extends Fragment {
5554

5655
private final Set<SupportRemoteManagerFragment> childRemoteManagerFrags = new HashSet<>();
5756

58-
private final IRemoteManagerTreeNode remoteManagerTreeNode = new SupportFragTreeNode();
59-
6057
public SupportRemoteManagerFragment() {
6158
this(new ActivityFragLifecycle());
6259
}
@@ -186,22 +183,4 @@ public void setRemoteManager(IRemoteManager remoteManager) {
186183
this.remoteManager = remoteManager;
187184
}
188185

189-
public IRemoteManagerTreeNode getRemoteManagerTreeNode() {
190-
return remoteManagerTreeNode;
191-
}
192-
193-
private class SupportFragTreeNode implements IRemoteManagerTreeNode {
194-
@Override
195-
public Set<IRemoteManager> getDescendants() {
196-
Set<SupportRemoteManagerFragment> descendantFrags = getDescendantRequestManagerFrags();
197-
Set<IRemoteManager> descendants = new HashSet<>(descendantFrags.size());
198-
for (SupportRemoteManagerFragment fragment : descendantFrags) {
199-
if (fragment.getRemoteManager() != null) {
200-
descendants.add(fragment.getRemoteManager());
201-
}
202-
}
203-
return descendants;
204-
}
205-
}
206-
207186
}

Andromeda-Lib/src/main/java/org/qiyi/video/svg/remote/EmptyRemoteManagerTreeNode.java

Lines changed: 0 additions & 39 deletions
This file was deleted.

Andromeda-Lib/src/main/java/org/qiyi/video/svg/remote/IRemoteManagerTreeNode.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

Andromeda-Lib/src/main/java/org/qiyi/video/svg/remote/RemoteManager.java

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
/*
2-
* Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3-
*
4-
* Redistribution and use in source and binary forms, with or without modification,
5-
* are permitted provided that the following conditions are met:
6-
*
7-
* 1. Redistributions of source code must retain the above copyright notice,
8-
* this list of conditions and the following disclaimer.
9-
*
10-
* 2. Redistributions in binary form must reproduce the above copyright notice,
11-
* this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12-
*
13-
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14-
* from this software without specific prior written permission.
15-
*
16-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17-
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18-
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19-
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20-
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22-
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23-
*
24-
*/
2+
* Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without modification,
5+
* are permitted provided that the following conditions are met:
6+
*
7+
* 1. Redistributions of source code must retain the above copyright notice,
8+
* this list of conditions and the following disclaimer.
9+
*
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12+
*
13+
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14+
* from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18+
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19+
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23+
*
24+
*/
2525
package org.qiyi.video.svg.remote;
2626

2727
import android.content.Context;
@@ -47,18 +47,16 @@
4747
public class RemoteManager implements IRemoteManager, LifecycleListener {
4848

4949
private Lifecycle lifecycle;
50-
private IRemoteManagerTreeNode treeNode;
5150

5251
private Handler handler = new Handler(Looper.getMainLooper());
5352

5453
private Context appContext;
5554

5655
private Set<String> commuStubServiceNames = new HashSet<>();
5756

58-
public RemoteManager(Context context, final Lifecycle lifecycle, IRemoteManagerTreeNode treeNode) {
57+
public RemoteManager(Context context, final Lifecycle lifecycle) {
5958
this.appContext = context;
6059
this.lifecycle = lifecycle;
61-
this.treeNode = treeNode;
6260

6361
if (Utils.isOnBackgroundThread()) {
6462
handler.post(new Runnable() {
@@ -88,6 +86,10 @@ public synchronized IBinder getRemoteService(String serviceCanonicalName) {
8886
return null;
8987
}
9088
BinderBean binderBean = RemoteTransfer.getInstance().getRemoteServiceBean(serviceCanonicalName);
89+
if (binderBean == null) {
90+
Logger.e("Found no binder for "+serviceCanonicalName+"! Please check you have register implementation for it or proguard reasons!");
91+
return null;
92+
}
9193
String commuStubServiceName = ConnectionManager.getInstance().bindAction(appContext, binderBean.getProcessName());
9294
commuStubServiceNames.add(commuStubServiceName);
9395
return binderBean.getBinder();

0 commit comments

Comments
 (0)