Home | History | Annotate | Download | only in multidexlegacyandexception
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
      5  * use this file except in compliance with the License. You may obtain a copy of
      6  * the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
     13  * License for the specific language governing permissions and limitations under
     14  * the License.
     15  */
     16 package com.android.multidexlegacyandexception;
     17 
     18 public class IntermediateClass {
     19 
     20     public static int get1(boolean condition) {
     21         return new ClassInSecondaryDex(condition).get1();
     22     }
     23 
     24     public static int get2(boolean condition) {
     25         return new ClassInSecondaryDex(condition).get2();
     26     }
     27 
     28     public static int get3(boolean condition) {
     29         ClassInSecondaryDex thrower = new ClassInSecondaryDex(condition);
     30         try {
     31             thrower.canThrow2();
     32             thrower.canThrow1();
     33             return 1;
     34         } catch (ExceptionInMainDex e) {
     35             return 10;
     36         } catch (ExceptionInSecondaryDex e) {
     37             return 11;
     38         } catch (ExceptionInMainDex2 e) {
     39             return 10;
     40         } catch (ExceptionInSecondaryDex2 e) {
     41             return 11;
     42         } catch (OutOfMemoryError e) {
     43             return 12;
     44         } catch (CaughtOnlyException e) {
     45             return 17;
     46         } catch (ExceptionInSecondaryDexWithSuperInMain e) {
     47             return 39;
     48         } catch (SuperExceptionInSecondaryDex|SuperExceptionInMainDex|CaughtOnlyByIntermediateException e) {
     49             return 23;
     50        }
     51     }
     52 
     53     public static int get4(boolean condition) {
     54         ClassInSecondaryDex thrower = new ClassInSecondaryDex(condition);
     55         try {
     56             thrower.canThrow2();
     57             thrower.canThrow1();
     58             return 1;
     59         } catch (ExceptionInSecondaryDexWithSuperInMain e) {
     60             return 39;
     61         } catch (ExceptionInSecondaryDex e) {
     62             return 11;
     63         } catch (ExceptionInSecondaryDex2 e) {
     64             return 11;
     65         } catch (OutOfMemoryError e) {
     66             return 12;
     67         } catch (ExceptionInMainDex2 e) {
     68             return 10;
     69         } catch (ExceptionInMainDex e) {
     70             return 10;
     71         } catch (CaughtOnlyException e) {
     72             return 17;
     73         } catch (SuperExceptionInSecondaryDex e) {
     74         } catch (SuperExceptionInMainDex e) {
     75         } catch (CaughtOnlyByIntermediateException e) {
     76             return 35;
     77         }
     78         return 39;
     79     }
     80 
     81 
     82     public static int get5(Throwable thrown) {
     83         try {
     84             ClassInSecondaryDex.canThrowAll(thrown);
     85             return 1;
     86         } catch (ExceptionInMainDex e) {
     87             return 10;
     88         } catch (ExceptionInSecondaryDex e) {
     89             return 11;
     90         } catch (ExceptionInMainDex2 e) {
     91             return 12;
     92         } catch (ExceptionInSecondaryDex2 e) {
     93             return 13;
     94         } catch (OutOfMemoryError e) {
     95             return 14;
     96         } catch (CaughtOnlyException e) {
     97             return 17;
     98         } catch (ExceptionInSecondaryDexWithSuperInMain e) {
     99             return 39;
    100         } catch (SuperExceptionInSecondaryDex|SuperExceptionInMainDex|CaughtOnlyByIntermediateException e) {
    101             return 23;
    102        } catch (Throwable e) {
    103             return 37;
    104         }
    105     }
    106 
    107 }
    108