| /* |
| * Copyright (C) 2014 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| * use this file except in compliance with the License. You may obtain a copy of |
| * the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| * License for the specific language governing permissions and limitations under |
| * the License. |
| */ |
| package com.android.multidexlegacyandexception; |
| |
| public class IntermediateClass { |
| |
| public static int get1(boolean condition) { |
| return new ClassInSecondaryDex(condition).get1(); |
| } |
| |
| public static int get2(boolean condition) { |
| return new ClassInSecondaryDex(condition).get2(); |
| } |
| |
| public static int get3(boolean condition) { |
| ClassInSecondaryDex thrower = new ClassInSecondaryDex(condition); |
| try { |
| thrower.canThrow2(); |
| thrower.canThrow1(); |
| return 1; |
| } catch (ExceptionInMainDex e) { |
| return 10; |
| } catch (ExceptionInSecondaryDex e) { |
| return 11; |
| } catch (ExceptionInMainDex2 e) { |
| return 10; |
| } catch (ExceptionInSecondaryDex2 e) { |
| return 11; |
| } catch (OutOfMemoryError e) { |
| return 12; |
| } catch (CaughtOnlyException e) { |
| return 17; |
| } catch (ExceptionInSecondaryDexWithSuperInMain e) { |
| return 39; |
| } catch (SuperExceptionInSecondaryDex|SuperExceptionInMainDex|CaughtOnlyByIntermediateException e) { |
| return 23; |
| } |
| } |
| |
| public static int get4(boolean condition) { |
| ClassInSecondaryDex thrower = new ClassInSecondaryDex(condition); |
| try { |
| thrower.canThrow2(); |
| thrower.canThrow1(); |
| return 1; |
| } catch (ExceptionInSecondaryDexWithSuperInMain e) { |
| return 39; |
| } catch (ExceptionInSecondaryDex e) { |
| return 11; |
| } catch (ExceptionInSecondaryDex2 e) { |
| return 11; |
| } catch (OutOfMemoryError e) { |
| return 12; |
| } catch (ExceptionInMainDex2 e) { |
| return 10; |
| } catch (ExceptionInMainDex e) { |
| return 10; |
| } catch (CaughtOnlyException e) { |
| return 17; |
| } catch (SuperExceptionInSecondaryDex e) { |
| } catch (SuperExceptionInMainDex e) { |
| } catch (CaughtOnlyByIntermediateException e) { |
| return 35; |
| } |
| return 39; |
| } |
| |
| |
| public static int get5(Throwable thrown) { |
| try { |
| ClassInSecondaryDex.canThrowAll(thrown); |
| return 1; |
| } catch (ExceptionInMainDex e) { |
| return 10; |
| } catch (ExceptionInSecondaryDex e) { |
| return 11; |
| } catch (ExceptionInMainDex2 e) { |
| return 12; |
| } catch (ExceptionInSecondaryDex2 e) { |
| return 13; |
| } catch (OutOfMemoryError e) { |
| return 14; |
| } catch (CaughtOnlyException e) { |
| return 17; |
| } catch (ExceptionInSecondaryDexWithSuperInMain e) { |
| return 39; |
| } catch (SuperExceptionInSecondaryDex|SuperExceptionInMainDex|CaughtOnlyByIntermediateException e) { |
| return 23; |
| } catch (Throwable e) { |
| return 37; |
| } |
| } |
| |
| } |